From 2a225b9169ccae9e938a784461eeb7fd1df0344e Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Thu, 13 Mar 2025 08:16:32 +0700 Subject: [PATCH] fix: `*music playitem` on 1.21.4 (finally) --- build-number.txt | 2 +- .../me/chayapak1/chomens_bot/commands/MusicCommand.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/build-number.txt b/build-number.txt index 84a3f856..e5aa8385 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -1774 \ No newline at end of file +1776 \ No newline at end of file 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 ba80f83d..50e07768 100644 --- a/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java +++ b/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java @@ -10,7 +10,6 @@ import me.chayapak1.chomens_bot.song.Song; import me.chayapak1.chomens_bot.util.ColorUtilities; import me.chayapak1.chomens_bot.util.PathUtilities; import me.chayapak1.chomens_bot.util.TimestampUtilities; -import me.chayapak1.chomens_bot.util.UUIDUtilities; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.JoinConfiguration; import net.kyori.adventure.text.event.ClickEvent; @@ -114,7 +113,7 @@ public class MusicCommand extends Command { final String[] pathSplitted = _path.split(separator); final List pathSplittedClone = new ArrayList<>(Arrays.stream(pathSplitted.clone()).toList()); - pathSplittedClone.remove(pathSplittedClone.size() - 1); + pathSplittedClone.removeLast(); final Path realPath = Path.of(root.toString(), String.join(separator, pathSplittedClone)); @@ -185,13 +184,13 @@ public class MusicCommand extends Command { final CompletableFuture future = bot.query.entity( context.sender.profile.getIdAsString(), - "SelectedItem.tag.SongItemData.SongData" + "SelectedItem.components.minecraft:custom_data.SongItemData.SongData" ); future.thenApplyAsync(output -> { if (output == null) { - context.sendOutput(Component.text("Player has no `SongItemData.SongData` NBT tag in their selected item").color(NamedTextColor.RED)); - return output; + context.sendOutput(Component.text("Player has no `SongItemData.SongData` NBT tag in their selected item's minecraft:custom_data").color(NamedTextColor.RED)); + return null; } try {