diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-18 16:25:56 +0000 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-18 16:25:56 +0000 |
commit | a5ca3e1c1217c0c8bc749c406f09ed0c58ac84f8 (patch) | |
tree | 98d3b81483022c0e7e6cdb0628eb4e9d7432e9ef /src/main/java/net/minecraft/server | |
parent | e544fb71c3c28464fd15607b8a2cb78c0e81b930 (diff) | |
download | craftbukkit-a5ca3e1c1217c0c8bc749c406f09ed0c58ac84f8.tar craftbukkit-a5ca3e1c1217c0c8bc749c406f09ed0c58ac84f8.tar.gz craftbukkit-a5ca3e1c1217c0c8bc749c406f09ed0c58ac84f8.tar.lz craftbukkit-a5ca3e1c1217c0c8bc749c406f09ed0c58ac84f8.tar.xz craftbukkit-a5ca3e1c1217c0c8bc749c406f09ed0c58ac84f8.zip |
Don't kick players if a command failed from an exception
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index c73e75a2..bca70f50 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -3,12 +3,15 @@ package net.minecraft.server; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; // CraftBukkit start +import org.bukkit.ChatColor; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockDamageLevel; import org.bukkit.Location; +import org.bukkit.command.CommandException; import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.entity.CraftPlayer; @@ -624,8 +627,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener { if (event.isCancelled()) { return; } - - boolean targetPluginFound = server.dispatchCommand(player, s.substring(1)); + + boolean targetPluginFound = false; + + try { + targetPluginFound = server.dispatchCommand(player, s.substring(1)); + } catch (CommandException ex) { + player.sendMessage(ChatColor.RED + "An internal error occured while attempting to perform this command"); + Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, null, ex); + return; + } + if (targetPluginFound) { return; } |