fix buildcraft command crash
This commit is contained in:
parent
89b10bbd8f
commit
09ef745ae1
|
@ -78,7 +78,7 @@ public final class CommandHelpers {
|
|||
}
|
||||
|
||||
public static void processChildCommand(ICommandSender sender, SubCommand child, String[] args) {
|
||||
if (!sender.canCommandSenderUseCommand(child.getRequiredPermissionLevel(), child.getFullCommandString())) {
|
||||
if (!sender.canCommandSenderUseCommand(child.getMinimumPermissionLevel(), child.getFullCommandString())) {
|
||||
throw new WrongUsageException(StatCollector.translateToLocal("command.buildcraft.noperms"));
|
||||
}
|
||||
String[] newargs = new String[args.length - 1];
|
||||
|
@ -96,8 +96,8 @@ public final class CommandHelpers {
|
|||
if (command.getCommandAliases().size() > 0) {
|
||||
sendLocalizedChatMessage(sender, body, "command.buildcraft.aliases", command.getCommandAliases().toString().replace("[", "").replace("]", ""));
|
||||
}
|
||||
if (command.getRequiredPermissionLevel() > 0) {
|
||||
sendLocalizedChatMessage(sender, body, "command.buildcraft.permlevel", command.getRequiredPermissionLevel());
|
||||
if (command.getMinimumPermissionLevel() > 0) {
|
||||
sendLocalizedChatMessage(sender, body, "command.buildcraft.permlevel", command.getMinimumPermissionLevel());
|
||||
}
|
||||
sendLocalizedChatMessage(sender, body, "command.buildcraft." + command.getFullCommandString().replace(" ", ".") + ".help");
|
||||
if (!command.getChildren().isEmpty()) {
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface IModCommand extends ICommand {
|
|||
@Override
|
||||
List<String> getCommandAliases();
|
||||
|
||||
int getRequiredPermissionLevel();
|
||||
int getMinimumPermissionLevel();
|
||||
|
||||
SortedSet<SubCommand> getChildren();
|
||||
|
||||
|
|
|
@ -55,6 +55,11 @@ public class RootCommand extends CommandBase implements IModCommand {
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumPermissionLevel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCommandAliases() {
|
||||
return aliases;
|
||||
|
|
|
@ -94,13 +94,13 @@ public abstract class SubCommand implements IModCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final int getRequiredPermissionLevel() {
|
||||
public final int getMinimumPermissionLevel() {
|
||||
return permLevel.permLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||
return sender.canCommandSenderUseCommand(getRequiredPermissionLevel(), getCommandName());
|
||||
return sender.canCommandSenderUseCommand(getMinimumPermissionLevel(), getCommandName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue