Enforced onlyConsole setting.

Removed extraneous test code method
This commit is contained in:
tastybento 2018-08-12 20:09:04 -07:00
parent 4681a0bd7d
commit ec3e956d76

View File

@ -424,16 +424,6 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
return "/" + usage;
}
public String getFullUsage() {
String result = usage;
CompositeCommand c = this.parent;
while (c != null) {
result = c.getUsage() + " " + result;
c = c.getParent();
}
return "/" + result;
}
/**
* Check if this command has a specific sub command.
* @param subCommand - sub command
@ -635,7 +625,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
// Get command object based on args entered so far
CompositeCommand cmd = getCommandFromArgs(args);
// Check for console and permissions
if (cmd.onlyPlayer && !(sender instanceof Player)) {
if ((cmd.onlyPlayer && !(sender instanceof Player)) || (cmd.onlyConsole && sender instanceof Player)) {
return options;
}
if (!cmd.getPermission().isEmpty() && !sender.hasPermission(cmd.getPermission()) && !sender.isOp()) {