summaryrefslogtreecommitdiffstats
path: root/nms-patches/PlayerConnection.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2015-10-07 21:39:43 +0100
committerThinkofdeath <thinkofdeath@spigotmc.org>2015-10-07 21:39:43 +0100
commitefd6cb08125414bf11d3278d77ebc98e2efcdaf5 (patch)
treef33266ec411118a5761fdedc7384748f373b0a44 /nms-patches/PlayerConnection.patch
parent4a7472d0bfa1c326f68fff4484f2b0f883ab41cb (diff)
downloadcraftbukkit-efd6cb08125414bf11d3278d77ebc98e2efcdaf5.tar
craftbukkit-efd6cb08125414bf11d3278d77ebc98e2efcdaf5.tar.gz
craftbukkit-efd6cb08125414bf11d3278d77ebc98e2efcdaf5.tar.lz
craftbukkit-efd6cb08125414bf11d3278d77ebc98e2efcdaf5.tar.xz
craftbukkit-efd6cb08125414bf11d3278d77ebc98e2efcdaf5.zip
Ensure the buffer for plugin messages is freed.
Diffstat (limited to 'nms-patches/PlayerConnection.patch')
-rw-r--r--nms-patches/PlayerConnection.patch27
1 files changed, 21 insertions, 6 deletions
diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch
index 26d4212d..a1f3b528 100644
--- a/nms-patches/PlayerConnection.patch
+++ b/nms-patches/PlayerConnection.patch
@@ -1425,7 +1425,15 @@
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator();
-@@ -921,13 +1884,16 @@
+@@ -905,6 +1868,7 @@
+ ItemStack itemstack;
+ ItemStack itemstack1;
+
++ try { // CraftBukkit
+ if ("MC|BEdit".equals(packetplayincustompayload.a())) {
+ packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.b()));
+
+@@ -921,13 +1885,16 @@
itemstack1 = this.player.inventory.getItemInHand();
if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
@@ -1442,7 +1450,7 @@
return;
} finally {
packetdataserializer.release();
-@@ -950,16 +1916,21 @@
+@@ -950,16 +1917,21 @@
itemstack1 = this.player.inventory.getItemInHand();
if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
@@ -1464,7 +1472,7 @@
return;
} finally {
packetdataserializer.release();
-@@ -976,11 +1947,12 @@
+@@ -976,11 +1948,12 @@
}
} catch (Exception exception2) {
PlayerConnection.c.error("Couldn\'t select trade", exception2);
@@ -1478,7 +1486,7 @@
packetdataserializer = packetplayincustompayload.b();
try {
-@@ -1016,6 +1988,7 @@
+@@ -1016,6 +1989,7 @@
}
} catch (Exception exception3) {
PlayerConnection.c.error("Couldn\'t set command block", exception3);
@@ -1486,7 +1494,7 @@
} finally {
packetdataserializer.release();
}
-@@ -1041,6 +2014,7 @@
+@@ -1041,6 +2015,7 @@
}
} catch (Exception exception4) {
PlayerConnection.c.error("Couldn\'t set beacon", exception4);
@@ -1494,7 +1502,7 @@
}
}
} else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) {
-@@ -1056,7 +2030,28 @@
+@@ -1056,7 +2031,35 @@
containeranvil.a("");
}
}
@@ -1515,6 +1523,13 @@
+ server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.a(), data);
+ }
+ // CraftBukkit end
++ // CraftBukkit start
++ } finally {
++ if (packetplayincustompayload.b().refCnt() > 0) {
++ packetplayincustompayload.b().release();
++ }
++ }
++ // CraftBukkit end
+ }
+ // CraftBukkit start - Add "isDisconnected" method