mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 02:47:43 +01:00
Fix /purpur reload not reloading world options
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 95ff0e54f1d111aecc87857dddd5ae493e811d01 Mon Sep 17 00:00:00 2001
|
||||
From 8fee7d3acc09c544c5849a04bf99dcc4bec3a089 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 9 May 2019 18:09:43 -0500
|
||||
Subject: [PATCH] Purpur config files
|
||||
@@ -10,10 +10,10 @@ Subject: [PATCH] Purpur config files
|
||||
src/main/java/net/pl3x/purpur/Metrics.java | 598 ++++++++++++++++++
|
||||
.../java/net/pl3x/purpur/PurpurCommand.java | 66 ++
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 133 ++++
|
||||
.../net/pl3x/purpur/PurpurWorldConfig.java | 63 ++
|
||||
.../net/pl3x/purpur/PurpurWorldConfig.java | 60 ++
|
||||
.../org/bukkit/craftbukkit/CraftServer.java | 3 +
|
||||
.../java/org/bukkit/craftbukkit/Main.java | 8 +
|
||||
9 files changed, 885 insertions(+)
|
||||
9 files changed, 882 insertions(+)
|
||||
create mode 100644 src/main/java/net/pl3x/purpur/Metrics.java
|
||||
create mode 100644 src/main/java/net/pl3x/purpur/PurpurCommand.java
|
||||
create mode 100644 src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -57,7 +57,7 @@ index 3ed74ae0ec..8139108470 100644
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 2c92d3390a..97c4a6773a 100644
|
||||
index 5460ace8f8..c5cd19afa0 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -96,6 +96,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
@@ -894,14 +894,13 @@ index 0000000000..6f378b5f69
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000..30f11fe261
|
||||
index 0000000000..4985f21733
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -0,0 +1,63 @@
|
||||
@@ -0,0 +1,60 @@
|
||||
+package net.pl3x.purpur;
|
||||
+
|
||||
+import com.destroystokyo.paper.PaperWorldConfig;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+import org.spigotmc.SpigotWorldConfig;
|
||||
+
|
||||
+import java.util.List;
|
||||
@@ -913,14 +912,12 @@ index 0000000000..30f11fe261
|
||||
+ private final String worldName;
|
||||
+ private final PaperWorldConfig paperConfig;
|
||||
+ private final SpigotWorldConfig spigotConfig;
|
||||
+ private final YamlConfiguration config;
|
||||
+ private boolean verbose;
|
||||
+
|
||||
+ public PurpurWorldConfig(String worldName, PaperWorldConfig paperConfig, SpigotWorldConfig spigotConfig) {
|
||||
+ this.worldName = worldName;
|
||||
+ this.paperConfig = paperConfig;
|
||||
+ this.spigotConfig = spigotConfig;
|
||||
+ this.config = PurpurConfig.config;
|
||||
+ init();
|
||||
+ }
|
||||
+
|
||||
@@ -930,39 +927,39 @@ index 0000000000..30f11fe261
|
||||
+ }
|
||||
+
|
||||
+ private void set(String path, Object val) {
|
||||
+ config.set("world-settings.default." + path, val);
|
||||
+ if (config.get("world-settings." + worldName + "." + path) != null) {
|
||||
+ config.set("world-settings." + worldName + "." + path, val);
|
||||
+ PurpurConfig.config.set("world-settings.default." + path, val);
|
||||
+ if (PurpurConfig.config.get("world-settings." + worldName + "." + path) != null) {
|
||||
+ PurpurConfig.config.set("world-settings." + worldName + "." + path, val);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private boolean getBoolean(String path, boolean def) {
|
||||
+ config.addDefault("world-settings.default." + path, def);
|
||||
+ return config.getBoolean("world-settings." + worldName + "." + path, config.getBoolean("world-settings.default." + path));
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getBoolean("world-settings." + worldName + "." + path, PurpurConfig.config.getBoolean("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private double getDouble(String path, double def) {
|
||||
+ config.addDefault("world-settings.default." + path, def);
|
||||
+ return config.getDouble("world-settings." + worldName + "." + path, config.getDouble("world-settings.default." + path));
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getDouble("world-settings." + worldName + "." + path, PurpurConfig.config.getDouble("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private int getInt(String path, int def) {
|
||||
+ config.addDefault("world-settings.default." + path, def);
|
||||
+ return config.getInt("world-settings." + worldName + "." + path, config.getInt("world-settings.default." + path));
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getInt("world-settings." + worldName + "." + path, PurpurConfig.config.getInt("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private <T> List getList(String path, T def) {
|
||||
+ config.addDefault("world-settings.default." + path, def);
|
||||
+ return config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path));
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getList("world-settings." + worldName + "." + path, PurpurConfig.config.getList("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private String getString(String path, String def) {
|
||||
+ config.addDefault("world-settings.default." + path, def);
|
||||
+ return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getString("world-settings." + worldName + "." + path, PurpurConfig.config.getString("world-settings.default." + path));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 8f4ca4c285..6d453b6711 100644
|
||||
index 55b8492373..4c15bd403d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -794,6 +794,7 @@ public final class CraftServer implements Server {
|
||||
@@ -990,7 +987,7 @@ index 8f4ca4c285..6d453b6711 100644
|
||||
ignoreVanillaPermissions = commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 140b82275c..3a4881fb18 100644
|
||||
index 75d3cbc441..c9937fb0d6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -137,6 +137,14 @@ public class Main {
|
||||
@@ -1009,5 +1006,5 @@ index 140b82275c..3a4881fb18 100644
|
||||
acceptsAll(asList("server-name"), "Name of the server")
|
||||
.withRequiredArg()
|
||||
--
|
||||
2.24.0.rc1
|
||||
2.24.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user