mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-26 08:51:47 +01:00
Fix: Extension command arg parsing (#5081)
* Fix: No args being parsed as 1 arg, and don't try to localize extension command's descriptions * add comment
This commit is contained in:
parent
50de9d6867
commit
d64c0b38da
1 changed files with 8 additions and 1 deletions
|
@ -38,6 +38,7 @@ import org.geysermc.geyser.command.GeyserCommandSource;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.incendo.cloud.CommandManager;
|
import org.incendo.cloud.CommandManager;
|
||||||
import org.incendo.cloud.context.CommandContext;
|
import org.incendo.cloud.context.CommandContext;
|
||||||
|
import org.incendo.cloud.description.CommandDescription;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -193,11 +194,17 @@ public abstract class GeyserExtensionCommand extends GeyserCommand {
|
||||||
.handler(this::execute));
|
.handler(this::execute));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected org.incendo.cloud.Command.Builder.Applicable<GeyserCommandSource> meta() {
|
||||||
|
// We don't want to localize the extension command description
|
||||||
|
return builder -> builder.commandDescription(CommandDescription.commandDescription(description));
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandContext<GeyserCommandSource> context) {
|
public void execute(CommandContext<GeyserCommandSource> context) {
|
||||||
GeyserCommandSource source = context.sender();
|
GeyserCommandSource source = context.sender();
|
||||||
String[] args = context.getOrDefault("args", "").split(" ");
|
String[] args = context.getOrDefault("args", " ").split(" ");
|
||||||
|
|
||||||
if (sourceType.isInstance(source)) {
|
if (sourceType.isInstance(source)) {
|
||||||
executor.execute((T) source, this, args);
|
executor.execute((T) source, this, args);
|
||||||
|
|
Loading…
Reference in a new issue