mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-10-04 02:17:30 +02:00
199 lines
8.4 KiB
Diff
199 lines
8.4 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: tr7zw <tr7zw@live.de>
|
||
|
Date: Mon, 3 Aug 2020 17:38:07 +0200
|
||
|
Subject: [PATCH] Redirect Configs
|
||
|
|
||
|
|
||
|
diff --git a/src/main/java/app/akarin/server/Config.java b/src/main/java/app/akarin/server/Config.java
|
||
|
index 1742facec843dd87897d62e4aab819835fab4a38..358ac3361c814b7cf5f9650a6a49c6efce7dd56a 100644
|
||
|
--- a/src/main/java/app/akarin/server/Config.java
|
||
|
+++ b/src/main/java/app/akarin/server/Config.java
|
||
|
@@ -4,6 +4,8 @@ import org.bukkit.Bukkit;
|
||
|
import org.bukkit.configuration.ConfigurationSection;
|
||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||
|
|
||
|
+import dev.tr7zw.yatopia.YatopiaConfig;
|
||
|
+
|
||
|
import java.io.File;
|
||
|
import java.lang.reflect.Method;
|
||
|
import java.lang.reflect.Modifier;
|
||
|
@@ -22,8 +24,8 @@ public final class Config {
|
||
|
private static int configVersion;
|
||
|
|
||
|
public static void init(final File file) {
|
||
|
- Config.configFile = file;
|
||
|
- final YamlConfiguration config = new YamlConfiguration();
|
||
|
+ Config.configFile = YatopiaConfig.CONFIG_FILE;
|
||
|
+ /*final YamlConfiguration config = new YamlConfiguration();
|
||
|
config.options().header(CONFIG_HEADER);
|
||
|
config.options().copyDefaults(true);
|
||
|
|
||
|
@@ -40,9 +42,9 @@ public final class Config {
|
||
|
Bukkit.getLogger().log(Level.SEVERE, "Failure to load Akarin config", ex);
|
||
|
throw new RuntimeException(ex);
|
||
|
}
|
||
|
- }
|
||
|
+ }*/
|
||
|
|
||
|
- Config.load(config);
|
||
|
+ Config.load(YatopiaConfig.config);
|
||
|
}
|
||
|
|
||
|
public static void load(final YamlConfiguration config) {
|
||
|
diff --git a/src/main/java/com/mrivanplays/origami/OrigamiConfig.java b/src/main/java/com/mrivanplays/origami/OrigamiConfig.java
|
||
|
index 111fa3cd586c31eb0ab9fd425179d1f54a40a0f4..9038b3324c50982e85c5e1992de99df6ba902a89 100644
|
||
|
--- a/src/main/java/com/mrivanplays/origami/OrigamiConfig.java
|
||
|
+++ b/src/main/java/com/mrivanplays/origami/OrigamiConfig.java
|
||
|
@@ -2,6 +2,8 @@ package com.mrivanplays.origami;
|
||
|
|
||
|
import com.destroystokyo.paper.util.SneakyThrow;
|
||
|
|
||
|
+import dev.tr7zw.yatopia.YatopiaConfig;
|
||
|
+
|
||
|
import java.io.File;
|
||
|
import java.io.IOException;
|
||
|
import java.lang.reflect.Method;
|
||
|
@@ -23,7 +25,7 @@ public final class OrigamiConfig {
|
||
|
private static int configVersion;
|
||
|
|
||
|
public static void init(final File file) {
|
||
|
- OrigamiConfig.configFile = file;
|
||
|
+ /*OrigamiConfig.configFile = file;
|
||
|
final YamlConfiguration config = new YamlConfiguration();
|
||
|
config.options().header(CONFIG_HEADER);
|
||
|
config.options().copyDefaults(true);
|
||
|
@@ -42,8 +44,9 @@ public final class OrigamiConfig {
|
||
|
SneakyThrow.sneaky(e);
|
||
|
throw new RuntimeException(e); // unreachable
|
||
|
}
|
||
|
- }
|
||
|
- load(config);
|
||
|
+ }*/
|
||
|
+ configFile = YatopiaConfig.CONFIG_FILE;
|
||
|
+ load(YatopiaConfig.config);
|
||
|
}
|
||
|
|
||
|
public static void load(final YamlConfiguration config) {
|
||
|
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
|
||
|
index 9f04500e167b8403c7487044a4ae03a6be61062a..fb3bf0731512b5517ca7ccb3240085b40e7f2abb 100644
|
||
|
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
|
||
|
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
|
||
|
@@ -33,7 +33,7 @@ import org.spigotmc.WatchdogThread;
|
||
|
|
||
|
public class YatopiaConfig {
|
||
|
|
||
|
- private static File CONFIG_FILE;
|
||
|
+ public static File CONFIG_FILE;
|
||
|
private static final String HEADER = "This is the main configuration file for Yatopia.\n"
|
||
|
+ "Yatopia contains many breaking changes and settings, so know what you are doing!\n"
|
||
|
+ "You have been warned!\n";
|
||
|
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||
|
index 9ba65a7528755f54b9a1c4b1323b6e75de867f14..334cae3210cbe9e4d7e6f037c36c489f250c1021 100644
|
||
|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||
|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||
|
@@ -169,6 +169,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||
|
return false;
|
||
|
}
|
||
|
com.destroystokyo.paper.PaperConfig.registerCommands();
|
||
|
+ // Yatopia start
|
||
|
+ try {
|
||
|
+ dev.tr7zw.yatopia.YatopiaConfig.init(new File("yatopia.yml"));
|
||
|
+ } catch (Exception e) {
|
||
|
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||
|
+ return false;
|
||
|
+ }
|
||
|
+ dev.tr7zw.yatopia.YatopiaConfig.registerCommands();
|
||
|
+ // Yatopia end
|
||
|
// Purpur start
|
||
|
try {
|
||
|
net.pl3x.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
|
||
|
@@ -185,15 +194,6 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||
|
us.minevict.papercut.PapercutConfig.init((java.io.File) options.valueOf("papercut-settings")); // Papercut
|
||
|
com.mrivanplays.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings")); // Origami - server config
|
||
|
|
||
|
- // Yatopia start
|
||
|
- try {
|
||
|
- dev.tr7zw.yatopia.YatopiaConfig.init(new File("yatopia.yml"));
|
||
|
- } catch (Exception e) {
|
||
|
- DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||
|
- return false;
|
||
|
- }
|
||
|
- dev.tr7zw.yatopia.YatopiaConfig.registerCommands();
|
||
|
- // Yatopia end
|
||
|
this.setPVP(dedicatedserverproperties.pvp);
|
||
|
this.setAllowFlight(dedicatedserverproperties.allowFlight);
|
||
|
this.setResourcePack(dedicatedserverproperties.resourcePack, this.aY());
|
||
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||
|
index b3d6e713c2bfa1a0432b4afc3e8c31d4d7ca5844..0b3f40ed4b226bc71597182b546ff7becd1ef7c7 100644
|
||
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||
|
@@ -1,6 +1,8 @@
|
||
|
package net.pl3x.purpur;
|
||
|
|
||
|
import com.google.common.base.Throwables;
|
||
|
+
|
||
|
+import dev.tr7zw.yatopia.YatopiaConfig;
|
||
|
import net.minecraft.server.MinecraftServer;
|
||
|
import net.pl3x.purpur.command.PurpurCommand;
|
||
|
import org.bukkit.Bukkit;
|
||
|
@@ -37,8 +39,8 @@ public class PurpurConfig {
|
||
|
static boolean verbose;
|
||
|
|
||
|
public static void init(File configFile) {
|
||
|
- CONFIG_FILE = configFile;
|
||
|
- config = new YamlConfiguration();
|
||
|
+ CONFIG_FILE = YatopiaConfig.CONFIG_FILE;
|
||
|
+ /*config = new YamlConfiguration();
|
||
|
try {
|
||
|
config.load(CONFIG_FILE);
|
||
|
} catch (IOException ignore) {
|
||
|
@@ -47,7 +49,8 @@ public class PurpurConfig {
|
||
|
throw Throwables.propagate(ex);
|
||
|
}
|
||
|
config.options().header(HEADER);
|
||
|
- config.options().copyDefaults(true);
|
||
|
+ config.options().copyDefaults(true);*/
|
||
|
+ config = YatopiaConfig.config;
|
||
|
verbose = getBoolean("verbose", false);
|
||
|
|
||
|
commands = new HashMap<>();
|
||
|
diff --git a/src/main/java/us/minevict/papercut/PapercutConfig.java b/src/main/java/us/minevict/papercut/PapercutConfig.java
|
||
|
index 1256b689481f9d31dc2fbbf6072293c293ed6c2e..f242810198a48e82838e67dd356da596e3288f8e 100644
|
||
|
--- a/src/main/java/us/minevict/papercut/PapercutConfig.java
|
||
|
+++ b/src/main/java/us/minevict/papercut/PapercutConfig.java
|
||
|
@@ -1,6 +1,9 @@
|
||
|
package us.minevict.papercut;
|
||
|
|
||
|
import com.destroystokyo.paper.util.SneakyThrow;
|
||
|
+
|
||
|
+import dev.tr7zw.yatopia.YatopiaConfig;
|
||
|
+
|
||
|
import java.io.File;
|
||
|
import java.lang.reflect.Method;
|
||
|
import java.lang.reflect.Modifier;
|
||
|
@@ -20,7 +23,7 @@ public final class PapercutConfig {
|
||
|
private static int configVersion;
|
||
|
|
||
|
public static void init(final File file) {
|
||
|
- final File papercutConfig = new File(file.getParent(), "papercut.yml");
|
||
|
+ /*final File papercutConfig = new File(file.getParent(), "papercut.yml");
|
||
|
if (!papercutConfig.exists()) {
|
||
|
final File oldConfig = new File(file.getParent(), "papercut.yml");
|
||
|
oldConfig.renameTo(papercutConfig);
|
||
|
@@ -42,11 +45,12 @@ public final class PapercutConfig {
|
||
|
} catch (final Exception ex) {
|
||
|
Bukkit.getLogger().log(Level.SEVERE, "Failure to load papercut config", ex);
|
||
|
SneakyThrow.sneaky(ex); /* Rethrow, this is critical */
|
||
|
- throw new RuntimeException(ex); // unreachable
|
||
|
+ /* throw new RuntimeException(ex); // unreachable
|
||
|
}
|
||
|
- }
|
||
|
+ }*/
|
||
|
|
||
|
- PapercutConfig.load(config);
|
||
|
+ configFile = YatopiaConfig.CONFIG_FILE;
|
||
|
+ PapercutConfig.load(YatopiaConfig.config);
|
||
|
}
|
||
|
|
||
|
public static void load(final YamlConfiguration config) {
|