From f96b9f068863f430e221195ebd23ebc8c3fa194f Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 19 Oct 2024 14:14:18 +0700 Subject: [PATCH] 1.20.4 *music playitem support (no 1.21 because kaboom and the friends are still on 1.20.4) --- .../chomens_bot/commands/MusicCommand.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java b/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java index 984c9f1..7973e8b 100644 --- a/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java +++ b/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java @@ -204,7 +204,7 @@ public class MusicCommand extends Command { final CompletableFuture future = bot.core.runTracked( "minecraft:data get entity " + UUIDUtilities.selector(context.sender.profile.getId()) + - " SelectedItem.tag.data" + " SelectedItem.tag.SongItemData.SongData" ); if (future == null) { @@ -216,16 +216,17 @@ public class MusicCommand extends Command { if ( !children.isEmpty() && - !children.get(0).children().isEmpty() && - ((TranslatableComponent) children.get(0).children().get(0)) - .key() + children.get(0).children().isEmpty() && + ((TranslatableComponent) children.get(0)).key() .equals("arguments.nbtpath.nothing_found") ) { - context.sendOutput(Component.text("Player has no `data` NBT tag in the selected item").color(NamedTextColor.RED)); + context.sendOutput(Component.text("Player has no `SongItemData.SongData` NBT tag in their selected item").color(NamedTextColor.RED)); return output; } - final String value = ComponentUtilities.stringify(((TranslatableComponent) children.get(0)).arguments().get(1).asComponent()); + final Component actualOutputComponent = ((TranslatableComponent) output).arguments().get(1).asComponent(); + + final String value = ComponentUtilities.stringify(actualOutputComponent); if (!value.startsWith("\"") && !value.endsWith("\"") && !value.startsWith("'") && !value.endsWith("'")) { context.sendOutput(Component.text("`data` NBT is not a string").color(NamedTextColor.RED));