Don't try listing something that may not exist. Fixes BUKKIT-3471

The player name may not be provided, in which case the command will
fail hard.

By: feildmaster <admin@feildmaster.com>
This commit is contained in:
Bukkit/Spigot 2013-01-23 05:51:46 -06:00
parent 8065c9095a
commit 8dc70a4e98

View file

@ -62,6 +62,8 @@ public class ClearCommand extends VanillaCommand {
int count = player.getInventory().clear(id, data);
Command.broadcastCommandMessage(sender, "Cleared the inventory of " + player.getDisplayName() + ", removing " + count + " items");
} else if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Please provide a player!");
} else {
sender.sendMessage(ChatColor.RED + "Can't find player " + args[0]);
}