forked from chipmunkmc/chipmunkbot
feat: allow path outside bot dir for funnies
This commit is contained in:
parent
0fcc68c7a2
commit
10ca2e4e06
2 changed files with 2 additions and 5 deletions
|
@ -58,7 +58,7 @@ public class LocationArgumentType implements ArgumentType<Object> {
|
||||||
public Path parsePath (StringReader reader) throws CommandSyntaxException {
|
public Path parsePath (StringReader reader) throws CommandSyntaxException {
|
||||||
final String pathString = reader.readString();
|
final String pathString = reader.readString();
|
||||||
final Path path = Path.of(root.toString(), pathString).toAbsolutePath().normalize();
|
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;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,10 +99,7 @@ public class MusicCommand {
|
||||||
final Path path = getPath(context, "location");
|
final Path path = getPath(context, "location");
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue