testserver/CraftBukkit-Patches/0030-Kick-player-on-excepti...

78 lines
4.0 KiB
Diff

From f79f9c8a4b8dea443b5477c742d76f4ca8a780bb Mon Sep 17 00:00:00 2001
From: Eimref <me@eimref.com>
Date: Wed, 6 Feb 2013 18:59:07 -0500
Subject: [PATCH] Kick player on exception for built-in PluginChannels; Fixes
BUKKIT-3583
---
src/main/java/net/minecraft/server/PlayerConnection.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d2c2305..b960a87 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1481,6 +1481,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception) {
exception.printStackTrace();
+ this.disconnect("Invalid book data!"); // CraftBukkit - prevent exception spam
}
} else if ("MC|BSign".equals(packet250custompayload.tag)) {
try {
@@ -1498,9 +1499,8 @@ public class PlayerConnection extends Connection {
itemstack1.id = Item.WRITTEN_BOOK.id;
}
} catch (Exception exception1) {
- // CraftBukkit start
- // exception1.printStackTrace();
- // CraftBukkit end
+ exception1.printStackTrace();
+ this.disconnect("Invalid book data!"); // CraftBukkit - prevent exception spam
}
} else {
int i;
@@ -1516,6 +1516,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception2) {
exception2.printStackTrace();
+ this.disconnect("Invalid trade data!"); // CraftBukkit - prevent exception spam
}
} else {
int j;
@@ -1539,6 +1540,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception3) {
exception3.printStackTrace();
+ this.disconnect("Invalid CommandBlock data!"); // CraftBukkit - prevent exception spam
}
} else {
this.player.sendMessage(this.player.a("advMode.notAllowed", new Object[0]));
@@ -1562,6 +1564,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception4) {
exception4.printStackTrace();
+ this.disconnect("Invalid beacon data!"); // CraftBukkit - prevent exception spam
}
}
} else if ("MC|ItemName".equals(packet250custompayload.tag) && this.player.activeContainer instanceof ContainerAnvil) {
@@ -1586,6 +1589,7 @@ public class PlayerConnection extends Connection {
}
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, "Could not parse REGISTER payload in plugin message packet", ex);
+ throw new AssertionError("UTF-8 is an unknown encoding");
}
} else if (packet250custompayload.tag.equals("UNREGISTER")) {
try {
@@ -1595,6 +1599,7 @@ public class PlayerConnection extends Connection {
}
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, "Could not parse UNREGISTER payload in plugin message packet", ex);
+ throw new AssertionError("UTF-8 is an unknown encoding");
}
} else {
server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet250custompayload.tag, packet250custompayload.data);
--
1.8.1.1