-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an option to apply the configuration to the vanilla default
- Loading branch information
Showing
27 changed files
with
202 additions
and
6 deletions.
There are no files selected for viewing
196 changes: 196 additions & 0 deletions
196
patches/server/0014-Add-an-option-to-apply-the-configuration-to-the-vani.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: AlphaKR93 <[email protected]> | ||
Date: Wed, 15 May 2024 16:13:17 +0900 | ||
Subject: [PATCH] Add an option to apply the configuration to the vanilla | ||
default | ||
|
||
|
||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java | ||
index 8445a0b25d647b2c1f9a44f849084cdec0842e18..86822868e47b269891a71fdc04371b1e28a2752e 100644 | ||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java | ||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java | ||
@@ -89,7 +89,7 @@ public class GlobalConfiguration extends ConfigurationPart { | ||
public Component flyingVehicle = Component.translatable("multiplayer.disconnect.flying"); | ||
} | ||
|
||
- public Component noPermission = Component.text("I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.", NamedTextColor.RED); | ||
+ public Component noPermission = org.plazmamc.plazma.Options.VANILLAIZE ? Component.translatable("command.unknown.command") : Component.text("I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.", NamedTextColor.RED); | ||
public boolean useDisplayNameInQuitMessage = false; | ||
} | ||
|
||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
index 6de746c3e0f30bcf3dc24b2a4d369c86db445738..a9141a1f71c2dc31c6530b00ba0a69c0d1016797 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
@@ -433,7 +433,19 @@ public final class CraftServer implements Server { | ||
|
||
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile()); | ||
this.configuration.options().copyDefaults(true); | ||
- this.configuration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? "configurations/bukkit_optimized.yml" : "configurations/bukkit.yml"), Charsets.UTF_8))); // Plazma - Optimize default configurations | ||
+ // Plazma start - Add an option to apply the configuration to the vanilla default | ||
+ String configPath; | ||
+ if (org.plazmamc.plazma.Options.NO_OPTIMIZE) { | ||
+ if (org.plazmamc.plazma.Options.VANILLAIZE) configPath = "configurations/bukkit_vanillaized.yml"; | ||
+ else configPath = "configurations/bukkit.yml"; | ||
+ } else { | ||
+ if (org.plazmamc.plazma.Options.VANILLAIZE) configPath = "configurations/bukkit_optimized_vanillaized.yml"; | ||
+ else configPath = "configurations/bukkit_optimized.yml"; | ||
+ } | ||
+ this.configuration.setDefaults(YamlConfiguration.loadConfiguration( | ||
+ new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(configPath), Charsets.UTF_8) | ||
+ )); // Plazma - Optimize default configurations | ||
+ // Plazma end - Add an option to apply the configuration to the vanilla default | ||
ConfigurationSection legacyAlias = null; | ||
if (!this.configuration.isString("aliases")) { | ||
legacyAlias = this.configuration.getConfigurationSection("aliases"); | ||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java | ||
index d6ead6b1bc73df85a8e8938acd2e8465dd82df97..1fe9af0ffc91626c712847df94ea31e19bb3c8a0 100644 | ||
--- a/src/main/java/org/plazmamc/plazma/Options.java | ||
+++ b/src/main/java/org/plazmamc/plazma/Options.java | ||
@@ -7,5 +7,7 @@ public interface Options { | ||
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization"); | ||
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing"); | ||
boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE; | ||
+ boolean VANILLAIZE = Boolean.getBoolean("Plazma.vanillaize") && !AGGRESSIVE; | ||
+ boolean USE_VANILLA = Boolean.getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE; | ||
|
||
} | ||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java | ||
index 6c2a3813e7d63d57f07a8fa2edbb9d231221d818..15f05cd16a9867da95dd1fcdaeeb134553f651d1 100644 | ||
--- a/src/main/java/org/spigotmc/SpigotConfig.java | ||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java | ||
@@ -197,8 +197,8 @@ public class SpigotConfig | ||
public static String whitelistMessage; | ||
public static String unknownCommandMessage; | ||
public static String serverFullMessage; | ||
- public static String outdatedClientMessage = "Outdated client! Please use {0}"; | ||
- public static String outdatedServerMessage = "Outdated server! I\'m still on {0}"; | ||
+ public static String outdatedClientMessage = org.plazmamc.plazma.Options.VANILLAIZE ? "<lang:multiplayer.disconnect.outdated_client>" : "Outdated client! Please use {0}"; | ||
+ public static String outdatedServerMessage = org.plazmamc.plazma.Options.VANILLAIZE ? "<lang:multiplayer.disconnect.outdated_server>" : "Outdated server! I'm still on {0}"; | ||
private static String transform(String s) | ||
{ | ||
return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\\\n", "\n" ); | ||
@@ -211,9 +211,9 @@ public class SpigotConfig | ||
SpigotConfig.set( "messages.outdated-server", SpigotConfig.outdatedServerMessage ); | ||
} | ||
|
||
- SpigotConfig.whitelistMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.whitelist", "You are not whitelisted on this server!" ) ); | ||
- SpigotConfig.unknownCommandMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.unknown-command", "Unknown command. Type \"/help\" for help." ) ); | ||
- SpigotConfig.serverFullMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.server-full", "The server is full!" ) ); | ||
+ SpigotConfig.whitelistMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.whitelist", org.plazmamc.plazma.Options.VANILLAIZE ? "<lang:multiplayer.disconnect.not_whitelisted>" : "You are not whitelisted on this server!" ) ); // Plazma - Add an option to apply the configuration to the vanilla default | ||
+ SpigotConfig.unknownCommandMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.unknown-command", org.plazmamc.plazma.Options.VANILLAIZE ? "<lang:command.unknown.command>" : "Unknown command. Type \"/help\" for help." ) ); | ||
+ SpigotConfig.serverFullMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.server-full", org.plazmamc.plazma.Options.VANILLAIZE ? "<lang:multiplayer.disconnect.server_full>" : "The server is full!" ) ); | ||
SpigotConfig.outdatedClientMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.outdated-client", SpigotConfig.outdatedClientMessage ) ); | ||
SpigotConfig.outdatedServerMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.outdated-server", SpigotConfig.outdatedServerMessage ) ); | ||
} | ||
@@ -227,7 +227,7 @@ public class SpigotConfig | ||
SpigotConfig.timeoutTime = SpigotConfig.getInt( "settings.timeout-time", SpigotConfig.timeoutTime ); | ||
SpigotConfig.restartOnCrash = SpigotConfig.getBoolean( "settings.restart-on-crash", SpigotConfig.restartOnCrash ); | ||
SpigotConfig.restartScript = SpigotConfig.getString( "settings.restart-script", SpigotConfig.restartScript ); | ||
- SpigotConfig.restartMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.restart", "Server is restarting" ) ); | ||
+ SpigotConfig.restartMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.restart", org.plazmamc.plazma.Options.VANILLAIZE ? "<lang:disconnect.quitting>" : "Server is restarting" ) ); | ||
SpigotConfig.commands.put( "restart", new RestartCommand( "restart" ) ); | ||
// WatchdogThread.doStart( SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash ); // Paper - moved to after paper config initialization | ||
} | ||
diff --git a/src/main/resources/configurations/bukkit_optimized_vanillaized.yml b/src/main/resources/configurations/bukkit_optimized_vanillaized.yml | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..b7ed456b0172caebdf5b548052ff2ae688377020 | ||
--- /dev/null | ||
+++ b/src/main/resources/configurations/bukkit_optimized_vanillaized.yml | ||
@@ -0,0 +1,45 @@ | ||
+# This is the main configuration file for Bukkit. | ||
+# As you can see, there's actually not that much to configure without any plugins. | ||
+# For a reference for any variable inside this file, check out the Bukkit Wiki at | ||
+# https://www.spigotmc.org/go/bukkit-yml | ||
+# | ||
+# If you need help on this file, feel free to join us on Discord or leave a message | ||
+# on the forums asking for advice. | ||
+# | ||
+# Discord: https://www.spigotmc.org/go/discord | ||
+# Forums: https://www.spigotmc.org/ | ||
+# Bug tracker: https://www.spigotmc.org/go/bugs | ||
+ | ||
+ | ||
+settings: | ||
+ allow-end: true | ||
+ warn-on-overload: true | ||
+ permissions-file: permissions.yml | ||
+ update-folder: update | ||
+ plugin-profiling: false | ||
+ connection-throttle: 4000 | ||
+ query-plugins: true | ||
+ deprecated-verbose: default | ||
+ shutdown-message: <lang:multiplayer.disconnect.server_shutdown> | ||
+ minimum-api: none | ||
+ use-map-color-cache: true | ||
+spawn-limits: | ||
+ monsters: 20 | ||
+ animals: 5 | ||
+ water-animals: 2 | ||
+ water-ambient: 2 | ||
+ water-underground-creature: 3 | ||
+ axolotls: 3 | ||
+ ambient: 1 | ||
+chunk-gc: | ||
+ period-in-ticks: 400 | ||
+ticks-per: | ||
+ animal-spawns: 400 | ||
+ monster-spawns: 10 | ||
+ water-spawns: 400 | ||
+ water-ambient-spawns: 400 | ||
+ water-underground-creature-spawns: 400 | ||
+ axolotl-spawns: 400 | ||
+ ambient-spawns: 400 | ||
+ autosave: 6000 | ||
+aliases: now-in-commands.yml | ||
diff --git a/src/main/resources/configurations/bukkit_vanillaized.yml b/src/main/resources/configurations/bukkit_vanillaized.yml | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..22fe392b9970bb82db293d638b0dd5727bd60e5a | ||
--- /dev/null | ||
+++ b/src/main/resources/configurations/bukkit_vanillaized.yml | ||
@@ -0,0 +1,45 @@ | ||
+# This is the main configuration file for Bukkit. | ||
+# As you can see, there's actually not that much to configure without any plugins. | ||
+# For a reference for any variable inside this file, check out the Bukkit Wiki at | ||
+# https://www.spigotmc.org/go/bukkit-yml | ||
+# | ||
+# If you need help on this file, feel free to join us on Discord or leave a message | ||
+# on the forums asking for advice. | ||
+# | ||
+# Discord: https://www.spigotmc.org/go/discord | ||
+# Forums: https://www.spigotmc.org/ | ||
+# Bug tracker: https://www.spigotmc.org/go/bugs | ||
+ | ||
+ | ||
+settings: | ||
+ allow-end: true | ||
+ warn-on-overload: true | ||
+ permissions-file: permissions.yml | ||
+ update-folder: update | ||
+ plugin-profiling: false | ||
+ connection-throttle: 4000 | ||
+ query-plugins: true | ||
+ deprecated-verbose: default | ||
+ shutdown-message: <lang:multiplayer.disconnect.server_shutdown> | ||
+ minimum-api: none | ||
+ use-map-color-cache: true | ||
+spawn-limits: | ||
+ monsters: 70 | ||
+ animals: 10 | ||
+ water-animals: 5 | ||
+ water-ambient: 20 | ||
+ water-underground-creature: 5 | ||
+ axolotls: 5 | ||
+ ambient: 15 | ||
+chunk-gc: | ||
+ period-in-ticks: 600 | ||
+ticks-per: | ||
+ animal-spawns: 400 | ||
+ monster-spawns: 1 | ||
+ water-spawns: 1 | ||
+ water-ambient-spawns: 1 | ||
+ water-underground-creature-spawns: 1 | ||
+ axolotl-spawns: 1 | ||
+ ambient-spawns: 1 | ||
+ autosave: 6000 | ||
+aliases: now-in-commands.yml |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.