Skip to content

Commit

Permalink
Remove conditional registering
Browse files Browse the repository at this point in the history
  • Loading branch information
Revxrsal committed Oct 13, 2021
1 parent b162884 commit 852e58a
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ final class Brigadier {
private static final Class<?>[] ENTITIES = new Class<?>[]{boolean.class, boolean.class};

private final Commodore commodore;
private boolean registerSwitches;
private boolean registerFlags;
private final ClassMap<ArgumentType<?>> argumentTypes = new ClassMap<>();

public Brigadier(BukkitCommandHandler handler, Commodore commodore) {
Expand Down Expand Up @@ -168,11 +166,11 @@ private LiteralArgumentBuilder<?> parse(LiteralArgumentBuilder<?> parent, Execut
}

private ArgumentBuilder getBuilder(ExecutableCommand command, CommandParameter parameter, boolean respectFlag) {
if (parameter.isSwitch() && registerSwitches) {
if (parameter.isSwitch()) {
return literal(parameter.getCommandHandler().getSwitchPrefix() + parameter.getSwitchName())
.executes(a -> 0);
}
if (parameter.isFlag() && respectFlag && registerFlags) {
if (parameter.isFlag() && respectFlag) {
return literal(parameter.getCommandHandler().getFlagPrefix() + parameter.getFlagName())
.then(getBuilder(command, parameter, false));
}
Expand Down

0 comments on commit 852e58a

Please sign in to comment.