mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
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:
@@ -62,6 +62,8 @@ public class ClearCommand extends VanillaCommand {
|
|||||||
int count = player.getInventory().clear(id, data);
|
int count = player.getInventory().clear(id, data);
|
||||||
|
|
||||||
Command.broadcastCommandMessage(sender, "Cleared the inventory of " + player.getDisplayName() + ", removing " + count + " items");
|
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 {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't find player " + args[0]);
|
sender.sendMessage(ChatColor.RED + "Can't find player " + args[0]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user