From b4686b49be68c3f0b76771d268f6e1214ef66aab Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sun, 30 Mar 2014 17:00:57 +0100 Subject: [PATCH] Replace the village window patch with one that effects all windows (Closes #143) --- CraftBukkit-Patches/0002-mc-dev-imports.patch | 66 ++++++++++++++++++- ...ndow-name-to-prevent-client-disconne.patch | 21 ------ ...-names-to-prevent-client-disconnects.patch | 21 ++++++ 3 files changed, 86 insertions(+), 22 deletions(-) delete mode 100644 CraftBukkit-Patches/0122-Cap-villagers-window-name-to-prevent-client-disconne.patch create mode 100644 CraftBukkit-Patches/0122-Cap-window-names-to-prevent-client-disconnects.patch diff --git a/CraftBukkit-Patches/0002-mc-dev-imports.patch b/CraftBukkit-Patches/0002-mc-dev-imports.patch index 327d30b744..221f65bb17 100644 --- a/CraftBukkit-Patches/0002-mc-dev-imports.patch +++ b/CraftBukkit-Patches/0002-mc-dev-imports.patch @@ -1,4 +1,4 @@ -From 796630458aee1aab9b870fece5ead790d7f0274b Mon Sep 17 00:00:00 2001 +From d1cf8a682f9fe9a4a32f7590869243c259db4461 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 1 Dec 2013 15:10:48 +1100 Subject: [PATCH] mc-dev imports @@ -1888,6 +1888,70 @@ index 0000000..c7b799a + this.a((PacketPlayOutListener) packetlistener); + } +} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java +new file mode 100644 +index 0000000..f6d7b2b +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java +@@ -0,0 +1,58 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutOpenWindow extends Packet { ++ ++ private int a; ++ private int b; ++ private String c; ++ private int d; ++ private boolean e; ++ private int f; ++ ++ public PacketPlayOutOpenWindow() {} ++ ++ public PacketPlayOutOpenWindow(int i, int j, String s, int k, boolean flag) { ++ this.a = i; ++ this.b = j; ++ this.c = s; ++ this.d = k; ++ this.e = flag; ++ } ++ ++ public PacketPlayOutOpenWindow(int i, int j, String s, int k, boolean flag, int l) { ++ this(i, j, s, k, flag); ++ this.f = l; ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.readUnsignedByte(); ++ this.b = packetdataserializer.readUnsignedByte(); ++ this.c = packetdataserializer.c(32); ++ this.d = packetdataserializer.readUnsignedByte(); ++ this.e = packetdataserializer.readBoolean(); ++ if (this.b == 11) { ++ this.f = packetdataserializer.readInt(); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.writeByte(this.a); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.a(this.c); ++ packetdataserializer.writeByte(this.d); ++ packetdataserializer.writeBoolean(this.e); ++ if (this.b == 11) { ++ packetdataserializer.writeInt(this.f); ++ } ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java new file mode 100644 index 0000000..900ed68 diff --git a/CraftBukkit-Patches/0122-Cap-villagers-window-name-to-prevent-client-disconne.patch b/CraftBukkit-Patches/0122-Cap-villagers-window-name-to-prevent-client-disconne.patch deleted file mode 100644 index 71f6bf045a..0000000000 --- a/CraftBukkit-Patches/0122-Cap-villagers-window-name-to-prevent-client-disconne.patch +++ /dev/null @@ -1,21 +0,0 @@ -From bbc9173afbca5aba3c761b7c724618105c63f7cf Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 23 Mar 2014 10:53:48 +0000 -Subject: [PATCH] Cap villagers' window name to prevent client disconnects - - -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index ca06f60..27f9dc9 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -755,6 +755,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.activeContainer.addSlotListener(this); - InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).getMerchantInventory(); - -+ if (s.length() > 32) s = s.substring( 0, 32 ); // Spigot - Cap window name to prevent client disconnects - this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 6, s == null ? "" : s, inventorymerchant.getSize(), s != null)); - MerchantRecipeList merchantrecipelist = imerchant.getOffers(this); - --- -1.8.5.2.msysgit.0 - diff --git a/CraftBukkit-Patches/0122-Cap-window-names-to-prevent-client-disconnects.patch b/CraftBukkit-Patches/0122-Cap-window-names-to-prevent-client-disconnects.patch new file mode 100644 index 0000000000..93fdde06ec --- /dev/null +++ b/CraftBukkit-Patches/0122-Cap-window-names-to-prevent-client-disconnects.patch @@ -0,0 +1,21 @@ +From d9f3f7223ac926e3c89521a74bec232d41ffd5d6 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Sun, 23 Mar 2014 10:53:48 +0000 +Subject: [PATCH] Cap window names to prevent client disconnects + + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java +index f6d7b2b..860592d 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java +@@ -14,6 +14,7 @@ public class PacketPlayOutOpenWindow extends Packet { + public PacketPlayOutOpenWindow() {} + + public PacketPlayOutOpenWindow(int i, int j, String s, int k, boolean flag) { ++ if (s.length() > 32) s = s.substring( 0, 32 ); // Spigot - Cap window name to prevent client disconnects + this.a = i; + this.b = j; + this.c = s; +-- +1.8.5.2.msysgit.0 +