aboutsummaryrefslogtreecommitdiffhomepage
path: root/CraftBukkit-Patches/0025-Better-EULA-handling.patch
blob: 7528160c7e8db0bd471bf6d7b03e3198599df841 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From d26e74b1e0318675002c6e2b62ead78a2c388949 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Tue, 8 Jul 2014 22:39:41 -0500
Subject: [PATCH] Better EULA handling


diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index e9a1a67..38b76ba 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -9,6 +9,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Random;
 import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit; // PaperSpigot
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -76,7 +77,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
 
         i.info("Loading properties");
         this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
-        this.n = new EULA(new File("eula.txt"));
+        // PaperSpigot start - Display a EULA warning then continue
+        File EULALock = new File( ".eula-lock");
         // Spigot Start
         boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" );
         if ( eulaAgreed )
@@ -84,13 +86,24 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
             System.err.println( "You have used the Spigot command line EULA agreement flag." );
             System.err.println( "By using this setting you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)." );
             System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." );
-        }
-        // Spigot End
-        if (!this.n.a() && !eulaAgreed) {
-            i.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
-            this.n.b();
-            return false;
+            // Spigot End
         } else {
+            if (!EULALock.exists()) {
+                System.err.println("WARNING: By using this server you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)");
+                System.err.println("If you do not agree to the above EULA please stop this server and remove it from your system immediately.");
+                System.err.println("The server will start in 10 seconds, you will only see this message and have to wait this one time.");
+                try {
+                    EULALock.createNewFile();
+                } catch (IOException e1) {
+                    System.err.println("Unable to create EULA lock file");
+                    e1.printStackTrace();
+                }
+                try {
+                    Thread.sleep(TimeUnit.SECONDS.toMillis(10));
+                } catch (InterruptedException ex) {
+                }
+            }
+                // PaperSpigot end
             if (this.N()) {
                 this.c("127.0.0.1");
             } else {
@@ -252,6 +265,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
                 return true;
             }
         }
+        return true; // PaperSpigot
     }
 
     // CraftBukkit start
-- 
1.9.1