diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2014-02-10 15:38:52 -0600 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2014-02-10 15:43:56 -0600 |
commit | 393ece9ec54460e7f01e6241f5d806128167f5ea (patch) | |
tree | 95d5afd7049daf4d2b9155139b87344ee6350590 /src/main/java/net/minecraft/server/PlayerConnection.java | |
parent | 826643c606061a9ee6c5dc7b17aac16c2e1bab56 (diff) | |
download | craftbukkit-393ece9ec54460e7f01e6241f5d806128167f5ea.tar craftbukkit-393ece9ec54460e7f01e6241f5d806128167f5ea.tar.gz craftbukkit-393ece9ec54460e7f01e6241f5d806128167f5ea.tar.lz craftbukkit-393ece9ec54460e7f01e6241f5d806128167f5ea.tar.xz craftbukkit-393ece9ec54460e7f01e6241f5d806128167f5ea.zip |
Readd diff missed in the 1.7 update.
Diffstat (limited to 'src/main/java/net/minecraft/server/PlayerConnection.java')
-rw-r--r-- | src/main/java/net/minecraft/server/PlayerConnection.java | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index 3b378faf..3e8517c6 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -836,8 +836,28 @@ public class PlayerConnection implements PacketPlayInListener { // CraftBukkit start - replaced with thread safe throttle // this.chatThrottle += 20; if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { + if (packetplayinchat.a()) { + Waitable waitable = new Waitable() { + @Override + protected Object evaluate() { + PlayerConnection.this.disconnect("disconnect.spam"); + return null; + } + }; + + this.minecraftServer.processQueue.add(waitable); + + try { + waitable.get(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + throw new RuntimeException(e); + } + } else { + this.disconnect("disconnect.spam"); + } // CraftBukkit end - this.disconnect("disconnect.spam"); } } } @@ -1645,7 +1665,7 @@ public class PlayerConnection implements PacketPlayInListener { CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit } // CraftBukkit start - } catch (Exception exception) { + } catch (Throwable exception) { c.error("Couldn\'t handle book info", exception); this.disconnect("Invalid book data!"); // CraftBukkit end @@ -1662,7 +1682,7 @@ public class PlayerConnection implements PacketPlayInListener { CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit } // CraftBukkit start - } catch (Exception exception1) { + } catch (Throwable exception1) { c.error("Couldn\'t sign book", exception1); this.disconnect("Invalid book data!"); // CraftBukkit end @@ -1680,8 +1700,8 @@ public class PlayerConnection implements PacketPlayInListener { if (container instanceof ContainerMerchant) { ((ContainerMerchant) container).e(i); } - } catch (Exception exception2) { // CraftBukkit start + } catch (Throwable exception2) { c.error("Couldn\'t select trade", exception2); this.disconnect("Invalid trade data!"); // CraftBukkit end @@ -1716,8 +1736,8 @@ public class PlayerConnection implements PacketPlayInListener { commandblocklistenerabstract.e(); this.player.sendMessage(new ChatMessage("advMode.setCommand.success", new Object[] { s})); } - } catch (Exception exception3) { // CraftBukkit start + } catch (Throwable exception3) { c.error("Couldn\'t set command block", exception3); this.disconnect("Invalid CommandBlock data!"); // CraftBukkit end @@ -1742,8 +1762,8 @@ public class PlayerConnection implements PacketPlayInListener { tileentitybeacon.e(j); tileentitybeacon.update(); } - } catch (Exception exception4) { // CraftBukkit start + } catch (Throwable exception4) { c.error("Couldn\'t set beacon", exception4); this.disconnect("Invalid beacon data!"); // CraftBukkit end |