weird bug not fixed and i have no idea why it happen
This commit is contained in:
parent
48f8013767
commit
54cf9a9a68
1 changed files with 7 additions and 3 deletions
|
@ -95,14 +95,18 @@ public class MusicCommand implements Command {
|
||||||
public Component play (CommandContext context, String[] args) {
|
public Component play (CommandContext context, String[] args) {
|
||||||
final MusicPlayerPlugin player = context.bot().music();
|
final MusicPlayerPlugin player = context.bot().music();
|
||||||
|
|
||||||
final String _path = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
String _path;
|
||||||
final Path path = Path.of(root.toString(), _path);
|
Path path;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
_path = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
path = Path.of(root.toString(), _path);
|
||||||
|
|
||||||
if (!path.toString().contains("http")) player.loadSong(path);
|
if (!path.toString().contains("http")) player.loadSong(path);
|
||||||
else player.loadSong(new URL(_path));
|
else player.loadSong(new URL(_path));
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
return Component.text("Invalid URL").color(NamedTextColor.RED);
|
return Component.text("Invalid URL").color(NamedTextColor.RED);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Component.text(e.toString()).color(NamedTextColor.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Component.text("success");
|
return Component.text("success");
|
||||||
|
|
Loading…
Reference in a new issue