From 10ca2e4e06f0ab736579aac6d047a2332041188b Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+chomens@users.noreply.github.com> Date: Sun, 3 Nov 2024 14:05:35 +0700 Subject: [PATCH] feat: allow path outside bot dir for funnies --- .../chipmunkbot/command/arguments/LocationArgumentType.java | 2 +- .../land/chipmunk/chipmunkbot/commands/MusicCommand.java | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkbot/command/arguments/LocationArgumentType.java b/src/main/java/land/chipmunk/chipmunkbot/command/arguments/LocationArgumentType.java index e6578b2..3b97f42 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/command/arguments/LocationArgumentType.java +++ b/src/main/java/land/chipmunk/chipmunkbot/command/arguments/LocationArgumentType.java @@ -58,7 +58,7 @@ public class LocationArgumentType implements ArgumentType { public Path parsePath (StringReader reader) throws CommandSyntaxException { final String pathString = reader.readString(); final Path path = Path.of(root.toString(), pathString).toAbsolutePath().normalize(); - if (!path.startsWith(root)) throw OOB_FILEPATH.create(); + // if (!path.startsWith(root)) throw OOB_FILEPATH.create(); for the funnies return path; } diff --git a/src/main/java/land/chipmunk/chipmunkbot/commands/MusicCommand.java b/src/main/java/land/chipmunk/chipmunkbot/commands/MusicCommand.java index 7cbd462..e70f4f6 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/commands/MusicCommand.java +++ b/src/main/java/land/chipmunk/chipmunkbot/commands/MusicCommand.java @@ -99,10 +99,7 @@ public class MusicCommand { final Path path = getPath(context, "location"); if (path != null) songPlayer.loadSong(path); - else { - source.sendOutput(Component.text("no").color(NamedTextColor.RED)); - // songPlayer.loadSong(getUrl(context, "location")); - } + else songPlayer.loadSong(getUrl(context, "location")); return 1; }