Skip to content

Commit

Permalink
fix some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Badbird5907 committed Jun 21, 2022
1 parent 78c6801 commit b49c87c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void handleMessage(String message, CoreCommandSender sender) {
@Override
public void handleError(String error, CoreCommandSender sender) {
BukkitCommandSender s = (BukkitCommandSender) sender;
System.out.println("err");
s.sendMessage(ChatColor.RED + error);
}

Expand All @@ -103,6 +104,7 @@ public void handleCommandException(CommandInfo info, CoreCommandSender sender, C
Bukkit.getLogger().severe("Could not find a instance of ResponseHandler to handle command exception: " + e.getClass().getName());
return;
}
System.out.println("LocalizedCommandException");
sender.sendMessage(ChatColor.RED + handler.getMessage(lce, lce.getPlaceholders()));
} else sender.sendMessage(ChatColor.RED + e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class CommanderImpl implements Commander {
private final Map<Class<?>, Validator<Object>> validators = new HashMap<>();
private final ResponseHandler responseHandler;
private CommanderConfig config;

public CommanderImpl(CommanderPlatform platform) {
this(platform, new CommanderConfig());
}
Expand Down Expand Up @@ -598,23 +598,6 @@ public List<String> getSuggestions(CoreCommandSender sender, final String input)
return null;
}

ParameterInfo param = null;
boolean found = false;
while (!found) {
param = params[index];
if (param.isFlag() || param.isSwitch()) { //TODO add support for flag and switch suggestions
if (++index >= params.length) {
return null;
}
if (param.isFlag()) {
param = params[index];
}
} else {
found = true;
}
}
Provider<?> provider = param.getProvider();

CompleterInfo customCompleter = command.getCompleters().get(index);
boolean allParams = false;
if (customCompleter == null) {
Expand All @@ -640,10 +623,6 @@ public List<String> getSuggestions(CoreCommandSender sender, final String input)

Collection<String> suggestionsProvided;
if (customReturn == null) {
if (index >= params.length || index < 0) {
return null;
}

ParameterInfo param = null;
boolean found = false;
while (!found) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
import net.octopvp.commander.util.Primitives;
import net.octopvp.commander.validator.Validator;

import java.util.ArrayList;
import java.lang.reflect.Parameter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
Expand Down Expand Up @@ -134,7 +135,7 @@ public static Object[] parseArguments(CommandContext ctx, CommandArgs cArgs) {
return arguments;
} catch (CommandException e) {
LocalizedCommandException.checkResponseHandlerNull(e, ctx.getCommandInfo().getCommander().getResponseHandler());
ctx.getCommandInfo().getCommander().getPlatform().handleCommandException(ctx, e);
ctx.getCommandInfo().getCommander().getPlatform().handleCommandException(ctx.getCommandInfo(), ctx.getCommandSender(), e);
}
return null;
}
Expand Down

0 comments on commit b49c87c

Please sign in to comment.