Skip to content

Commit

Permalink
Change Global EULA Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFishCakes committed Sep 7, 2023
1 parent e7a86cf commit 4c416d3
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions patches/server/0014-Global-EULA.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Global EULA
Allows server owners to user a single global EULA file

diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index dae36c6452ccd57a436dd918547b64d59957ab0a..3013ddf8e2ddb06abd08a36d80a3894f424b4c4a 100644
index dae36c6452ccd57a436dd918547b64d59957ab0a..8b6581b9d51479f082d2e80bd9141ba386e6c966 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -131,7 +131,7 @@ public class Main {
Expand All @@ -18,8 +18,25 @@ index dae36c6452ccd57a436dd918547b64d59957ab0a..3013ddf8e2ddb06abd08a36d80a3894f
Eula eula = new Eula(path2);
// Paper start - load config files for access below if needed
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings"));
@@ -169,7 +169,15 @@ public class Main {
Main.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
return;
}
-
+ // Graphite start - Global EULA
+ if (dedicatedserversettings.getProperties().useGlobalEula) {
+ Main.LOGGER.warn("");
+ Main.LOGGER.warn("You are using Graphite's global EULA feature.");
+ Main.LOGGER.warn("By using this setting you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula).");
+ Main.LOGGER.warn("If you do not agree to the above EULA please stop your server and disable the feature immediately.");
+ Main.LOGGER.warn("");
+ }
+ // Graphite end - Global EULA
// Paper start - Warn on headless
String awtException = io.papermc.paper.util.ServerEnvironment.awtDependencyCheck();
if (awtException != null) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index 1ea3012995c738c67b31e997c138f824f9e69ba1..45be14d14fa8f35405d0074d587d98b1fa39f2ee 100644
index 1ea3012995c738c67b31e997c138f824f9e69ba1..a8dbacde957228dda9d0faa09a67a3f6ac3c05c6 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -110,6 +110,10 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
Expand All @@ -33,25 +50,13 @@ index 1ea3012995c738c67b31e997c138f824f9e69ba1..45be14d14fa8f35405d0074d587d98b1

// CraftBukkit start
public DedicatedServerProperties(Properties properties, OptionSet optionset) {
@@ -172,6 +176,22 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@@ -172,6 +176,10 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
final String rconIp = this.getStringRaw("rcon.ip");
this.rconIp = rconIp == null ? this.serverIp : rconIp;
// Paper end
+ // Graphite start - Global EULA
+ boolean useGlobalEula = get("use-global-eula", false);
+ String globalEulaPath = get("global-eula-path", "");
+ if (useGlobalEula) {
+ try {
+ globalEulaPath = get("global-eula-path", Path.of(new java.net.URI("file://" + System.getProperty("user.home") + java.io.File.separator + "GlobalEula.txt")).toString());
+ } catch (java.net.URISyntaxException ex) {
+ LOGGER.warn("Bad global eula path", ex);
+ useGlobalEula = false;
+ globalEulaPath = "";
+ }
+ }
+
+ this.useGlobalEula = useGlobalEula;
+ this.globalEulaPath = globalEulaPath;
+ this.useGlobalEula = get("use-global-eula", false);
+ this.globalEulaPath = get("global-eula-path", System.getProperty("user.home") + java.io.File.separator + "GlobalEula.txt");
+ // Graphite end - Global EULA
}

Expand Down

0 comments on commit 4c416d3

Please sign in to comment.