summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/net/minecraft/server/PlayerConnection.java32
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