From d9f3cf3f2c8f5c3b717c46f0ba31ad71b1f82c31 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Mar 2013 10:58:55 +1100 Subject: [PATCH] Allow orebfuscated blocks to be specified by the server admin. --- .../0017-Add-oreobfuscator-for-Spigot.patch | 114 +++++++++--------- .../0022-Entity-Activation-Range.patch | 8 +- ...-the-Metrics-system-to-be-closer-to-.patch | 6 +- .../0026-Watchdog-Thread.patch | 11 +- .../0040-Entity-Tracking-Ranges.patch | 8 +- 5 files changed, 72 insertions(+), 75 deletions(-) diff --git a/CraftBukkit-Patches/0017-Add-oreobfuscator-for-Spigot.patch b/CraftBukkit-Patches/0017-Add-oreobfuscator-for-Spigot.patch index 2ccc60b9d..ca137b9ec 100644 --- a/CraftBukkit-Patches/0017-Add-oreobfuscator-for-Spigot.patch +++ b/CraftBukkit-Patches/0017-Add-oreobfuscator-for-Spigot.patch @@ -1,60 +1,60 @@ -From d097a38c9de9968273e46a4d4c89ab7dfe833dbc Mon Sep 17 00:00:00 2001 -From: lishid -Date: Sat, 16 Feb 2013 10:05:25 +1100 +From 54366c6d6fe0a33678bad98c9d179eccaefb20ab Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Sat, 23 Mar 2013 10:58:17 +1100 Subject: [PATCH] Add oreobfuscator for Spigot. --- .../net/minecraft/server/EntityFallingBlock.java | 1 + src/main/java/net/minecraft/server/Explosion.java | 1 + .../net/minecraft/server/Packet51MapChunk.java | 1 + - .../net/minecraft/server/Packet56MapChunkBulk.java | 21 ++- + .../net/minecraft/server/Packet56MapChunkBulk.java | 21 +++- .../minecraft/server/PlayerInteractManager.java | 5 + - .../java/org/bukkit/craftbukkit/CraftServer.java | 6 + + .../java/org/bukkit/craftbukkit/CraftServer.java | 7 ++ .../java/org/bukkit/craftbukkit/CraftWorld.java | 4 + - .../bukkit/craftbukkit/OrebfuscatorManager.java | 146 +++++++++++++++++++++ - src/main/java/org/bukkit/craftbukkit/Spigot.java | 8 ++ - src/main/resources/configurations/bukkit.yml | 6 + - 10 files changed, 198 insertions(+), 1 deletion(-) - create mode 100644 src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java + src/main/java/org/bukkit/craftbukkit/Spigot.java | 9 ++ + .../java/org/spigotmc/OrebfuscatorManager.java | 139 +++++++++++++++++++++ + src/main/resources/configurations/bukkit.yml | 7 ++ + 10 files changed, 194 insertions(+), 1 deletion(-) + create mode 100644 src/main/java/org/spigotmc/OrebfuscatorManager.java diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 96120d8..0707d23 100644 +index 96120d8..0e35c7e 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -94,6 +94,7 @@ public class EntityFallingBlock extends Entity { } this.world.setAir(i, j, k); -+ org.bukkit.craftbukkit.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); // Spigot (Orebfuscator) ++ org.spigotmc.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); // Spigot (Orebfuscator) } if (this.onGround) { diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 50646ce..7279631 100644 +index 50646ce..c7405a7 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -240,6 +240,7 @@ public class Explosion { j = chunkposition.y; k = chunkposition.z; l = this.world.getTypeId(i, j, k); -+ org.bukkit.craftbukkit.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); // Spigot (Orebfuscator) ++ org.spigotmc.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); // Spigot (Orebfuscator) if (flag) { double d0 = (double) ((float) i + this.world.random.nextFloat()); double d1 = (double) ((float) j + this.world.random.nextFloat()); diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java -index b51d90c..230dd62 100644 +index b51d90c..9c21129 100644 --- a/src/main/java/net/minecraft/server/Packet51MapChunk.java +++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java @@ -46,6 +46,7 @@ public class Packet51MapChunk extends Packet { this.d = chunkmap.c; this.c = chunkmap.b; -+ org.bukkit.craftbukkit.OrebfuscatorManager.obfuscateSync(chunk.x, chunk.z, i, chunkmap.a, chunk.world); // Spigot (Orebfuscator) ++ org.spigotmc.OrebfuscatorManager.obfuscateSync(chunk.x, chunk.z, i, chunkmap.a, chunk.world); // Spigot (Orebfuscator) try { this.inflatedBuffer = chunkmap.a; diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java -index 867ebd3..9d5cee7 100644 +index 867ebd3..df63cf7 100644 --- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java +++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java @@ -28,6 +28,7 @@ public class Packet56MapChunkBulk extends Packet { @@ -91,7 +91,7 @@ index 867ebd3..9d5cee7 100644 + // Spigot (Orebfuscator) start - Obfuscate chunks + int finalBufferSize = 0; + for (int i = 0; i < a.length; i++) { -+ org.bukkit.craftbukkit.OrebfuscatorManager.obfuscate(c[i], d[i], a[i], inflatedBuffers[i], world); ++ org.spigotmc.OrebfuscatorManager.obfuscate(c[i], d[i], a[i], inflatedBuffers[i], world); + finalBufferSize += inflatedBuffers[i].length; + } + @@ -107,7 +107,7 @@ index 867ebd3..9d5cee7 100644 deflater.reset(); deflater.setInput(this.buildBuffer); diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 92e68be..62df1a3 100644 +index 92e68be..2e19142 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -291,6 +291,11 @@ public class PlayerInteractManager { @@ -116,17 +116,17 @@ index 92e68be..62df1a3 100644 } + // Spigot (Orebfuscator) start + else { -+ org.bukkit.craftbukkit.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); ++ org.spigotmc.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); + } + // Spigot (Orebfuscator) end } 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 872c4ac..83704f0 100644 +index 872c4ac..255de03 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -163,6 +163,12 @@ public final class CraftServer implements Server { +@@ -163,6 +163,13 @@ public final class CraftServer implements Server { private WarningState warningState = WarningState.DEFAULT; private final BooleanWrapper online = new BooleanWrapper(); @@ -135,6 +135,7 @@ index 872c4ac..83704f0 100644 + public int orebfuscatorEngineMode = 1; + public int orebfuscatorUpdateRadius = 2; + public List orebfuscatorDisabledWorlds; ++ public List orebfuscatorBlocks; + private final class BooleanWrapper { private boolean value = true; @@ -168,17 +169,38 @@ index f81ca3e..fbab028 100644 //Crop growth rates: public int wheatGrowthModifier = 100; public int cactusGrowthModifier = 100; -diff --git a/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java +diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java +index db46037..4097568 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java ++++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +@@ -15,6 +15,15 @@ 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.orebfuscatorEngineMode = configuration.getInt("orebfuscator.engine-mode", 1); ++ server.orebfuscatorUpdateRadius = configuration.getInt("orebfuscator.update-radius", 2); ++ server.orebfuscatorDisabledWorlds = configuration.getStringList("orebfuscator.disabled-worlds"); ++ server.orebfuscatorBlocks = configuration.getShortList("orebfuscator.blocks"); ++ if (server.orebfuscatorEngineMode != 1 && server.orebfuscatorEngineMode != 2) { ++ server.orebfuscatorEngineMode = 1; ++ } ++ + if (server.chunkGCPeriod == 0) { + server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!"); + } +diff --git a/src/main/java/org/spigotmc/OrebfuscatorManager.java b/src/main/java/org/spigotmc/OrebfuscatorManager.java new file mode 100644 -index 0000000..c04eec2 +index 0000000..768b74c --- /dev/null -+++ b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java -@@ -0,0 +1,146 @@ -+package org.bukkit.craftbukkit; ++++ b/src/main/java/org/spigotmc/OrebfuscatorManager.java +@@ -0,0 +1,139 @@ ++package org.spigotmc; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.server.Block; ++import net.minecraft.server.MinecraftServer; +import net.minecraft.server.World; +import org.bukkit.CustomTimingsHandler; + @@ -193,17 +215,9 @@ index 0000000..c04eec2 + + // Default blocks + static { -+ obfuscateBlocks[Block.STONE.id] = true; -+ obfuscateBlocks[Block.GOLD_ORE.id] = true; -+ obfuscateBlocks[Block.IRON_ORE.id] = true; -+ obfuscateBlocks[Block.COAL_ORE.id] = true; -+ obfuscateBlocks[Block.LAPIS_ORE.id] = true; -+ obfuscateBlocks[Block.CHEST.id] = true; -+ obfuscateBlocks[Block.DIAMOND_ORE.id] = true; -+ obfuscateBlocks[Block.REDSTONE_ORE.id] = true; -+ obfuscateBlocks[Block.GLOWING_REDSTONE_ORE.id] = true; -+ obfuscateBlocks[Block.EMERALD_ORE.id] = true; -+ obfuscateBlocks[Block.ENDER_CHEST.id] = true; ++ for (short id : MinecraftServer.getServer().server.orebfuscatorBlocks) { ++ obfuscateBlocks[id] = true; ++ } + + List blocks = new ArrayList(); + for (int i = 0; i < obfuscateBlocks.length; i++) { @@ -320,30 +334,11 @@ index 0000000..c04eec2 + || 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 db46037..ad65bca 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Spigot.java -+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java -@@ -15,6 +15,14 @@ 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.orebfuscatorEngineMode = configuration.getInt("orebfuscator.engine-mode", 1); -+ server.orebfuscatorUpdateRadius = configuration.getInt("orebfuscator.update-radius", 2); -+ server.orebfuscatorDisabledWorlds = configuration.getStringList("orebfuscator.disabled-worlds"); -+ if (server.orebfuscatorEngineMode != 1 && server.orebfuscatorEngineMode != 2) { -+ server.orebfuscatorEngineMode = 1; -+ } -+ - if (server.chunkGCPeriod == 0) { - server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!"); - } diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml -index 35fbd06..6c21ca2 100644 +index 35fbd06..f0d731f 100644 --- a/src/main/resources/configurations/bukkit.yml +++ b/src/main/resources/configurations/bukkit.yml -@@ -81,3 +81,9 @@ database: +@@ -81,3 +81,10 @@ database: driver: org.sqlite.JDBC password: walrus url: jdbc:sqlite:{DIR}{NAME}.db @@ -353,6 +348,7 @@ index 35fbd06..6c21ca2 100644 + update-radius: 2 + disabled-worlds: + - world_the_end ++ blocks: [1, 5, 14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130] -- 1.8.1-rc2 diff --git a/CraftBukkit-Patches/0022-Entity-Activation-Range.patch b/CraftBukkit-Patches/0022-Entity-Activation-Range.patch index 9b2943299..63496f3f6 100644 --- a/CraftBukkit-Patches/0022-Entity-Activation-Range.patch +++ b/CraftBukkit-Patches/0022-Entity-Activation-Range.patch @@ -1,4 +1,4 @@ -From aa8040ec37080586df5f64493f42381b37661bf8 Mon Sep 17 00:00:00 2001 +From ec5887e4dec30708a0c515ce5a2e70cde34b7532 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 3 Feb 2013 05:10:21 -0500 Subject: [PATCH] Entity Activation Range @@ -173,7 +173,7 @@ index fbab028..80762c1 100644 public Block getBlockAt(int x, int y, int z) { diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java -index ad65bca..8012ff8 100644 +index 4097568..705daef 100644 --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java @@ -1,9 +1,17 @@ @@ -194,7 +194,7 @@ index ad65bca..8012ff8 100644 public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) { commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); -@@ -26,5 +34,216 @@ public class Spigot { +@@ -27,5 +35,216 @@ public class Spigot { if (server.chunkGCPeriod == 0) { server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!"); } @@ -426,7 +426,7 @@ index bbb6368..d8f73ad 100644 public static final HashMap tileEntityTypeTimingMap = new HashMap(); public static final HashMap pluginTaskTimingMap = new HashMap(); diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml -index 6c21ca2..24808be 100644 +index f0d731f..b741e37 100644 --- a/src/main/resources/configurations/bukkit.yml +++ b/src/main/resources/configurations/bukkit.yml @@ -46,6 +46,9 @@ world-settings: diff --git a/CraftBukkit-Patches/0025-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch b/CraftBukkit-Patches/0025-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch index 470976ea3..4c18f3e88 100644 --- a/CraftBukkit-Patches/0025-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch +++ b/CraftBukkit-Patches/0025-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch @@ -1,4 +1,4 @@ -From f6429bed849b1a286b7cd69fac7bacd168d54790 Mon Sep 17 00:00:00 2001 +From 461372e8d5692a394570da7b0a7057ed5806224d Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Feb 2013 08:58:35 +1100 Subject: [PATCH] Metrics. Rewrite the Metrics system to be closer to the @@ -11,7 +11,7 @@ Subject: [PATCH] Metrics. Rewrite the Metrics system to be closer to the create mode 100644 src/main/java/org/spigotmc/Metrics.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java -index 8012ff8..8df3ca5 100644 +index 705daef..b00c885 100644 --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java @@ -1,11 +1,16 @@ @@ -41,7 +41,7 @@ index 8012ff8..8df3ca5 100644 public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) { commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); -@@ -35,6 +43,16 @@ public class Spigot { +@@ -36,6 +44,16 @@ public class Spigot { server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!"); } diff --git a/CraftBukkit-Patches/0026-Watchdog-Thread.patch b/CraftBukkit-Patches/0026-Watchdog-Thread.patch index 178b14250..4012c5393 100644 --- a/CraftBukkit-Patches/0026-Watchdog-Thread.patch +++ b/CraftBukkit-Patches/0026-Watchdog-Thread.patch @@ -1,4 +1,4 @@ -From 64483fc7a96665193fea41e27500fa1eee4eeaeb Mon Sep 17 00:00:00 2001 +From 9fff54f533fad7006a63b3f739bcb4c7b0fc9760 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Feb 2013 12:33:20 +1100 Subject: [PATCH] Watchdog Thread. @@ -34,7 +34,7 @@ index 28135f4..3689a3d 100644 this.isStopped = true; } catch (Throwable throwable1) { diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java -index 8df3ca5..4b355c9 100644 +index b00c885..dcfac79 100644 --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java @@ -1,5 +1,6 @@ @@ -65,7 +65,7 @@ index 8df3ca5..4b355c9 100644 server.whitelistMessage = configuration.getString("settings.whitelist-message", server.whitelistMessage); server.stopMessage = configuration.getString("settings.stop-message", server.stopMessage); -@@ -31,12 +35,23 @@ public class Spigot { +@@ -31,13 +35,24 @@ public class Spigot { server.commandComplete = configuration.getBoolean("settings.command-complete", true); server.spamGuardExclusions = configuration.getStringList("settings.spam-exclusions"); @@ -84,13 +84,14 @@ index 8df3ca5..4b355c9 100644 server.orebfuscatorEngineMode = configuration.getInt("orebfuscator.engine-mode", 1); server.orebfuscatorUpdateRadius = configuration.getInt("orebfuscator.update-radius", 2); server.orebfuscatorDisabledWorlds = configuration.getStringList("orebfuscator.disabled-worlds"); + server.orebfuscatorBlocks = configuration.getShortList("orebfuscator.blocks"); if (server.orebfuscatorEngineMode != 1 && server.orebfuscatorEngineMode != 2) { - server.orebfuscatorEngineMode = 1; + server.orebfuscatorEngineMode = 1; } if (server.chunkGCPeriod == 0) { -@@ -264,4 +279,63 @@ public class Spigot { +@@ -265,4 +280,63 @@ public class Spigot { SpigotTimings.checkIfActiveTimer.stopTiming(); return isActive; } @@ -283,7 +284,7 @@ index 0000000..10390b8 + } +} diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml -index 24808be..c7014fa 100644 +index b741e37..ab8c5d6 100644 --- a/src/main/resources/configurations/bukkit.yml +++ b/src/main/resources/configurations/bukkit.yml @@ -31,6 +31,9 @@ settings: diff --git a/CraftBukkit-Patches/0040-Entity-Tracking-Ranges.patch b/CraftBukkit-Patches/0040-Entity-Tracking-Ranges.patch index f85bce671..55dea1e22 100644 --- a/CraftBukkit-Patches/0040-Entity-Tracking-Ranges.patch +++ b/CraftBukkit-Patches/0040-Entity-Tracking-Ranges.patch @@ -1,4 +1,4 @@ -From f236d3d8b27a9127905563e20c58ac512268e9dc Mon Sep 17 00:00:00 2001 +From 9e7503dbe6691e74f3ef4d864b459da13597cb29 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 20 Feb 2013 11:58:47 -0500 Subject: [PATCH] Entity Tracking Ranges @@ -83,10 +83,10 @@ index 3bfc669..804da57 100644 public Block getBlockAt(int x, int y, int z) { diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java -index 4b355c9..f3e9e79 100644 +index dcfac79..beab433 100644 --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java -@@ -338,4 +338,30 @@ public class Spigot { +@@ -339,4 +339,30 @@ public class Spigot { ex.printStackTrace(); } } @@ -118,7 +118,7 @@ index 4b355c9..f3e9e79 100644 + } } diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml -index 472b36b..de93708 100644 +index 3a875da..9cfee2d 100644 --- a/src/main/resources/configurations/bukkit.yml +++ b/src/main/resources/configurations/bukkit.yml @@ -53,6 +53,11 @@ world-settings: