From 2cbdb174b7315fe1749014ec98158d65cc6f8425 Mon Sep 17 00:00:00 2001 From: MiniDigger Date: Thu, 17 Jun 2021 20:13:55 +0200 Subject: [PATCH] check if sender is a player in paper dumpitem command, closes #5858 --- patches/server/0470-Paper-dumpitem-command.patch | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/patches/server/0470-Paper-dumpitem-command.patch b/patches/server/0470-Paper-dumpitem-command.patch index 22793d8271..76a52b98a8 100644 --- a/patches/server/0470-Paper-dumpitem-command.patch +++ b/patches/server/0470-Paper-dumpitem-command.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Paper dumpitem command Let's you quickly view the item in your hands NBT data diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index de45163023f436d386e90e6ded5e6105ba3ecf35..8fdfcf001cf2ed6184d86ee033ede08fdf9aa5d6 100644 +index de45163023f436d386e90e6ded5e6105ba3ecf35..160f3cdee21d8a3aa2ed726a7fbfce460dff26f3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -20,6 +20,7 @@ import net.minecraft.server.level.ServerPlayer; @@ -46,11 +46,15 @@ index de45163023f436d386e90e6ded5e6105ba3ecf35..8fdfcf001cf2ed6184d86ee033ede08f case "debug": doDebug(sender, args); break; -@@ -466,6 +472,19 @@ public class PaperCommand extends Command { +@@ -466,6 +472,23 @@ public class PaperCommand extends Command { 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();