2013-02-26 18:21:40 +01:00
|
|
|
From f79f9c8a4b8dea443b5477c742d76f4ca8a780bb Mon Sep 17 00:00:00 2001
|
2013-02-24 07:28:42 +01:00
|
|
|
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
|
2013-02-26 18:21:40 +01:00
|
|
|
index d2c2305..b960a87 100644
|
2013-02-24 07:28:42 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2013-02-26 18:21:40 +01:00
|
|
|
@@ -1481,6 +1481,7 @@ public class PlayerConnection extends Connection {
|
2013-02-24 07:28:42 +01:00
|
|
|
}
|
|
|
|
} catch (Exception exception) {
|
|
|
|
exception.printStackTrace();
|
|
|
|
+ this.disconnect("Invalid book data!"); // CraftBukkit - prevent exception spam
|
|
|
|
}
|
|
|
|
} else if ("MC|BSign".equals(packet250custompayload.tag)) {
|
|
|
|
try {
|
2013-02-26 18:21:40 +01:00
|
|
|
@@ -1498,9 +1499,8 @@ public class PlayerConnection extends Connection {
|
2013-02-24 07:28:42 +01:00
|
|
|
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;
|
2013-02-26 18:21:40 +01:00
|
|
|
@@ -1516,6 +1516,7 @@ public class PlayerConnection extends Connection {
|
2013-02-24 07:28:42 +01:00
|
|
|
}
|
|
|
|
} catch (Exception exception2) {
|
|
|
|
exception2.printStackTrace();
|
|
|
|
+ this.disconnect("Invalid trade data!"); // CraftBukkit - prevent exception spam
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int j;
|
2013-02-26 18:21:40 +01:00
|
|
|
@@ -1539,6 +1540,7 @@ public class PlayerConnection extends Connection {
|
2013-02-24 07:28:42 +01:00
|
|
|
}
|
|
|
|
} 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]));
|
2013-02-26 18:21:40 +01:00
|
|
|
@@ -1562,6 +1564,7 @@ public class PlayerConnection extends Connection {
|
2013-02-24 07:28:42 +01:00
|
|
|
}
|
|
|
|
} 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) {
|
2013-02-26 18:21:40 +01:00
|
|
|
@@ -1586,6 +1589,7 @@ public class PlayerConnection extends Connection {
|
2013-02-24 07:28:42 +01:00
|
|
|
}
|
|
|
|
} 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 {
|
2013-02-26 18:21:40 +01:00
|
|
|
@@ -1595,6 +1599,7 @@ public class PlayerConnection extends Connection {
|
2013-02-24 07:28:42 +01:00
|
|
|
}
|
|
|
|
} 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);
|
|
|
|
--
|
2013-02-26 18:21:40 +01:00
|
|
|
1.8.1.1
|
2013-02-24 07:28:42 +01:00
|
|
|
|