Fixed command recommendations

This commit is contained in:
boy0001 2015-08-01 03:07:49 +10:00
parent de52b70ad3
commit f1d76beb3a
2 changed files with 3 additions and 2 deletions

View File

@ -335,13 +335,13 @@ public class MainCommand extends CommandManager<PlotPlayer> {
if (cmd == null) { if (cmd == null) {
MainUtil.sendMessage(plr, C.NOT_VALID_SUBCOMMAND); MainUtil.sendMessage(plr, C.NOT_VALID_SUBCOMMAND);
{ {
ArrayList<Command<PlotPlayer>> cmds = getCommands(); List<Command<PlotPlayer>> cmds = getCommands(null, plr);
cmd = new StringComparison<>(label, cmds).getMatchObject(); cmd = new StringComparison<>(label, cmds).getMatchObject();
if (cmd == null) { if (cmd == null) {
MainUtil.sendMessage(plr, C.DID_YOU_MEAN, "/plot help"); MainUtil.sendMessage(plr, C.DID_YOU_MEAN, "/plot help");
} }
else { else {
MainUtil.sendMessage(plr, C.DID_YOU_MEAN, cmd.getUsage().replaceAll("\\{label\\}", label)); MainUtil.sendMessage(plr, C.DID_YOU_MEAN, cmd.getUsage().replaceAll("\\{label\\}", parts[0]));
} }
} }
return CommandHandlingOutput.NOT_FOUND; return CommandHandlingOutput.NOT_FOUND;

View File

@ -29,6 +29,7 @@ import java.util.ArrayList;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;