From 125729df151e70b672ab461ff98f3decb05cf32d Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 22 Feb 2013 19:30:23 +1100 Subject: [PATCH] Remove TagAPI patches. --- Bukkit-Patches/0005-TagAPI.patch | 25 --- ...-into-Spigot-much-more-efficient-and.patch | 201 ------------------ ...ptimize-getTileEntities-performance.patch} | 2 +- ...ile-entity-lookup-for-chunk-sending.patch} | 4 +- 4 files changed, 3 insertions(+), 229 deletions(-) delete mode 100644 Bukkit-Patches/0005-TagAPI.patch delete mode 100644 CraftBukkit-Patches/0028-Implement-TagAPI-into-Spigot-much-more-efficient-and.patch rename CraftBukkit-Patches/{0029-Optimize-getTileEntities-performance.patch => 0028-Optimize-getTileEntities-performance.patch} (96%) rename CraftBukkit-Patches/{0030-Improved-tile-entity-lookup-for-chunk-sending.patch => 0029-Improved-tile-entity-lookup-for-chunk-sending.patch} (95%) diff --git a/Bukkit-Patches/0005-TagAPI.patch b/Bukkit-Patches/0005-TagAPI.patch deleted file mode 100644 index d9c6fbdfd..000000000 --- a/Bukkit-Patches/0005-TagAPI.patch +++ /dev/null @@ -1,25 +0,0 @@ -From db9d11eeb2b1c429c6ba281d8f2ffabf3e3c5721 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 20 Feb 2013 20:16:40 +1100 -Subject: [PATCH] TagAPI - ---- - src/main/java/org/bukkit/plugin/SimplePluginManager.java | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 4049d3a..9560cec 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -354,7 +354,7 @@ public final class SimplePluginManager implements PluginManager { - public boolean isPluginEnabled(String name) { - Plugin plugin = getPlugin(name); - -- return isPluginEnabled(plugin); -+ return name.equals("TagAPI") || isPluginEnabled(plugin); - } - - /** --- -1.8.1-rc2 - diff --git a/CraftBukkit-Patches/0028-Implement-TagAPI-into-Spigot-much-more-efficient-and.patch b/CraftBukkit-Patches/0028-Implement-TagAPI-into-Spigot-much-more-efficient-and.patch deleted file mode 100644 index b976db967..000000000 --- a/CraftBukkit-Patches/0028-Implement-TagAPI-into-Spigot-much-more-efficient-and.patch +++ /dev/null @@ -1,201 +0,0 @@ -From b46a1d3cb2371706ba49c9cf6c1b8919dc6edaa8 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 19 Feb 2013 18:30:10 +1100 -Subject: [PATCH] Implement TagAPI into Spigot - much more efficient and only a - dozen lines of code. - ---- - .../net/minecraft/server/EntityTrackerEntry.java | 12 +++- - .../java/net/minecraft/server/MinecraftServer.java | 1 + - .../org/kitteh/tag/PlayerReceiveNameTagEvent.java | 49 +++++++++++++++ - src/main/java/org/kitteh/tag/TagAPI.java | 73 ++++++++++++++++++++++ - 4 files changed, 132 insertions(+), 3 deletions(-) - create mode 100644 src/main/java/org/kitteh/tag/PlayerReceiveNameTagEvent.java - create mode 100644 src/main/java/org/kitteh/tag/TagAPI.java - -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 27a548f..d95d5af 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -301,7 +301,7 @@ public class EntityTrackerEntry { - // CraftBukkit end - - this.trackedPlayers.add(entityplayer); -- Packet packet = this.b(); -+ Packet packet = this.b(entityplayer); // Spigot - - entityplayer.playerConnection.sendPacket(packet); - if (!this.tracker.getDataWatcher().d()) { -@@ -370,7 +370,7 @@ public class EntityTrackerEntry { - } - } - -- private Packet b() { -+ private Packet b(EntityPlayer target) { // Spigot - if (this.tracker.dead) { - // CraftBukkit start - remove useless error spam, just return - // System.out.println("Fetching addPacket for removed entity"); -@@ -381,7 +381,13 @@ public class EntityTrackerEntry { - if (this.tracker instanceof EntityItem) { - return new Packet23VehicleSpawn(this.tracker, 2, 1); - } else if (this.tracker instanceof EntityPlayer) { -- return new Packet20NamedEntitySpawn((EntityHuman) this.tracker); -+ // Spigot start -+ Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn((EntityHuman) this.tracker); -+ org.kitteh.tag.PlayerReceiveNameTagEvent event = new org.kitteh.tag.PlayerReceiveNameTagEvent(target.getBukkitEntity(), ((EntityPlayer) tracker).getBukkitEntity()); -+ tracker.world.getServer().getPluginManager().callEvent(event); -+ packet.b = event.getTag(); -+ return packet; -+ // Spigot end - } else { - if (this.tracker instanceof EntityMinecart) { - EntityMinecart entityminecart = (EntityMinecart) this.tracker; -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 99a6cf4..69564cd 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -512,6 +512,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - - this.methodProfiler.b(); - this.methodProfiler.b(); -+ org.kitteh.tag.TagAPI.tick(); // Spigot - } - - public void r() { -diff --git a/src/main/java/org/kitteh/tag/PlayerReceiveNameTagEvent.java b/src/main/java/org/kitteh/tag/PlayerReceiveNameTagEvent.java -new file mode 100644 -index 0000000..2ea9e07 ---- /dev/null -+++ b/src/main/java/org/kitteh/tag/PlayerReceiveNameTagEvent.java -@@ -0,0 +1,49 @@ -+package org.kitteh.tag; -+ -+import org.apache.commons.lang.Validate; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+ -+public class PlayerReceiveNameTagEvent extends PlayerEvent { -+ -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean modified; -+ private final Player named; -+ private String tag; -+ -+ public PlayerReceiveNameTagEvent(Player who, Player named) { -+ super(who); -+ this.modified = false; -+ this.named = named; -+ this.tag = named.getName(); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+ -+ public Player getNamedPlayer() { -+ return named; -+ } -+ -+ public String getTag() { -+ return tag; -+ } -+ -+ public boolean isModified() { -+ return modified; -+ } -+ -+ public boolean setTag(String newTag) { -+ Validate.notNull(newTag, "New nametag cannot be null!"); -+ tag = newTag; -+ modified = true; -+ return (newTag.length() < 16) ? true : false; -+ } -+} -diff --git a/src/main/java/org/kitteh/tag/TagAPI.java b/src/main/java/org/kitteh/tag/TagAPI.java -new file mode 100644 -index 0000000..1e2693c ---- /dev/null -+++ b/src/main/java/org/kitteh/tag/TagAPI.java -@@ -0,0 +1,73 @@ -+package org.kitteh.tag; -+ -+import com.google.common.base.Preconditions; -+import java.util.HashMap; -+import java.util.HashSet; -+import java.util.Iterator; -+import java.util.Map; -+import java.util.Set; -+import org.bukkit.entity.Player; -+ -+public class TagAPI { -+ -+ private static Set tasks = new HashSet(); -+ -+ private static class DelayedShowTask { -+ -+ private final Map pairs = new HashMap(); -+ private int countdown = 2; -+ } -+ -+ public static void tick() { -+ for (Iterator iter = tasks.iterator(); iter.hasNext();) { -+ DelayedShowTask task = iter.next(); -+ if (--task.countdown == 0) { -+ iter.remove(); -+ for (Map.Entry pair : task.pairs.entrySet()) { -+ if (pair.getKey() != null && pair.getValue() != null) { -+ pair.getValue().showPlayer(pair.getValue()); -+ } -+ } -+ } -+ } -+ } -+ -+ public static void refreshPlayer(Player player) { -+ Preconditions.checkArgument(player != null, "player"); -+ Preconditions.checkArgument(player.isOnline(), "offline"); -+ -+ DelayedShowTask task = new DelayedShowTask(); -+ for (Player otherGuy : player.getWorld().getPlayers()) { -+ if (player != otherGuy && otherGuy.canSee(player)) { -+ otherGuy.hidePlayer(player); -+ task.pairs.put(otherGuy, player); -+ } -+ } -+ -+ tasks.add(task); -+ } -+ -+ public static void refreshPlayer(Player player, Player forWhom) { -+ Preconditions.checkArgument(player != null, "player"); -+ Preconditions.checkArgument(forWhom != null, "forWhom"); -+ Preconditions.checkArgument(player != forWhom, "self"); -+ DelayedShowTask task = new DelayedShowTask(); -+ -+ if (forWhom.canSee(player) && player.getWorld() == forWhom.getWorld()) { -+ forWhom.hidePlayer(player); -+ task.pairs.put(forWhom, player); -+ } -+ -+ tasks.add(task); -+ } -+ -+ public static void refreshPlayer(Player player, Set forWhom) { -+ Preconditions.checkArgument(player != null, "player"); -+ Preconditions.checkArgument(forWhom != null, "forWhom"); -+ for (Player whom : forWhom) { -+ if (player != whom) { -+ refreshPlayer(player, whom); -+ } -+ } -+ } -+} --- -1.8.1-rc2 - diff --git a/CraftBukkit-Patches/0029-Optimize-getTileEntities-performance.patch b/CraftBukkit-Patches/0028-Optimize-getTileEntities-performance.patch similarity index 96% rename from CraftBukkit-Patches/0029-Optimize-getTileEntities-performance.patch rename to CraftBukkit-Patches/0028-Optimize-getTileEntities-performance.patch index 69322ba6c..b74f9d45c 100644 --- a/CraftBukkit-Patches/0029-Optimize-getTileEntities-performance.patch +++ b/CraftBukkit-Patches/0028-Optimize-getTileEntities-performance.patch @@ -1,4 +1,4 @@ -From 4217d76754fcff68bd39d9d70625b8df90a5df09 Mon Sep 17 00:00:00 2001 +From 67f4933a29bc5317157dbb033c8400ca26df6909 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 20 Feb 2013 23:07:53 -0500 Subject: [PATCH] Optimize getTileEntities performance diff --git a/CraftBukkit-Patches/0030-Improved-tile-entity-lookup-for-chunk-sending.patch b/CraftBukkit-Patches/0029-Improved-tile-entity-lookup-for-chunk-sending.patch similarity index 95% rename from CraftBukkit-Patches/0030-Improved-tile-entity-lookup-for-chunk-sending.patch rename to CraftBukkit-Patches/0029-Improved-tile-entity-lookup-for-chunk-sending.patch index 79693fc06..41069822e 100644 --- a/CraftBukkit-Patches/0030-Improved-tile-entity-lookup-for-chunk-sending.patch +++ b/CraftBukkit-Patches/0029-Improved-tile-entity-lookup-for-chunk-sending.patch @@ -1,4 +1,4 @@ -From 18c3488b099973cb0c3b6acefe23baecf4acf9bd Mon Sep 17 00:00:00 2001 +From 58eaa4790c1875741e06017f81a32801cfc3f4ad Mon Sep 17 00:00:00 2001 From: shakytom Date: Wed, 20 Feb 2013 22:34:38 -0500 Subject: [PATCH] Improved tile entity lookup for chunk sending @@ -26,5 +26,5 @@ index 8d61ca6..28f462b 100644 } -- -1.8.1.1 +1.8.1-rc2