From 5c2df611fe96416b4d0954c63b05985ff6166a79 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 4 Dec 2011 22:06:03 +0100 Subject: Added null check to /break --- Essentials/src/com/earth2me/essentials/commands/Commandbreak.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3