From 7cdf470eab80798238468295907439ab3841718e Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 21 Jan 2013 21:46:53 -0500 Subject: [PATCH] Move Spigot config initialization code into its own class, and use it for /reload. --- ...This-commit-has-undergone-basic-test.patch | 84 +++++++++++++------ ...te-timeout-time-to-new-default-value.patch | 26 +++--- .../0021-Add-oreobfuscator-for-Spigot.patch | 37 ++++---- ...llow-nether-allow-end-as-false-BUKKI.patch | 8 +- 4 files changed, 97 insertions(+), 58 deletions(-) diff --git a/CraftBukkit-Patches/0001-Spigot-Changes.-This-commit-has-undergone-basic-test.patch b/CraftBukkit-Patches/0001-Spigot-Changes.-This-commit-has-undergone-basic-test.patch index a220b36..0b645a4 100644 --- a/CraftBukkit-Patches/0001-Spigot-Changes.-This-commit-has-undergone-basic-test.patch +++ b/CraftBukkit-Patches/0001-Spigot-Changes.-This-commit-has-undergone-basic-test.patch @@ -1,4 +1,4 @@ -From 0cac70d6eea0e2fb6a1b222d569cd3b464d9de23 Mon Sep 17 00:00:00 2001 +From b0f3a478531964dc847038cb0292af5dc78f3534 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 30 Dec 2012 23:56:05 -0600 Subject: [PATCH] Spigot Changes. This commit has undergone basic testing and @@ -30,8 +30,9 @@ Subject: [PATCH] Spigot Changes. This commit has undergone basic testing and .../net/minecraft/server/ThreadLoginVerifier.java | 23 + src/main/java/net/minecraft/server/World.java | 202 ++++++++- .../java/net/minecraft/server/WorldServer.java | 133 ++++-- - .../java/org/bukkit/craftbukkit/CraftServer.java | 108 ++++- + .../java/org/bukkit/craftbukkit/CraftServer.java | 98 ++++- .../java/org/bukkit/craftbukkit/CraftWorld.java | 76 +++- + src/main/java/org/bukkit/craftbukkit/Spigot.java | 22 + .../craftbukkit/chunkio/ChunkIOProvider.java | 2 +- .../bukkit/craftbukkit/command/RestartCommand.java | 24 + .../craftbukkit/command/TicksPerSecondCommand.java | 35 ++ @@ -47,7 +48,8 @@ Subject: [PATCH] Spigot Changes. This commit has undergone basic testing and .../org/bukkit/craftbukkit/util/TimedThread.java | 37 ++ .../bukkit/craftbukkit/util/WatchdogThread.java | 88 ++++ src/main/resources/configurations/bukkit.yml | 55 +++ - 41 files changed, 1658 insertions(+), 156 deletions(-) + 42 files changed, 1670 insertions(+), 156 deletions(-) + create mode 100644 src/main/java/org/bukkit/craftbukkit/Spigot.java create mode 100644 src/main/java/org/bukkit/craftbukkit/command/RestartCommand.java create mode 100644 src/main/java/org/bukkit/craftbukkit/command/TicksPerSecondCommand.java create mode 100644 src/main/java/org/bukkit/craftbukkit/util/ExceptionHandler.java @@ -1306,7 +1308,7 @@ index 3f73ef9..6764bef 100644 + // Spigot end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 936cbc6..67593d5 100644 +index 936cbc6..b8e9085 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -146,7 +146,7 @@ public final class CraftServer implements Server { @@ -1333,7 +1335,7 @@ index 936cbc6..67593d5 100644 static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); -@@ -208,12 +216,37 @@ public final class CraftServer implements Server { +@@ -208,12 +216,25 @@ public final class CraftServer implements Server { chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold"); updater = new AutoUpdater(new BukkitDLUpdaterService(configuration.getString("auto-updater.host")), getLogger(), configuration.getString("auto-updater.preferred-channel")); @@ -1345,19 +1347,7 @@ index 936cbc6..67593d5 100644 updater.check(serverVersion); + // Spigot start -+ commandMap.register("bukkit", new org.bukkit.craftbukkit.command.RestartCommand("restart")); -+ commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); -+ -+ org.bukkit.craftbukkit.util.WatchdogThread.startThread(configuration.getInt("settings.timeout-time", 180), configuration.getBoolean("settings.restart-on-crash", false)); -+ -+ whitelistMessage = configuration.getString("settings.whitelist-message", whitelistMessage); -+ stopMessage = configuration.getString("settings.stop-message", stopMessage); -+ logCommands = configuration.getBoolean("settings.log-commands", true); -+ ipFilter = configuration.getBoolean("settings.filter-unsafe-ips", false); -+ commandComplete = configuration.getBoolean("settings.command-complete", true); -+ spamGuardExclusions = configuration.getStringList("settings.spam-exclusions"); -+ -+ org.bukkit.craftbukkit.util.LightningSimulator.configure(configuration); ++ Spigot.initialize(this, commandMap, configuration); + + try { + configuration.save(getConfigFile()); @@ -1372,7 +1362,7 @@ index 936cbc6..67593d5 100644 loadPlugins(); enablePlugins(PluginLoadOrder.STARTUP); } -@@ -222,7 +255,7 @@ public final class CraftServer implements Server { +@@ -222,7 +243,7 @@ public final class CraftServer implements Server { return (File) console.options.valueOf("bukkit-settings"); } @@ -1381,7 +1371,23 @@ index 936cbc6..67593d5 100644 try { configuration.save(getConfigFile()); } catch (IOException ex) { -@@ -1036,11 +1069,8 @@ public final class CraftServer implements Server { +@@ -526,6 +547,7 @@ public final class CraftServer implements Server { + + ((DedicatedServer) console).propertyManager = config; + ++ ((SimplePluginManager) pluginManager).useTimings(configuration.getBoolean("settings.plugin-profiling")); // Spigot + boolean animals = config.getBoolean("spawn-animals", console.getSpawnAnimals()); + boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).difficulty > 0); + int difficulty = config.getInt("difficulty", console.worlds.get(0).difficulty); +@@ -588,6 +610,7 @@ public final class CraftServer implements Server { + "This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin" + )); + } ++ Spigot.initialize(this, commandMap, configuration); // Spigot + loadPlugins(); + enablePlugins(PluginLoadOrder.STARTUP); + enablePlugins(PluginLoadOrder.POSTWORLD); +@@ -1036,11 +1059,8 @@ public final class CraftServer implements Server { return count; } @@ -1394,7 +1400,7 @@ index 936cbc6..67593d5 100644 OfflinePlayer result = getPlayerExact(name); String lname = name.toLowerCase(); -@@ -1048,17 +1078,7 @@ public final class CraftServer implements Server { +@@ -1048,17 +1068,7 @@ public final class CraftServer implements Server { result = offlinePlayers.get(lname); if (result == null) { @@ -1413,7 +1419,7 @@ index 936cbc6..67593d5 100644 result = new CraftOfflinePlayer(this, name); offlinePlayers.put(lname, result); } -@@ -1196,7 +1216,7 @@ public final class CraftServer implements Server { +@@ -1196,7 +1206,7 @@ public final class CraftServer implements Server { Set players = new HashSet(); for (String file : files) { @@ -1422,7 +1428,7 @@ index 936cbc6..67593d5 100644 } players.addAll(Arrays.asList(getOnlinePlayers())); -@@ -1302,7 +1322,7 @@ public final class CraftServer implements Server { +@@ -1302,7 +1312,7 @@ public final class CraftServer implements Server { public List tabCompleteCommand(Player player, String message) { List completions = null; try { @@ -1431,7 +1437,7 @@ index 936cbc6..67593d5 100644 } catch (CommandException ex) { player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command"); getLogger().log(Level.SEVERE, "Exception when " + player.getName() + " attempted to tab complete " + message, ex); -@@ -1338,4 +1358,52 @@ public final class CraftServer implements Server { +@@ -1338,4 +1348,52 @@ public final class CraftServer implements Server { public CraftItemFactory getItemFactory() { return CraftItemFactory.instance(); } @@ -1571,6 +1577,34 @@ index cb20066..3544aa3 100644 public Block getBlockAt(int x, int y, int z) { return getChunkAt(x >> 4, z >> 4).getBlock(x & 0xF, y & 0xFF, z & 0xF); +diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java +new file mode 100644 +index 0000000..e11aee4 +--- /dev/null ++++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +@@ -0,0 +1,22 @@ ++package org.bukkit.craftbukkit; ++ ++import org.bukkit.command.SimpleCommandMap; ++import org.bukkit.configuration.file.YamlConfiguration; ++ ++public class Spigot { ++ public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) { ++ commandMap.register("bukkit", new org.bukkit.craftbukkit.command.RestartCommand("restart")); ++ commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); ++ ++ org.bukkit.craftbukkit.util.WatchdogThread.startThread(configuration.getInt("settings.timeout-time", 180), configuration.getBoolean("settings.restart-on-crash", false)); ++ ++ server.whitelistMessage = configuration.getString("settings.whitelist-message", server.whitelistMessage); ++ server.stopMessage = configuration.getString("settings.stop-message", server.stopMessage); ++ server.logCommands = configuration.getBoolean("settings.log-commands", true); ++ server.ipFilter = configuration.getBoolean("settings.filter-unsafe-ips", false); ++ server.commandComplete = configuration.getBoolean("settings.command-complete", true); ++ server.spamGuardExclusions = configuration.getStringList("settings.spam-exclusions"); ++ ++ org.bukkit.craftbukkit.util.LightningSimulator.configure(configuration); ++ } ++} diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java index 48cf5ba..1d4764c 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java @@ -2834,5 +2868,5 @@ index 61a95e3..e192700 100644 monsters: 70 animals: 15 -- -1.8.1-rc2 +1.8.0.3 diff --git a/CraftBukkit-Patches/0008-Update-timeout-time-to-new-default-value.patch b/CraftBukkit-Patches/0008-Update-timeout-time-to-new-default-value.patch index 6494319..004e83d 100644 --- a/CraftBukkit-Patches/0008-Update-timeout-time-to-new-default-value.patch +++ b/CraftBukkit-Patches/0008-Update-timeout-time-to-new-default-value.patch @@ -1,18 +1,18 @@ -From 5d0333bc35dd3f5d965a26a1b6c489261ad0da0b Mon Sep 17 00:00:00 2001 +From 80a22dc2c4c0d1f7dddb6f97663a40784b0efef0 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 10 Jan 2013 12:33:37 +1100 Subject: [PATCH] Update timeout time to new default value. --- - src/main/java/org/bukkit/craftbukkit/CraftServer.java | 9 ++++++++- - src/main/resources/configurations/bukkit.yml | 2 +- + src/main/java/org/bukkit/craftbukkit/Spigot.java | 9 ++++++++- + src/main/resources/configurations/bukkit.yml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 67593d5..047378a 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -226,7 +226,14 @@ public final class CraftServer implements Server { +diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java +index e11aee4..2b0362a 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java ++++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +@@ -8,7 +8,14 @@ public class Spigot { commandMap.register("bukkit", new org.bukkit.craftbukkit.command.RestartCommand("restart")); commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); @@ -20,14 +20,14 @@ index 67593d5..047378a 100644 + int timeout = configuration.getInt("settings.timeout-time", 300); + if (timeout == 180) { + timeout = 300; -+ getLogger().info("Migrating to new timeout time of 300"); ++ server.getLogger().info("Migrating to new timeout time of 300"); + configuration.set("settings.timeout-time", timeout); -+ saveConfig(); ++ server.saveConfig(); + } + org.bukkit.craftbukkit.util.WatchdogThread.startThread(timeout, configuration.getBoolean("settings.restart-on-crash", false)); - whitelistMessage = configuration.getString("settings.whitelist-message", whitelistMessage); - stopMessage = configuration.getString("settings.stop-message", stopMessage); + server.whitelistMessage = configuration.getString("settings.whitelist-message", server.whitelistMessage); + server.stopMessage = configuration.getString("settings.stop-message", server.stopMessage); diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml index e192700..78134f9 100644 --- a/src/main/resources/configurations/bukkit.yml @@ -42,5 +42,5 @@ index e192700..78134f9 100644 filter-unsafe-ips: false whitelist-message: You are not white-listed on this server! -- -1.8.1-rc2 +1.8.0.3 diff --git a/CraftBukkit-Patches/0021-Add-oreobfuscator-for-Spigot.patch b/CraftBukkit-Patches/0021-Add-oreobfuscator-for-Spigot.patch index 65f0b49..b38f4b4 100644 --- a/CraftBukkit-Patches/0021-Add-oreobfuscator-for-Spigot.patch +++ b/CraftBukkit-Patches/0021-Add-oreobfuscator-for-Spigot.patch @@ -1,4 +1,4 @@ -From 651726d8d8d2b340212ad898826e88b1a0f7fd8e Mon Sep 17 00:00:00 2001 +From c7846efa49cb600996091600a7295c3bb92b1e74 Mon Sep 17 00:00:00 2001 From: lishid Date: Mon, 21 Jan 2013 16:59:04 +1100 Subject: [PATCH] Add oreobfuscator for Spigot. @@ -8,11 +8,12 @@ Subject: [PATCH] Add oreobfuscator for Spigot. .../net/minecraft/server/Packet51MapChunk.java | 1 + .../net/minecraft/server/Packet56MapChunkBulk.java | 21 ++++- .../minecraft/server/PlayerInteractManager.java | 5 ++ - .../java/org/bukkit/craftbukkit/CraftServer.java | 9 +++ + .../java/org/bukkit/craftbukkit/CraftServer.java | 5 ++ .../java/org/bukkit/craftbukkit/CraftWorld.java | 4 + .../bukkit/craftbukkit/OrebfuscatorManager.java | 93 ++++++++++++++++++++++ + src/main/java/org/bukkit/craftbukkit/Spigot.java | 4 + src/main/resources/configurations/bukkit.yml | 5 ++ - 8 files changed, 138 insertions(+), 1 deletion(-) + 9 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java @@ -109,7 +110,7 @@ index 5faee12..55f9ffa 100644 if (false) { // Never trigger diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 047378a..4a75fb1 100644 +index b8e9085..dac1cb7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -163,6 +163,11 @@ public final class CraftServer implements Server { @@ -124,17 +125,6 @@ index 047378a..4a75fb1 100644 private final class BooleanWrapper { private boolean value = true; } -@@ -242,6 +247,10 @@ public final class CraftServer implements Server { - commandComplete = configuration.getBoolean("settings.command-complete", true); - spamGuardExclusions = configuration.getStringList("settings.spam-exclusions"); - -+ orebfuscatorEnabled = configuration.getBoolean("orebfuscator.enable", false); -+ orebfuscatorUpdateRadius = configuration.getInt("orebfuscator.update-radius", 2); -+ orebfuscatorDisabledWorlds = configuration.getStringList("orebfuscator.disabled-worlds"); -+ - org.bukkit.craftbukkit.util.LightningSimulator.configure(configuration); - - try { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 856307f..4861609 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -263,6 +253,21 @@ index 0000000..6d5a519 + || areAjacentBlocksTransparent(world, x, y, z - 1, radius - 1))); + } +} +diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java +index 2b0362a..b6a8d9e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java ++++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +@@ -24,6 +24,10 @@ public class Spigot { + server.commandComplete = configuration.getBoolean("settings.command-complete", true); + server.spamGuardExclusions = configuration.getStringList("settings.spam-exclusions"); + ++ server.orebfuscatorEnabled = configuration.getBoolean("orebfuscator.enable", false); ++ server.orebfuscatorUpdateRadius = configuration.getInt("orebfuscator.update-radius", 2); ++ server.orebfuscatorDisabledWorlds = configuration.getStringList("orebfuscator.disabled-worlds"); ++ + org.bukkit.craftbukkit.util.LightningSimulator.configure(configuration); + } + } diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml index c41fac1..fee0bb1 100644 --- a/src/main/resources/configurations/bukkit.yml @@ -277,5 +282,5 @@ index c41fac1..fee0bb1 100644 + disabled-worlds: + - world_the_end -- -1.8.1-rc2 +1.8.0.3 diff --git a/CraftBukkit-Patches/0022-Compensate-for-allow-nether-allow-end-as-false-BUKKI.patch b/CraftBukkit-Patches/0022-Compensate-for-allow-nether-allow-end-as-false-BUKKI.patch index d10c56a..8d3489a 100644 --- a/CraftBukkit-Patches/0022-Compensate-for-allow-nether-allow-end-as-false-BUKKI.patch +++ b/CraftBukkit-Patches/0022-Compensate-for-allow-nether-allow-end-as-false-BUKKI.patch @@ -1,4 +1,4 @@ -From d40e8631364a7e9590fe14a906816350123d9e49 Mon Sep 17 00:00:00 2001 +From 06e1d0e6a51ad056751c7e4ed6660b3692b49db9 Mon Sep 17 00:00:00 2001 From: EdGruberman Date: Sun, 20 Jan 2013 23:13:04 -0700 Subject: [PATCH] Compensate for allow-nether/allow-end as false; BUKKIT-3466 @@ -74,10 +74,10 @@ index ced8cf0..642a4d9 100644 Vector velocity = entityplayer.getBukkitEntity().getVelocity(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 4a75fb1..6962e5c 100644 +index dac1cb7..e7a459b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -740,7 +740,7 @@ public final class CraftServer implements Server { +@@ -719,7 +719,7 @@ public final class CraftServer implements Server { converter.convert(name, new ConvertProgressUpdater(console)); } @@ -100,5 +100,5 @@ index 4861609..21bd64a 100644 private Environment environment; private final CraftServer server = (CraftServer) Bukkit.getServer(); -- -1.8.1-rc2 +1.8.0.3