Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed null exception on bkill command

  • Loading branch information...
commit 83d6abfef5d47aabc0d5be06d00f30b2734b2bbe 1 parent 2f4798d
Bradley Jewell authored
36  src/com/bradsproject/com/bradsproject/BradleyJewell/bMobs/bMobs.java
@@ -314,22 +314,30 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
314 314
 				player.sendMessage("You do not have permission to use that command.");
315 315
 				return false;
316 316
 			}
317  
-			if(args[0].equalsIgnoreCase("monsters") || args[0].equalsIgnoreCase("mobs"))
318  
-			{
319  
-				kill(player.getWorld(), "monsters");
320  
-				player.sendMessage("All monsters have been killed!");
321  
-				return true;
322  
-			}
323  
-			else if(args[0].equalsIgnoreCase("animals"))
324  
-			{
325  
-				kill(player.getWorld(), "animals");
326  
-				player.sendMessage("All animals have been killed!");
327  
-				return true;
  317
+			try {
  318
+				if(args[0].equalsIgnoreCase("monsters") || args[0].equalsIgnoreCase("mobs"))
  319
+				{
  320
+					kill(player.getWorld(), "monsters");
  321
+					player.sendMessage("All monsters have been killed!");
  322
+					return true;
  323
+				}
  324
+				else if(args[0].equalsIgnoreCase("animals"))
  325
+				{
  326
+					kill(player.getWorld(), "animals");
  327
+					player.sendMessage("All animals have been killed!");
  328
+					return true;
  329
+				}
  330
+				else if(args[0].equalsIgnoreCase("all"))
  331
+				{
  332
+					kill(player.getWorld(), "all");
  333
+					player.sendMessage("All creatures have been killed!");
  334
+					return true;
  335
+				}
328 336
 			}
329  
-			else if(args[0].equalsIgnoreCase("all"))
  337
+			catch(NullPointerException e)
330 338
 			{
331  
-				kill(player.getWorld(), "all");
332  
-				player.sendMessage("All creatures have been killed!");
  339
+				kill(player.getWorld(), "monsters");
  340
+				player.sendMessage("All monsters have been killed! (e)");
333 341
 				return true;
334 342
 			}
335 343
 		}

0 notes on commit 83d6abf

Please sign in to comment.
Something went wrong with that request. Please try again.