Make it so dynmap commands can be proxied via `/execute` without failing to parse.

Also adds some gitignore entries for stuff generated by fabric
This commit is contained in:
i509VCB 2020-08-31 19:14:22 -05:00
parent 11388de37d
commit 47b75694d8
3 changed files with 16 additions and 2 deletions

2
.gitignore vendored
View File

@ -24,9 +24,11 @@
/bin
/dist
/manifest.mf
/run
# Mac filesystem dust
/.DS_Store
/dependency-reduced-pom.xml
*.log
/.gradle

View File

@ -45,7 +45,13 @@ public class DynmapCommandExecutor implements Command<ServerCommandSource> {
@Override
public int run(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
String[] args = context.getInput().split("\\s+");
// Commands in brigadier may be proxied in Minecraft via a syntax like `/execute ... ... run dmap [args]`
// Dynmap will fail to parse this properly, so we find the starting position of the actual command being parsed after any forks or redirects.
// The start position of the range specifies where the actual command dynmap has registered starts
int start = context.getRange().getStart();
String dynmapInput = context.getInput().substring(start);
String[] args = dynmapInput.split("\\s+");
plugin.handleCommand(context.getSource(), cmd, Arrays.copyOfRange(args, 1, args.length));
return 1;
}

View File

@ -45,7 +45,13 @@ public class DynmapCommandExecutor implements Command<ServerCommandSource> {
@Override
public int run(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
String[] args = context.getInput().split("\\s+");
// Commands in brigadier may be proxied in Minecraft via a syntax like `/execute ... ... run dmap [args]`
// Dynmap will fail to parse this properly, so we find the starting position of the actual command being parsed after any forks or redirects.
// The start position of the range specifies where the actual command dynmap has registered starts
int start = context.getRange().getStart();
String dynmapInput = context.getInput().substring(start);
String[] args = dynmapInput.split("\\s+");
plugin.handleCommand(context.getSource(), cmd, Arrays.copyOfRange(args, 1, args.length));
return 1;
}