check if sender is a player in paper dumpitem command, closes #5858
This commit is contained in:
parent
d04c22dddf
commit
2cbdb174b7
1 changed files with 6 additions and 2 deletions
|
@ -6,7 +6,7 @@ Subject: [PATCH] Paper dumpitem command
|
||||||
Let's you quickly view the item in your hands NBT data
|
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
|
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
|
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||||
+++ b/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;
|
@@ -20,6 +20,7 @@ import net.minecraft.server.level.ServerPlayer;
|
||||||
|
@ -46,11 +46,15 @@ index de45163023f436d386e90e6ded5e6105ba3ecf35..8fdfcf001cf2ed6184d86ee033ede08f
|
||||||
case "debug":
|
case "debug":
|
||||||
doDebug(sender, args);
|
doDebug(sender, args);
|
||||||
break;
|
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.");
|
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Paper config reload complete.");
|
||||||
}
|
}
|
||||||
+ private void doDumpItem(CommandSender sender) {
|
+ private void doDumpItem(CommandSender sender) {
|
||||||
|
+ if (!(sender instanceof Player)) {
|
||||||
|
+ sender.sendMessage("Only players can use this command");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
+ ItemStack itemInHand = ((CraftPlayer) sender).getItemInHand();
|
+ ItemStack itemInHand = ((CraftPlayer) sender).getItemInHand();
|
||||||
+ net.minecraft.world.item.ItemStack itemStack = CraftItemStack.asNMSCopy(itemInHand);
|
+ net.minecraft.world.item.ItemStack itemStack = CraftItemStack.asNMSCopy(itemInHand);
|
||||||
+ net.minecraft.nbt.CompoundTag tag = itemStack.getTag();
|
+ net.minecraft.nbt.CompoundTag tag = itemStack.getTag();
|
||||||
|
|
Loading…
Reference in a new issue