From 5dba601889ee1ca1fd3fd5f488d9c88aeb8e2c01 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 25 Jan 2013 13:27:22 +1100 Subject: [PATCH] Add anti xray timings. --- .../0023-Track-Xray-timings.patch | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 CraftBukkit-Patches/0023-Track-Xray-timings.patch diff --git a/CraftBukkit-Patches/0023-Track-Xray-timings.patch b/CraftBukkit-Patches/0023-Track-Xray-timings.patch new file mode 100644 index 000000000..7c4e2e104 --- /dev/null +++ b/CraftBukkit-Patches/0023-Track-Xray-timings.patch @@ -0,0 +1,53 @@ +From c7fe2d7f3ac2abda1bcda274e0fd36648a2f7c3d Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Fri, 25 Jan 2013 13:15:42 +1100 +Subject: [PATCH] Track Xray timings. + +--- + src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java +index 7178dfb..723fd9f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java ++++ b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java +@@ -2,11 +2,14 @@ package org.bukkit.craftbukkit; + + import net.minecraft.server.Block; + import net.minecraft.server.World; ++import org.bukkit.event.CustomTimingsHandler; + + public class OrebfuscatorManager { + + // Used to keep track of which blocks to obfuscate + private static boolean[] obfuscateBlocks = new boolean[Short.MAX_VALUE]; ++ private static final CustomTimingsHandler obfuscate = new CustomTimingsHandler("xray - obfuscate"); ++ private static final CustomTimingsHandler update = new CustomTimingsHandler("xray - update"); + + // Default blocks + static { +@@ -24,10 +27,13 @@ public class OrebfuscatorManager { + } + + public static void updateNearbyBlocks(World world, int x, int y, int z) { ++ update.startTiming(); + updateNearbyBlocks(world, x, y, z, world.getServer().orebfuscatorUpdateRadius); ++ update.stopTiming(); + } + + public static void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) { ++ obfuscate.startTiming(); + if (world.getServer().orebfuscatorEnabled && world.getWorld().obfuscated) { + int initialRadius = 1; + int index = 0; +@@ -56,6 +62,7 @@ public class OrebfuscatorManager { + } + } + } ++ obfuscate.stopTiming(); + } + + private static void updateNearbyBlocks(World world, int x, int y, int z, int radius) { +-- +1.8.1-rc2 +