From 919070df83f010f5cb27b9f98643e34e285a8f5e Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 20 Jun 2013 17:36:06 +1000 Subject: [PATCH] Simplify --- .../0004-Spigot-Configuration.patch | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/CraftBukkit-Patches/0004-Spigot-Configuration.patch b/CraftBukkit-Patches/0004-Spigot-Configuration.patch index a037a6e..7e579b4 100644 --- a/CraftBukkit-Patches/0004-Spigot-Configuration.patch +++ b/CraftBukkit-Patches/0004-Spigot-Configuration.patch @@ -1,6 +1,6 @@ -From fba3fb120161a1618a8991784bd0822087af733d Mon Sep 17 00:00:00 2001 +From f6b9d470ca4aa3abddd5eaa0c3d50ca1db0802b5 Mon Sep 17 00:00:00 2001 From: md_5 -Date: Thu, 20 Jun 2013 17:28:01 +1000 +Date: Thu, 20 Jun 2013 17:35:57 +1000 Subject: [PATCH] Spigot Configuration @@ -38,7 +38,7 @@ index 3a4ddea..de052bd 100644 this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java new file mode 100644 -index 0000000..7bb7712 +index 0000000..80a76c1 --- /dev/null +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -0,0 +1,91 @@ @@ -80,7 +80,7 @@ index 0000000..7bb7712 + config.options().header( HEADER ); + config.options().copyDefaults( true ); + -+ version = getInt( config, "config-version", 1 ); ++ version = getInt( "config-version", 1 ); + readConfig( SpigotConfig.class ); + } + @@ -90,11 +90,11 @@ index 0000000..7bb7712 + { + if ( Modifier.isPrivate( method.getModifiers() ) && Modifier.isStatic( method.getModifiers() ) ) + { -+ if ( method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == YamlConfiguration.class ) ++ if ( method.getParameterTypes().length == 0 ) + { + try + { -+ method.invoke( null, config ); ++ method.invoke( null ); + } catch ( InvocationTargetException ex ) + { + Throwables.propagate( ex.getCause() ); @@ -115,19 +115,19 @@ index 0000000..7bb7712 + } + } + -+ private static boolean getBoolean(YamlConfiguration config, String path, boolean def) ++ private static boolean getBoolean(String path, boolean def) + { + config.addDefault( path, def ); + return config.getBoolean( path, config.getBoolean( path ) ); + } + -+ private static int getInt(YamlConfiguration config, String path, int def) ++ private static int getInt(String path, int def) + { + config.addDefault( path, def ); + return config.getInt( path, config.getInt( path ) ); + } + -+ private static String getString(YamlConfiguration config, String path, String def) ++ private static String getString(String path, String def) + { + config.addDefault( path, def ); + return config.getString( path, config.getString( path ) ); @@ -135,10 +135,10 @@ index 0000000..7bb7712 +} diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java new file mode 100644 -index 0000000..9818836 +index 0000000..b954278 --- /dev/null +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -0,0 +1,48 @@ +@@ -0,0 +1,50 @@ +package org.spigotmc; + +import org.bukkit.Bukkit; @@ -148,12 +148,14 @@ index 0000000..9818836 +{ + + private final String worldName; ++ private final YamlConfiguration config; + private final boolean verbose; + + public SpigotWorldConfig(String worldName) + { + this.worldName = worldName; -+ this.verbose = getBoolean( SpigotConfig.config, "verbose", true ); ++ this.config = SpigotConfig.config; ++ this.verbose = getBoolean( "verbose", true ); + + log( "-------------- Spigot ----------------" ); + log( "-------- World Settings For [" + worldName + "] --------" ); @@ -169,19 +171,19 @@ index 0000000..9818836 + } + } + -+ private boolean getBoolean(YamlConfiguration config, String path, boolean def) ++ 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 ) ); + } + -+ private int getInt(YamlConfiguration config, String path, int def) ++ 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 ) ); + } + -+ private String getString(YamlConfiguration config, String path, String def) ++ 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 ) );