diff --git a/src/com/onarandombox/MultiverseCore/MVPermissions.java b/src/com/onarandombox/MultiverseCore/MVPermissions.java index d4940484..8c89fc3e 100644 --- a/src/com/onarandombox/MultiverseCore/MVPermissions.java +++ b/src/com/onarandombox/MultiverseCore/MVPermissions.java @@ -25,6 +25,7 @@ public class MVPermissions { * @param node The permission node we are checking against. * @return */ + @Deprecated public boolean has(Player p, String node) { boolean result = false; @@ -84,24 +85,24 @@ public class MVPermissions { // } for (String bls : blackList) { if (bls.contains("g:") && inGroup(p, w.getName(), bls.split(":")[1])) { - //System.out.print(p.getName() + " Is on the BLACKlist for " + w.getName()); + // System.out.print(p.getName() + " Is on the BLACKlist for " + w.getName()); returnValue = false; break; } if (bls.equalsIgnoreCase(p.getName())) { - //System.out.print(p.getName() + " Is on the BLACKlist for " + w.getName()); + // System.out.print(p.getName() + " Is on the BLACKlist for " + w.getName()); returnValue = false; break; } } for (String wls : whiteList) { if (wls.contains("g:") && inGroup(p, w.getName(), wls.split(":")[1])) { - //System.out.print(p.getName() + " Is on the WHITElist for " + w.getName()); + // System.out.print(p.getName() + " Is on the WHITElist for " + w.getName()); returnValue = true; break; } if (wls.equalsIgnoreCase(p.getName())) { - //System.out.print(p.getName() + " Is on the WHITElist for " + w.getName()); + // System.out.print(p.getName() + " Is on the WHITElist for " + w.getName()); returnValue = true; break; } diff --git a/src/com/onarandombox/MultiverseCore/command/BaseCommand.java b/src/com/onarandombox/MultiverseCore/command/BaseCommand.java index 8f88b903..ea6f781e 100644 --- a/src/com/onarandombox/MultiverseCore/command/BaseCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/BaseCommand.java @@ -13,6 +13,8 @@ public abstract class BaseCommand { protected String name; protected String description; protected String usage; + protected String permission = ""; + protected boolean requiresOp; protected int minArgs; protected int maxArgs; protected List identifiers; @@ -27,14 +29,14 @@ public abstract class BaseCommand { public abstract void execute(CommandSender sender, String[] args); public boolean validate(String name, String[] parsedArgs, StringBuilder identifier) { - String match = matchIdentifier(name); + String match = this.matchIdentifier(name); if (match != null) { identifier = identifier.append(match); if (parsedArgs == null) { parsedArgs = new String[0]; } int l = parsedArgs.length; - if (l >= minArgs && (maxArgs == -1 ||l <= maxArgs)) { + if (l >= this.minArgs && (this.maxArgs == -1 ||l <= this.maxArgs)) { return true; } } @@ -45,23 +47,23 @@ public abstract class BaseCommand { String lower = input.toLowerCase(); int index = -1; - int n = identifiers.size(); + int n = this.identifiers.size(); for (int i = 0; i < n; i++) { - String identifier = identifiers.get(i).toLowerCase(); + String identifier = this.identifiers.get(i).toLowerCase(); if (lower.matches(identifier + "(\\s+.*|\\s*)")) { index = i; } } if (index != -1) { - return identifiers.get(index); + return this.identifiers.get(index); } else { return null; } } public List getIdentifiers() { - return identifiers; + return this.identifiers; } public void setIdentifiers(List identifiers) { @@ -69,15 +71,23 @@ public abstract class BaseCommand { } public String getName() { - return name; + return this.name; } public String getDescription() { - return description; + return this.description; } public String getUsage() { - return usage; + return this.usage; + } + + public boolean isOpRequired() { + return this.requiresOp; + } + + public String getPermission() { + return this.permission; } } diff --git a/src/com/onarandombox/MultiverseCore/command/CommandManager.java b/src/com/onarandombox/MultiverseCore/command/CommandManager.java index 22ed8adf..52b4161b 100644 --- a/src/com/onarandombox/MultiverseCore/command/CommandManager.java +++ b/src/com/onarandombox/MultiverseCore/command/CommandManager.java @@ -14,13 +14,16 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.onarandombox.MultiverseCore.MultiverseCore; public class CommandManager { protected List commands; public CommandManager() { - commands = new ArrayList(); + this.commands = new ArrayList(); } public boolean dispatch(CommandSender sender, Command command, String label, String[] args) { @@ -29,7 +32,7 @@ public class CommandManager { String[] trimmedArgs = null; StringBuilder identifier = new StringBuilder(); - for (BaseCommand cmd : commands) { + for (BaseCommand cmd : this.commands) { StringBuilder tmpIdentifier = new StringBuilder(); String[] tmpArgs = parseAllQuotedStrings(args); if (match == null) { @@ -43,28 +46,31 @@ public class CommandManager { } if (match != null) { - if (trimmedArgs != null) { - match.execute(sender, trimmedArgs); - return true; + if (this.hasPermission(sender, match.getPermission(), match.isOpRequired())) { + if (trimmedArgs != null) { + match.execute(sender, trimmedArgs); + } else { + sender.sendMessage(ChatColor.AQUA + "Command: " + ChatColor.WHITE + match.getName()); + sender.sendMessage(ChatColor.AQUA + "Description: " + ChatColor.WHITE + match.getDescription()); + sender.sendMessage(ChatColor.AQUA + "Usage: " + ChatColor.WHITE + match.getUsage()); + } } else { - sender.sendMessage(ChatColor.AQUA + "Command: " + ChatColor.WHITE + match.getName()); - sender.sendMessage(ChatColor.AQUA + "Description: " + ChatColor.WHITE + match.getDescription()); - sender.sendMessage(ChatColor.AQUA + "Usage: " + ChatColor.WHITE + match.getUsage()); + sender.sendMessage("You do not have permission to use this command. (" + match.getPermission() + ")"); } } return true; } public void addCommand(BaseCommand command) { - commands.add(command); + this.commands.add(command); } public void removeCommand(BaseCommand command) { - commands.remove(command); + this.commands.remove(command); } public List getCommands() { - return commands; + return this.commands; } /** @@ -74,6 +80,7 @@ public class CommandManager { * @return */ private String[] parseAllQuotedStrings(String[] args) { + // TODO: Allow ' ArrayList newArgs = new ArrayList(); // Iterate through all command params: // we could have: "Fish dog" the man bear pig "lives today" and maybe "even tomorrow" or "the" next day @@ -120,4 +127,24 @@ public class CommandManager { } return returnVal.replace("\"", ""); } + + public boolean hasPermission(CommandSender sender, String node, boolean isOpRequired) { + + if (!(sender instanceof Player)) { + return true; + } + Player player = (Player) sender; + System.out.print("Checking permissions for " + player.getName()); + + if (player.isOp()) { + // If Player is Op we always let them use it. + return true; + } else if (MultiverseCore.Permissions != null && MultiverseCore.Permissions.has(player, node)) { + // If Permissions is enabled we check against them. + return true; + } + // If the Player doesn't have Permissions and isn't an Op then + // we return true if OP is not required, otherwise we return false + return !isOpRequired; + } } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/ConfirmCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/ConfirmCommand.java index 40904821..164b9d73 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/ConfirmCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/ConfirmCommand.java @@ -1,6 +1,5 @@ package com.onarandombox.MultiverseCore.command.commands; -import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -12,19 +11,18 @@ public class ConfirmCommand extends BaseCommand { super(plugin); name = "Confirms a command that could destroy life, the universe and everything."; description = "If you have not been prompted to use this, it will not do anything."; - usage = "/mvconfirm" + ChatColor.GREEN + " Yes"; - minArgs = 1; - maxArgs = 1; + usage = "/mvconfirm"; + minArgs = 0; + maxArgs = 0; identifiers.add("mvconfirm"); + this.permission = "multiverse.world.confirm"; + // Any command that is dangerous should require op + this.requiresOp = true; } @Override public void execute(CommandSender sender, String[] args) { - if (args[0].equalsIgnoreCase("yes")) { - plugin.confirmQueuedCommand(sender); - } else { - plugin.cancelQueuedCommand(sender); - } + plugin.confirmQueuedCommand(sender); } } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/CoordCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/CoordCommand.java index 41895a88..f707954b 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/CoordCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/CoordCommand.java @@ -28,13 +28,6 @@ public class CoordCommand extends BaseCommand { // Check if the command was sent from a Player. if (sender instanceof Player) { Player p = (Player) sender; - // If this command was sent from a Player then we need to check Permissions - if (!(plugin.ph.has((p), "multiverse.coord"))) { - sender.sendMessage("You do not have access to this command."); - return; - } - - p.sendMessage(ChatColor.RED + "World: " + ChatColor.WHITE + p.getWorld().getName()); p.sendMessage(ChatColor.RED + "Compression: " + ChatColor.WHITE + plugin.worlds.get(p.getWorld().getName()).compression); p.sendMessage(ChatColor.RED + "Coordinates: " + ChatColor.WHITE + locMan.strCoords(p.getLocation())); diff --git a/src/com/onarandombox/MultiverseCore/command/commands/CreateCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/CreateCommand.java index 35aa04d2..101f6966 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/CreateCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/CreateCommand.java @@ -13,12 +13,15 @@ public class CreateCommand extends BaseCommand { public CreateCommand(MultiverseCore plugin) { super(plugin); - name = "Create World"; - description = "Creates a new world of the specified type"; - usage = "/mvcreate" + ChatColor.GREEN + " {NAME} {TYPE}" + ChatColor.GOLD + " [SEED]"; - minArgs = 2; - maxArgs = 3; - identifiers.add("mvcreate"); + this.name = "Create World"; + this.description = "Creates a new world of the specified type"; + this.usage = "/mvcreate" + ChatColor.GREEN + " {NAME} {TYPE}" + ChatColor.GOLD + " [SEED]"; + this.minArgs = 2; + this.maxArgs = 3; + this.identifiers.add("mvcreate"); + this.permission = "multiverse.world.create"; + this.requiresOp = true; + } @Override @@ -26,12 +29,12 @@ public class CreateCommand extends BaseCommand { // TODO: Permissions, check int numOfParams = args.length; - + boolean hasSeed = numOfParams == 3; String worldName = args[0]; String env = args[1]; String seed = ""; - if(hasSeed) { + if (hasSeed) { seed = args[2]; } @@ -41,7 +44,7 @@ public class CreateCommand extends BaseCommand { return; } Environment environment = plugin.getEnvFromString(env, sender); - if(environment == null) { + if (environment == null) { return; } sender.sendMessage(ChatColor.AQUA + "Starting world creation..."); @@ -57,5 +60,5 @@ public class CreateCommand extends BaseCommand { sender.sendMessage(ChatColor.GREEN + "Complete!"); return; } - + } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/DeleteCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/DeleteCommand.java index 084b6958..ef5e11d7 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/DeleteCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/DeleteCommand.java @@ -10,19 +10,20 @@ public class DeleteCommand extends BaseCommand { public DeleteCommand(MultiverseCore plugin) { super(plugin); - name = "Delete World"; - description = "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY."; - usage = "/mvdelete" + ChatColor.GREEN + " {WORLD} "; - minArgs = 1; - maxArgs = 1; - identifiers.add("mvdelete"); + this.name = "Delete World"; + this.description = "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY."; + this.usage = "/mvdelete" + ChatColor.GREEN + " {WORLD} "; + this.minArgs = 1; + this.maxArgs = 1; + this.identifiers.add("mvdelete"); + this.permission = "multiverse.world.delete"; + this.requiresOp = true; } @Override public void execute(CommandSender sender, String[] args) { - Class paramTypes[] = {String.class}; - plugin.queueCommand(sender, "mvdelete", "deleteWorld", args, paramTypes, "World Deleted!", "World was not deleted!"); + this.plugin.queueCommand(sender, "mvdelete", "deleteWorld", args, paramTypes, "World Deleted!", "World was not deleted!"); } } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/EnvironmentCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/EnvironmentCommand.java index 2dfc08b1..55c7f75a 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/EnvironmentCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/EnvironmentCommand.java @@ -10,12 +10,14 @@ public class EnvironmentCommand extends BaseCommand{ public EnvironmentCommand(MultiverseCore plugin) { super(plugin); - name = "Create World"; - description = "Creates a new world of the specified type"; - usage = "/mvcoord" + ChatColor.GREEN + "{NAME} {TYPE}"; - minArgs = 2; - maxArgs = 2; - identifiers.add("mvcoord"); + this.name = "List Environments"; + this.description = "Lists valid known environments"; + this.usage = "/mvenv"; + this.minArgs = 2; + this.maxArgs = 2; + this.identifiers.add("mvenv"); + this.permission = "multiverse.world.list.environments"; + this.requiresOp = false; } @Override diff --git a/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java index 4f55522b..c71c63b1 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java @@ -21,14 +21,15 @@ public class HelpCommand extends BaseCommand { public HelpCommand(MultiverseCore plugin) { super(plugin); - name = "Help"; - description = "Displays the help menu"; - usage = ChatColor.AQUA + "/mv help " + ChatColor.GOLD + "[page#]"; - minArgs = 0; - maxArgs = 1; - identifiers.add("mv help"); - identifiers.add("mv"); - identifiers.add("mvhelp"); + this.name = "Help"; + this.description = "Displays the help menu"; + this.usage = ChatColor.AQUA + "/mv help " + ChatColor.GOLD + "[page#]"; + this.minArgs = 0; + this.maxArgs = 1; + this.identifiers.add("mv"); + this.identifiers.add("mvhelp"); + this.permission = "multiverse.help"; + this.requiresOp = false; } @Override @@ -59,6 +60,7 @@ public class HelpCommand extends BaseCommand { } for (int c = start; c < end; c++) { BaseCommand cmd = commands.get(c); + sender.sendMessage(ChatColor.AQUA + " " + cmd.getUsage()); } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/ImportCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/ImportCommand.java index d24dbc19..842d0b4c 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/ImportCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/ImportCommand.java @@ -13,12 +13,14 @@ public class ImportCommand extends BaseCommand { public ImportCommand(MultiverseCore plugin) { super(plugin); - name = "Import World"; - description = "Imports a new world of the specified type"; - usage = "/mvimport" + ChatColor.GREEN + " {NAME} {TYPE}"; - minArgs = 2; - maxArgs = 2; - identifiers.add("mvimport"); + this.name = "Import World"; + this.description = "Imports a new world of the specified type"; + this.usage = "/mvimport" + ChatColor.GREEN + " {NAME} {TYPE}"; + this.minArgs = 2; + this.maxArgs = 2; + this.identifiers.add("mvimport"); + this.permission = "multiverse.world.import"; + this.requiresOp = true; } @Override diff --git a/src/com/onarandombox/MultiverseCore/command/commands/ListCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/ListCommand.java index 3e2b5d30..25c20b2f 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/ListCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/ListCommand.java @@ -13,12 +13,14 @@ public class ListCommand extends BaseCommand { public ListCommand(MultiverseCore plugin) { super(plugin); - name = "World Listing"; - description = "Returns all valid worlds"; - usage = "/mvlist"; - minArgs = 0; - maxArgs = 0; - identifiers.add("mvlist"); + this.name = "World Listing"; + this.description = "Displays a listing of all worlds that you can enter"; + this.usage = "/mvlist"; + this.minArgs = 0; + this.maxArgs = 0; + this.identifiers.add("mvlist"); + this.permission = "multiverse.world.list"; + this.requiresOp = false; } @Override @@ -26,10 +28,6 @@ public class ListCommand extends BaseCommand { Player p = null; if (sender instanceof Player) { p = (Player) sender; - if (!(plugin.ph.has(p, "multiverse.world.list"))) { - sender.sendMessage("You do not have access to this command."); - return; - } } String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n"; diff --git a/src/com/onarandombox/MultiverseCore/command/commands/RemoveCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/RemoveCommand.java index 5e02d10c..5500ce49 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/RemoveCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/RemoveCommand.java @@ -2,7 +2,6 @@ package com.onarandombox.MultiverseCore.command.commands; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.MultiverseCore.command.BaseCommand; @@ -11,26 +10,22 @@ public class RemoveCommand extends BaseCommand { public RemoveCommand(MultiverseCore plugin) { super(plugin); - name = "Remove World"; - description = "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder."; - usage = "/mvremove" + ChatColor.GREEN + " {WORLD} "; - minArgs = 1; - maxArgs = 1; - identifiers.add("mvremove"); + this.name = "Remove World"; + this.description = "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder."; + this.usage = "/mvremove" + ChatColor.GREEN + " {WORLD} "; + this.minArgs = 1; + this.maxArgs = 1; + this.identifiers.add("mvremove"); + this.permission = "multiverse.world.remove"; + this.requiresOp = true; } @Override public void execute(CommandSender sender, String[] args) { - if(sender instanceof Player) { - if(!plugin.ph.has((Player)sender,"multiverse.world.remove")) { - return; - } - } if (plugin.removeWorld(args[0])) { sender.sendMessage("World removed from config!"); } else { sender.sendMessage("Error trying to remove world from config!"); } } - } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/SetSpawnCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/SetSpawnCommand.java index 1df4be48..a7613619 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/SetSpawnCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/SetSpawnCommand.java @@ -12,17 +12,18 @@ public class SetSpawnCommand extends BaseCommand { public SetSpawnCommand(MultiverseCore plugin) { super(plugin); - name = "Set World Spawn"; - description = "Sets the spawn for the current world."; - usage = "/mvsetspawn"; - minArgs = 0; - maxArgs = 0; - identifiers.add("mvsetspawn"); + this.name = "Set World Spawn"; + this.description = "Sets the spawn for the current world."; + this.usage = "/mvsetspawn"; + this.minArgs = 0; + this.maxArgs = 0; + this.identifiers.add("mvsetspawn"); + this.permission = "multiverse.world.spawn.set"; + this.requiresOp = true; } - + @Override public void execute(CommandSender sender, String[] args) { - // TODO: Permissions if (sender instanceof Player) { Player p = (Player) sender; Location l = p.getLocation(); @@ -32,7 +33,7 @@ public class SetSpawnCommand extends BaseCommand { } else { sender.sendMessage(IN_GAME_COMMAND_MSG); } - return ; + return; } } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/SpawnCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/SpawnCommand.java index b3843bde..c122072f 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/SpawnCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/SpawnCommand.java @@ -11,12 +11,14 @@ public class SpawnCommand extends BaseCommand { public SpawnCommand(MultiverseCore plugin) { super(plugin); - name = "Spawn"; - description = "Transports the player to the that player's current world Spawn Point."; - usage = "/mvspawn" + ChatColor.GOLD + " [PLAYER]"; - minArgs = 0; - maxArgs = 1; - identifiers.add("mvspawn"); + this.name = "Spawn"; + this.description = "Transports the player to the that player's current world Spawn Point."; + this.usage = "/mvspawn" + ChatColor.GOLD + " [PLAYER]"; + this.minArgs = 0; + this.maxArgs = 1; + this.identifiers.add("mvspawn"); + this.permission = "multiverse.world.spawn"; + this.requiresOp = true; } @Override diff --git a/src/com/onarandombox/MultiverseCore/command/commands/TeleportCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/TeleportCommand.java index 369b37e5..71f34918 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/TeleportCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/TeleportCommand.java @@ -16,13 +16,15 @@ public class TeleportCommand extends BaseCommand { public TeleportCommand(MultiverseCore plugin) { super(plugin); - name = "Teleport"; - description = "Teleports you to a different world."; - usage = "/mvtp" + ChatColor.GREEN + " {WORLD}"; - minArgs = 1; - maxArgs = 1; - identifiers.add("mvtp"); - playerTeleporter = new MVTeleport(plugin); + this.name = "Teleport"; + this.description = "Teleports you to a different world."; + this.usage = "/mvtp" + ChatColor.GREEN + " {WORLD}"; + this.minArgs = 1; + this.maxArgs = 1; + this.identifiers.add("mvtp"); + this.playerTeleporter = new MVTeleport(plugin); + this.permission = "multiverse.world.tp"; + this.requiresOp = true; } @Override @@ -30,18 +32,12 @@ public class TeleportCommand extends BaseCommand { // Check if the command was sent from a Player. if (sender instanceof Player) { Player p = (Player) sender; - // If this command was sent from a Player then we need to check Permissions - if (!(plugin.ph.has((p), "multiverse.tp"))) { - p.sendMessage("You do not have access to this command."); - return; - } Destination d = Destination.parseDestination(args[0], this.plugin); - // TODO: Support portals, but I didn't see the portals list --FF if (d.getType() == DestinationType.World && plugin.ph.canEnterWorld(p, plugin.getServer().getWorld(d.getName()))) { Location l = playerTeleporter.getSafeDestination(this.plugin.getServer().getWorld(d.getName()).getSpawnLocation()); p.teleport(l); } else { - p.sendMessage("That was not a valid world (portals aren't yet supported)"); + p.sendMessage("That was not a valid world."); } } else { diff --git a/src/com/onarandombox/MultiverseCore/command/commands/UnloadCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/UnloadCommand.java index 61b34141..7f9a8ce3 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/UnloadCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/UnloadCommand.java @@ -10,12 +10,14 @@ public class UnloadCommand extends BaseCommand { public UnloadCommand(MultiverseCore plugin) { super(plugin); - name = "Unload World"; - description = "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file."; - usage = "/mvunload" + ChatColor.GREEN + " {WORLD} "; - minArgs = 1; - maxArgs = 1; - identifiers.add("mvunload"); + this.name = "Unload World"; + this.description = "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file."; + this.usage = "/mvunload" + ChatColor.GREEN + " {WORLD} "; + this.minArgs = 1; + this.maxArgs = 1; + this.identifiers.add("mvunload"); + this.permission = "multiverse.world.unload"; + this.requiresOp = true; } @Override diff --git a/src/com/onarandombox/MultiverseCore/command/commands/WhoCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/WhoCommand.java index 9d116f10..0d7f6831 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/WhoCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/WhoCommand.java @@ -16,12 +16,14 @@ public class WhoCommand extends BaseCommand { public WhoCommand(MultiverseCore plugin) { super(plugin); - name = "Who"; - description = "States who is in what world"; - usage = "/mvwho" + ChatColor.GOLD + " [WORLD]"; - minArgs = 0; - maxArgs = 1; - identifiers.add("mvwho"); + this.name = "Who"; + this.description = "States who is in what world"; + this.usage = "/mvwho" + ChatColor.GOLD + " [WORLD]"; + this.minArgs = 0; + this.maxArgs = 1; + this.identifiers.add("mvwho"); + this.permission = "multiverse.world.list.who"; + this.requiresOp = false; } @Override @@ -30,10 +32,6 @@ public class WhoCommand extends BaseCommand { Player p = null; if (sender instanceof Player) { p = (Player) sender; - if (!(plugin.ph.has(p, "multiverse.world.who"))) { - sender.sendMessage("You do not have access to this command."); - return; - } } List worlds = new ArrayList(); diff --git a/src/plugin.yml b/src/plugin.yml index 17c9aca9..519abaeb 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,7 +1,7 @@ name: Multiverse-Core main: com.onarandombox.MultiverseCore.MultiverseCore authors: ['Rigby', 'Herocraft Coding Team'] -version: 2.0 +version: 2.0 commands: mv: description: Generic Multiverse Command @@ -78,4 +78,4 @@ commands: mvconfirm: description: Confirms sensitive decisions like deleting a world. usage: | - / [Yes|No] \ No newline at end of file + / [Yes|No]