check if sender is a player in paper dumpitem command, closes #5858

This commit is contained in:
MiniDigger | Martin 2021-06-17 20:13:55 +02:00
parent a59f42457c
commit a716afea03

View File

@ -51,6 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Paper config reload complete.");
}
+ private void doDumpItem(CommandSender sender) {
+ if (!(sender instanceof Player)) {
+ sender.sendMessage("Only players can use this command");
+ return;
+ }
+ ItemStack itemInHand = ((CraftPlayer) sender).getItemInHand();
+ net.minecraft.world.item.ItemStack itemStack = CraftItemStack.asNMSCopy(itemInHand);
+ net.minecraft.nbt.CompoundTag tag = itemStack.getTag();