colorful itemdump

This commit is contained in:
Jake Potrebic 2020-12-07 18:10:22 -08:00 committed by Mariell
parent f3ba3dee05
commit d075e748ed
1 changed files with 14 additions and 2 deletions

View File

@ -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 a12bc81933c15606b7cde46937f504eafc4ff030..d798de637389cc5d5289a6c75304de307b01f493 100644
index f60800c3bc06a38493e17b00b815f18cb87cc8bf..196648e65c6f58c18e19623474d69d780d542689 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -21,7 +21,9 @@ import org.bukkit.command.CommandSender;
@ -55,7 +55,7 @@ index a12bc81933c15606b7cde46937f504eafc4ff030..d798de637389cc5d5289a6c75304de30
+ net.minecraft.server.ItemStack itemStack = CraftItemStack.asNMSCopy(itemInHand);
+ NBTTagCompound tag = itemStack.getTag();
+ if (tag != null) {
+ String nbt = tag.toString();
+ String nbt = org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(tag.getNbtPrettyComponent());
+ Bukkit.getConsoleSender().sendMessage(nbt);
+ sender.sendMessage(nbt);
+ } else {
@ -66,3 +66,15 @@ index a12bc81933c15606b7cde46937f504eafc4ff030..d798de637389cc5d5289a6c75304de30
private void doFixLight(CommandSender sender, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can use this command");
diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java
index 8b9e47b4c7f5dc464fa617a59583df9e30a54045..104b820ee380083ec755c443a4a9c270e525ca45 100644
--- a/src/main/java/net/minecraft/server/NBTBase.java
+++ b/src/main/java/net/minecraft/server/NBTBase.java
@@ -24,6 +24,7 @@ public interface NBTBase {
return this.toString();
}
+ default IChatBaseComponent getNbtPrettyComponent() { return this.l(); } // Paper - OBFHELPER
default IChatBaseComponent l() {
return this.a("", 0);
}