Ensure the buffer for plugin messages is freed.

This commit is contained in:
Thinkofdeath 2015-10-07 21:39:43 +01:00
parent 4a7472d0bf
commit efd6cb0812

View File

@ -1425,7 +1425,15 @@
ArrayList arraylist = Lists.newArrayList(); ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator(); 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(); itemstack1 = this.player.inventory.getItemInHand();
if (itemstack1 != null) { if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
@ -1442,7 +1450,7 @@
return; return;
} finally { } finally {
packetdataserializer.release(); packetdataserializer.release();
@@ -950,16 +1916,21 @@ @@ -950,16 +1917,21 @@
itemstack1 = this.player.inventory.getItemInHand(); itemstack1 = this.player.inventory.getItemInHand();
if (itemstack1 != null) { if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) { if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
@ -1464,7 +1472,7 @@
return; return;
} finally { } finally {
packetdataserializer.release(); packetdataserializer.release();
@@ -976,11 +1947,12 @@ @@ -976,11 +1948,12 @@
} }
} catch (Exception exception2) { } catch (Exception exception2) {
PlayerConnection.c.error("Couldn\'t select trade", exception2); PlayerConnection.c.error("Couldn\'t select trade", exception2);
@ -1478,7 +1486,7 @@
packetdataserializer = packetplayincustompayload.b(); packetdataserializer = packetplayincustompayload.b();
try { try {
@@ -1016,6 +1988,7 @@ @@ -1016,6 +1989,7 @@
} }
} catch (Exception exception3) { } catch (Exception exception3) {
PlayerConnection.c.error("Couldn\'t set command block", exception3); PlayerConnection.c.error("Couldn\'t set command block", exception3);
@ -1486,7 +1494,7 @@
} finally { } finally {
packetdataserializer.release(); packetdataserializer.release();
} }
@@ -1041,6 +2014,7 @@ @@ -1041,6 +2015,7 @@
} }
} catch (Exception exception4) { } catch (Exception exception4) {
PlayerConnection.c.error("Couldn\'t set beacon", 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) { } else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) {
@@ -1056,7 +2030,28 @@ @@ -1056,7 +2031,35 @@
containeranvil.a(""); containeranvil.a("");
} }
} }
@ -1515,6 +1523,13 @@
+ server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.a(), data); + server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.a(), data);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ // CraftBukkit start
+ } finally {
+ if (packetplayincustompayload.b().refCnt() > 0) {
+ packetplayincustompayload.b().release();
+ }
+ }
+ // CraftBukkit end
+ } + }
+ // CraftBukkit start - Add "isDisconnected" method + // CraftBukkit start - Add "isDisconnected" method