This commit is contained in:
Chayapak 2023-08-28 17:06:11 +07:00
parent 11ed0c5eb1
commit 8d81084f8d

View file

@ -13,6 +13,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.JoinConfiguration; import net.kyori.adventure.text.JoinConfiguration;
import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.text.format.TextColor;
import java.io.File; import java.io.File;
@ -92,13 +93,17 @@ public class MusicCommand {
} }
public int play (CommandContext<CommandSource> context) { public int play (CommandContext<CommandSource> context) {
final SongPlayer songPlayer = context.getSource().client().songPlayer(); final CommandSource source = context.getSource();
final SongPlayer songPlayer = source.client().songPlayer();
final Path path = getPath(context, "location"); final Path path = getPath(context, "location");
songPlayer.loadSong(path); if (path != null) songPlayer.loadSong(path);
// if (path != null) songPlayer.loadSong(path); else {
// else songPlayer.loadSong(getUrl(context, "location")); source.sendOutput(Component.text("no").color(NamedTextColor.RED));
// songPlayer.loadSong(getUrl(context, "location"));
}
return 1; return 1;
} }