mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-15 07:01:36 +08:00
Replace the village window patch with one that effects all windows (Closes #143)
This commit is contained in:
parent
b8bbdcfacb
commit
b4686b49be
@ -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 <md_5@live.com.au>
|
||||
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
|
||||
|
@ -1,21 +0,0 @@
|
||||
From bbc9173afbca5aba3c761b7c724618105c63f7cf Mon Sep 17 00:00:00 2001
|
||||
From: Thinkofdeath <thethinkofdeath@gmail.com>
|
||||
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
|
||||
|
@ -0,0 +1,21 @@
|
||||
From d9f3f7223ac926e3c89521a74bec232d41ffd5d6 Mon Sep 17 00:00:00 2001
|
||||
From: Thinkofdeath <thethinkofdeath@gmail.com>
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user