Yatopia/patches/server/0024-Redirect-Configs.patch
2020-08-21 09:03:22 +03:00

94 lines
4.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/com/proximyst/rainforest/RainforestConfig.java b/src/main/java/com/proximyst/rainforest/RainforestConfig.java
index f6623032e5d4034c104aa1fc6ff4265169e462ba..c9a61bf6531d761780ac66b69d06a1d036f988d5 100644
--- a/src/main/java/com/proximyst/rainforest/RainforestConfig.java
+++ b/src/main/java/com/proximyst/rainforest/RainforestConfig.java
@@ -37,6 +37,8 @@ public final class RainforestConfig {
private static boolean fatalError;
public static void init(File configFile) {
+ // Yatopia start
+ /*
CONFIG_FILE = configFile;
config = new YamlConfiguration();
try {
@@ -56,7 +58,13 @@ public final class RainforestConfig {
version = getInt("config-version", 1);
set("config-version", 1);
+ */
+ config = dev.tr7zw.yatopia.YatopiaConfig.config;
+ CONFIG_FILE = dev.tr7zw.yatopia.YatopiaConfig.CONFIG_FILE;
+ verbose = dev.tr7zw.yatopia.YatopiaConfig.verbose;
+ version = dev.tr7zw.yatopia.YatopiaConfig.version;
readConfig(RainforestConfig.class, null);
+ // Yatopia end
}
protected static void logError(String s) {
diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java
index 82fc63dbfc0d48267e0c1972a312b7143f62e6f0..284865f960672645932521ed811a7c5c31c64294 100644
--- a/src/main/java/de/minebench/origami/OrigamiConfig.java
+++ b/src/main/java/de/minebench/origami/OrigamiConfig.java
@@ -20,6 +20,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 +41,16 @@ public final class OrigamiConfig {
System.out.println("Failure to load origami config");
throw new RuntimeException(ex);
}
- }
-
- OrigamiConfig.load(OrigamiConfig.class, null);
+ }*/
+ config = dev.tr7zw.yatopia.YatopiaConfig.config;
+ configFile = dev.tr7zw.yatopia.YatopiaConfig.CONFIG_FILE;
+ configVersion = dev.tr7zw.yatopia.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 cb4a89940cf02de5c3eefc5c746397a931c96b7a..7e053bc9bbd8abc1a6c060c1b4166ff27c7043d2 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -189,6 +189,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return false;
}
dev.tr7zw.yatopia.YatopiaConfig.registerCommands();
+ de.minebench.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings"));
+ com.proximyst.rainforest.RainforestConfig.init((java.io.File) options.valueOf("rainforest-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 5387a50e4a24e2eb49693368c5342a69b8d14b69..6dd3a0e1dde1a114374f52e903d10e973b4ca44f 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -310,7 +310,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) {