mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-09-27 13:22:34 +02:00
Merge pull request #3115 from i509VCB/fix/proxiedcommands
[Fabric] Make it so dynmap commands can be proxied via `/execute` without failing to parse.
This commit is contained in:
commit
312f2e3c4d
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,11 +24,13 @@
|
||||
/bin
|
||||
/dist
|
||||
/manifest.mf
|
||||
/run
|
||||
|
||||
# Mac filesystem dust
|
||||
/.DS_Store
|
||||
/dependency-reduced-pom.xml
|
||||
|
||||
*.log
|
||||
/.gradle
|
||||
/fabric-1.16.1_client.launch
|
||||
/fabric-1.16.1_server.launch
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user