Skip to content

Commit

Permalink
fix numerical and boolean arguments not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Revxrsal committed Sep 26, 2023
1 parent adef768 commit 0fbe9d5
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import revxrsal.commands.bukkit.core.BukkitActor;
import revxrsal.commands.command.CommandActor;
import revxrsal.commands.command.CommandParameter;
import revxrsal.commands.util.Primitives;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -57,7 +58,7 @@ public CommodoreBukkitBrigadier(BukkitCommandHandler handler) {
commodore = CommodoreProvider.getCommodore(handler.getPlugin());
if (isSupported()) {
bind(String.class, STRING);
bind(Number.class, NUMBER);
registerArgumentTypeResolver(NUMBER);
bind(Boolean.class, BOOLEAN);
bind(Player.class, PLAYER);
bind(EntitySelector.class, ENTITY_SELECTOR);
Expand All @@ -77,7 +78,11 @@ public CommodoreBukkitBrigadier(BukkitCommandHandler handler) {
@Override public void bind(@NotNull Class<?> type, @NotNull ArgumentTypeResolver resolver) {
notNull(type, "type");
notNull(resolver, "resolver");
resolvers.add(parameter -> parameter.getType() == type ? resolver.getArgumentType(parameter) : null);
resolvers.add(
parameter -> Primitives.wrap(parameter.getType()) == type
? resolver.getArgumentType(parameter)
: null
);
}

@Override public void bind(@NotNull Class<?> type, @NotNull ArgumentType<?> argumentType) {
Expand Down

0 comments on commit 0fbe9d5

Please sign in to comment.