mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-08-04 05:25:28 +02:00
OCD
This commit is contained in:
@@ -14,6 +14,7 @@ import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -101,8 +102,8 @@ public abstract class Command {
|
||||
}
|
||||
|
||||
public String getFullId() {
|
||||
if (parent != null && parent.getParent() != null) {
|
||||
return parent.getFullId() + "." + id;
|
||||
if (this.parent != null && this.parent.getParent() != null) {
|
||||
return this.parent.getFullId() + "." + this.id;
|
||||
}
|
||||
return this.id;
|
||||
}
|
||||
@@ -118,16 +119,16 @@ public abstract class Command {
|
||||
}
|
||||
|
||||
public List<Command> getCommands(CommandCategory cat, PlotPlayer player) {
|
||||
List<Command> cmds = getCommands(player);
|
||||
List<Command> commands = getCommands(player);
|
||||
if (cat != null) {
|
||||
Iterator<Command> iter = cmds.iterator();
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next().category != cat) {
|
||||
iter.remove();
|
||||
Iterator<Command> iterator = commands.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
if (iterator.next().category != cat) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
return cmds;
|
||||
return commands;
|
||||
}
|
||||
|
||||
public List<Command> getCommands() {
|
||||
@@ -302,8 +303,8 @@ public abstract class Command {
|
||||
// Command recommendation
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_SUBCOMMAND);
|
||||
{
|
||||
List<Command> cmds = getCommands(player);
|
||||
if (cmds.isEmpty()) {
|
||||
List<Command> commands = getCommands(player);
|
||||
if (commands.isEmpty()) {
|
||||
MainUtil.sendMessage(player, C.DID_YOU_MEAN, MainCommand.getInstance().help.getUsage());
|
||||
return;
|
||||
}
|
||||
@@ -313,7 +314,7 @@ public abstract class Command {
|
||||
}
|
||||
String[] allargs = setargs.toArray(new String[setargs.size()]);
|
||||
int best = 0;
|
||||
for (Command current : cmds) {
|
||||
for (Command current : commands) {
|
||||
int match = getMatch(allargs, current);
|
||||
if (match > best) {
|
||||
cmd = current;
|
||||
|
Reference in New Issue
Block a user