Yatopia/patches/server/0027-Redirect-Configs.patch

199 lines
8.4 KiB
Diff
Raw Normal View History

[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
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) {