diff options
author | Eimref <me@eimref.com> | 2013-02-06 18:59:07 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2013-03-02 15:57:00 -0600 |
commit | cf7dfeda628a1e1f99a498a28390920c2cef64d0 (patch) | |
tree | e85cc36643129ec108060fe18c33d4139a7d45a0 /src/main/java/net/minecraft/server/PlayerConnection.java | |
parent | f6c574dd04fb6c39510a0428e7effafc37093028 (diff) | |
download | craftbukkit-cf7dfeda628a1e1f99a498a28390920c2cef64d0.tar craftbukkit-cf7dfeda628a1e1f99a498a28390920c2cef64d0.tar.gz craftbukkit-cf7dfeda628a1e1f99a498a28390920c2cef64d0.tar.lz craftbukkit-cf7dfeda628a1e1f99a498a28390920c2cef64d0.tar.xz craftbukkit-cf7dfeda628a1e1f99a498a28390920c2cef64d0.zip |
Add proper logging for custom channel exceptions.
Diffstat (limited to 'src/main/java/net/minecraft/server/PlayerConnection.java')
-rw-r--r-- | src/main/java/net/minecraft/server/PlayerConnection.java | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index fac9ea5e..81041626 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -1463,7 +1463,10 @@ public class PlayerConnection extends Connection { itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages")); } } catch (Exception exception) { - exception.printStackTrace(); + // CraftBukkit start + logger.log(Level.WARNING, this.player.name + " sent invalid MC|BEdit data", exception); + this.disconnect("Invalid book data!"); + // CraftBukkit end } } else if ("MC|BSign".equals(packet250custompayload.tag)) { try { @@ -1482,7 +1485,8 @@ public class PlayerConnection extends Connection { } } catch (Exception exception1) { // CraftBukkit start - // exception1.printStackTrace(); + logger.log(Level.WARNING, this.player.name + " sent invalid MC|BSign data", exception); + this.disconnect("Invalid book data!"); // CraftBukkit end } } else { @@ -1498,7 +1502,10 @@ public class PlayerConnection extends Connection { ((ContainerMerchant) container).b(i); } } catch (Exception exception2) { - exception2.printStackTrace(); + // CraftBukkit start + logger.log(Level.WARNING, this.player.name + " sent invalid MC|TrSel data", exception); + this.disconnect("Invalid trade data!"); + // CraftBukkit end } } else { int j; @@ -1521,7 +1528,10 @@ public class PlayerConnection extends Connection { this.player.sendMessage("Command set: " + s); } } catch (Exception exception3) { - exception3.printStackTrace(); + // CraftBukkit start + logger.log(Level.WARNING, this.player.name + " sent invalid MC|AdvCdm data", exception); + this.disconnect("Invalid CommandBlock data!"); + // CraftBukkit end } } else { this.player.sendMessage(this.player.a("advMode.notAllowed", new Object[0])); @@ -1544,7 +1554,10 @@ public class PlayerConnection extends Connection { tileentitybeacon.update(); } } catch (Exception exception4) { - exception4.printStackTrace(); + // CraftBukkit start + logger.log(Level.WARNING, this.player.name + " sent invalid MC|Beacon data", exception); + this.disconnect("Invalid beacon data!"); + // CraftBukkit end } } } else if ("MC|ItemName".equals(packet250custompayload.tag) && this.player.activeContainer instanceof ContainerAnvil) { @@ -1568,7 +1581,7 @@ public class PlayerConnection extends Connection { getPlayer().addChannel(channel); } } catch (UnsupportedEncodingException ex) { - Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, "Could not parse REGISTER payload in plugin message packet", ex); + throw new AssertionError(ex); } } else if (packet250custompayload.tag.equals("UNREGISTER")) { try { @@ -1577,7 +1590,7 @@ public class PlayerConnection extends Connection { getPlayer().removeChannel(channel); } } catch (UnsupportedEncodingException ex) { - Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, "Could not parse UNREGISTER payload in plugin message packet", ex); + throw new AssertionError(ex); } } else { server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet250custompayload.tag, packet250custompayload.data); |