forked from ChomeNS/chomens-bot-java
1.20.4 *music playitem support (no 1.21 because kaboom and the friends are still on 1.20.4)
This commit is contained in:
parent
a5f9323937
commit
f96b9f0688
1 changed files with 7 additions and 6 deletions
|
@ -204,7 +204,7 @@ public class MusicCommand extends Command {
|
||||||
final CompletableFuture<Component> future = bot.core.runTracked(
|
final CompletableFuture<Component> future = bot.core.runTracked(
|
||||||
"minecraft:data get entity " +
|
"minecraft:data get entity " +
|
||||||
UUIDUtilities.selector(context.sender.profile.getId()) +
|
UUIDUtilities.selector(context.sender.profile.getId()) +
|
||||||
" SelectedItem.tag.data"
|
" SelectedItem.tag.SongItemData.SongData"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (future == null) {
|
if (future == null) {
|
||||||
|
@ -216,16 +216,17 @@ public class MusicCommand extends Command {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!children.isEmpty() &&
|
!children.isEmpty() &&
|
||||||
!children.get(0).children().isEmpty() &&
|
children.get(0).children().isEmpty() &&
|
||||||
((TranslatableComponent) children.get(0).children().get(0))
|
((TranslatableComponent) children.get(0)).key()
|
||||||
.key()
|
|
||||||
.equals("arguments.nbtpath.nothing_found")
|
.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;
|
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("'")) {
|
if (!value.startsWith("\"") && !value.endsWith("\"") && !value.startsWith("'") && !value.endsWith("'")) {
|
||||||
context.sendOutput(Component.text("`data` NBT is not a string").color(NamedTextColor.RED));
|
context.sendOutput(Component.text("`data` NBT is not a string").color(NamedTextColor.RED));
|
||||||
|
|
Loading…
Reference in a new issue