Yatopia/patches/server/0023-Redirect-Configs.patch
Ivan Pekov 43f2b8b2ea
Refactor internals to net.yatopia.server
api refactor to that domain is coming in next major release
2020-09-01 09:38:17 +03:00

101 lines
5.0 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..4bc94e4598cff801d08e457ebbf184fbaadb3b19 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 = net.yatopia.server.YatopiaConfig.config;
+ CONFIG_FILE = net.yatopia.server.YatopiaConfig.CONFIG_FILE;
+ verbose = net.yatopia.server.YatopiaConfig.verbose;
+ version = net.yatopia.server.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..7fc45446218ee6a31abca2e16d192efff5e4aaf9 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 3601f6f104d204c10b4dacc013525651b128c2a8..6892b9de4552d78b01c57c0f67896a3cc62cb819 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;
}
net.yatopia.server.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) {