summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-12-04 22:06:03 +0100
committersnowleo <schneeleo@gmail.com>2011-12-04 22:06:03 +0100
commitec3586c08c3462b4d6d1ed6b71115c55ddd8e61d (patch)
tree6d2e207d322b1dc75135ee9e34a7c34996ebc895
parentd9c773270bf66e0c95cad36fa1102d7af1fdfa77 (diff)
downloadEssentials-ec3586c08c3462b4d6d1ed6b71115c55ddd8e61d.tar
Essentials-ec3586c08c3462b4d6d1ed6b71115c55ddd8e61d.tar.gz
Essentials-ec3586c08c3462b4d6d1ed6b71115c55ddd8e61d.tar.lz
Essentials-ec3586c08c3462b4d6d1ed6b71115c55ddd8e61d.tar.xz
Essentials-ec3586c08c3462b4d6d1ed6b71115c55ddd8e61d.zip
Added null check to /break
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbreak.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java
index 48c19e9e7..9c0a34698 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java
@@ -18,13 +18,17 @@ public class Commandbreak extends EssentialsCommand
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
final Block block = user.getTargetBlock(null, 20);
+ if (block == null)
+ {
+ throw new NoChargeException();
+ }
if (block.getType() == Material.AIR)
{
throw new NoChargeException();
}
if (block.getType() == Material.BEDROCK && !user.isAuthorized("essentials.break.bedrock"))
{
- throw new NoChargeException();
+ throw new Exception("You are not allowed to destroy bedrock."); //TODO: Translation
}
final BlockBreakEvent event = new BlockBreakEvent(block, user);
server.getPluginManager().callEvent(event);