Yatopia/patches/server/0023-Redirect-Configs.patch
2020-09-15 08:43:13 +03:00

73 lines
3.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 5 Aug 2020 08:17:46 -0500
Subject: [PATCH] Redirect Configs
diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java
index bbf09800b7b72bdfb75c91e4c6c77fe00e3ad436..1d98bfdee95fb1052fcd9f141a2ab82ba9dcf2f9 100644
--- a/src/main/java/de/minebench/origami/OrigamiConfig.java
+++ b/src/main/java/de/minebench/origami/OrigamiConfig.java
@@ -1,5 +1,6 @@
package de.minebench.origami;
+import net.yatopia.server.YatopiaConfig;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -20,6 +21,8 @@ public final class OrigamiConfig {
private static int configVersion;
public static void init(final File file) {
+ // Yatopia start
+ /*
OrigamiConfig.configFile = file;
OrigamiConfig.config = new YamlConfiguration();
config.options().header(CONFIG_HEADER);
@@ -39,13 +42,16 @@ public final class OrigamiConfig {
System.out.println("Failure to load origami config");
throw new RuntimeException(ex);
}
- }
-
- OrigamiConfig.load(OrigamiConfig.class, null);
+ }*/
+ config = net.yatopia.server.YatopiaConfig.config;
+ configFile = net.yatopia.server.YatopiaConfig.CONFIG_FILE;
+ configVersion = net.yatopia.server.YatopiaConfig.version;
+ //OrigamiConfig.load(OrigamiConfig.class, null); // todo: uncomment when config options are ported
+ // Yatopia end
}
public static void load(Class<?> clazz, Object instance) {
- OrigamiConfig.configVersion = OrigamiConfig.getInt("config-version-please-do-not-modify-me", CURRENT_CONFIG_VERSION);
+ //OrigamiConfig.configVersion = OrigamiConfig.getInt("config-version-please-do-not-modify-me", CURRENT_CONFIG_VERSION); // Yatopia - NO
for (final Method method : clazz.getDeclaredMethods()) {
if (method.getReturnType() != void.class || method.getParameterCount() != 0 ||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 72d7a017f2aa7f2fde3b5de437e7fd2e051edd24..6c280d64bb069fba0d52a7d8b4eb6a0816354cc1 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -184,6 +184,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
DedicatedServer.LOGGER.error("Unable to load server configuration", e);
return false;
}
+ de.minebench.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings"));
// Yatopia end
this.setPVP(dedicatedserverproperties.pvp);
this.setAllowFlight(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index dddba89eee0181c066ad979bc2b75e8de36e7458..2b7bfeb79200458912aef6b20ee53c4c276b3451 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -303,7 +303,7 @@ public class Main {
}
// Paper end
System.setProperty( "library.jansi.version", "Paper" ); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows
- de.minebench.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings")); // Origami - Server Config
+ //de.minebench.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings")); // Origami - Server Config // Yatopia - no load here for u
System.out.println("Loading libraries, please wait...");
net.minecraft.server.Main.main(options);
} catch (Throwable t) {