From 3c4135236de895520830d597c476a5c227497ce5 Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Sun, 17 Jul 2011 13:06:21 -0600 Subject: [PATCH] Commit because i've changed just about everything... Doubt this one works. --- lib/commandhandler | 2 +- .../MultiverseCore/MVPermissions.java | 4 +++ .../commands/ConfirmCommand.java | 15 +++++----- .../MultiverseCore/commands/CoordCommand.java | 15 +++++----- .../commands/CreateCommand.java | 18 +++++------- .../commands/DeleteCommand.java | 16 +++++----- .../commands/EnvironmentCommand.java | 16 +++++----- .../MultiverseCore/commands/HelpCommand.java | 18 +++++------- .../commands/ImportCommand.java | 18 +++++------- .../MultiverseCore/commands/InfoCommand.java | 18 +++++------- .../MultiverseCore/commands/ListCommand.java | 18 +++++------- .../commands/ModifyAddCommand.java | 24 +++++++-------- .../commands/ModifyClearCommand.java | 24 +++++++-------- .../commands/ModifyCommand.java | 26 ++++++++++------- .../commands/ModifyRemoveCommand.java | 24 +++++++-------- .../commands/ModifySetCommand.java | 24 +++++++-------- .../MultiverseCore/commands/PurgeCommand.java | 18 +++++------- .../commands/ReloadCommand.java | 22 ++++++-------- .../commands/RemoveCommand.java | 15 ++++------ .../commands/SetSpawnCommand.java | 18 +++++------- .../MultiverseCore/commands/SleepCommand.java | 14 ++++----- .../MultiverseCore/commands/SpawnCommand.java | 18 +++++------- .../commands/TeleportCommand.java | 29 ++++++++++++------- .../commands/UnloadCommand.java | 16 +++++----- .../MultiverseCore/commands/WhoCommand.java | 14 ++++----- 25 files changed, 210 insertions(+), 234 deletions(-) diff --git a/lib/commandhandler b/lib/commandhandler index c1f179e2..146c05f6 160000 --- a/lib/commandhandler +++ b/lib/commandhandler @@ -1 +1 @@ -Subproject commit c1f179e22aae2b4216b253cfe9f1ee7837728edd +Subproject commit 146c05f6a9bc81f1f3a3c2af794a5c800aa5350a diff --git a/src/com/onarandombox/MultiverseCore/MVPermissions.java b/src/com/onarandombox/MultiverseCore/MVPermissions.java index 95d87bd0..482f6a70 100644 --- a/src/com/onarandombox/MultiverseCore/MVPermissions.java +++ b/src/com/onarandombox/MultiverseCore/MVPermissions.java @@ -95,7 +95,9 @@ public class MVPermissions implements PermissionsInterface { if (!(sender instanceof Player)) { return true; } + Player player = (Player) sender; + boolean opFallback = this.plugin.configMV.getBoolean("opfallback", true); if (player.isOp() && opFallback) { // If Player is Op we always let them use it if they have the fallback enabled! @@ -103,6 +105,8 @@ public class MVPermissions implements PermissionsInterface { } else if (this.permissions != null && this.permissions.has(player, node)) { // If Permissions is enabled we check against them. return true; + } else if(sender.hasPermission(node)) { + 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 diff --git a/src/com/onarandombox/MultiverseCore/commands/ConfirmCommand.java b/src/com/onarandombox/MultiverseCore/commands/ConfirmCommand.java index 11e59968..5542539b 100644 --- a/src/com/onarandombox/MultiverseCore/commands/ConfirmCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/ConfirmCommand.java @@ -3,6 +3,7 @@ package com.onarandombox.MultiverseCore.commands; import java.util.List; import org.bukkit.command.CommandSender; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -10,15 +11,13 @@ public class ConfirmCommand extends MultiverseCommand { public ConfirmCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Confirms a command that could destroy life, the universe and everything."; - this.commandDesc = "If you have not been prompted to use this, it will not do anything."; - this.commandUsage = "/mvconfirm"; - this.minimumArgLength = 0; - this.maximumArgLength = 0; - this.commandKeys.add("mvconfirm"); - this.permission = "multiverse.world.confirm"; // Any command that is dangerous should require op - this.opRequired = true; + this.setName("Confirms a command that could destroy life, the universe and everything."); + this.setCommandUsage("/mvconfirm"); + this.setArgRange(0, 0); + this.addKey("mvconfirm"); + this.setPermission("multiverse.core.confirm", "If you have not been prompted to use this, it will not do anything.", PermissionDefault.OP); + } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/CoordCommand.java b/src/com/onarandombox/MultiverseCore/commands/CoordCommand.java index 6d9fff31..cb84badb 100644 --- a/src/com/onarandombox/MultiverseCore/commands/CoordCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/CoordCommand.java @@ -6,6 +6,7 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.utils.LocationManipulation; @@ -16,14 +17,12 @@ public class CoordCommand extends MultiverseCommand { public CoordCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Coordinates"; - this.commandDesc = "Returns detailed information on the Players where abouts."; - this.commandUsage = "/mvcoord"; - this.minimumArgLength = 0; - this.maximumArgLength = 0; - this.commandKeys.add("mvcoord"); - this.permission = "multiverse.world.coord"; - this.opRequired = false; + this.setName("Coordinates"); + this.setCommandUsage("/mvcoord"); + this.setArgRange(0, 0); + this.addKey("mv coord"); + this.addKey("mvcoord"); + this.setPermission("multiverse.core.coord", "Returns detailed information on the Players where abouts.", PermissionDefault.TRUE); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/CreateCommand.java b/src/com/onarandombox/MultiverseCore/commands/CreateCommand.java index bd56d1f6..9b077bac 100644 --- a/src/com/onarandombox/MultiverseCore/commands/CreateCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/CreateCommand.java @@ -6,6 +6,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.World.Environment; import org.bukkit.command.CommandSender; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; import com.pneumaticraft.commandhandler.CommandHandler; @@ -14,16 +15,13 @@ public class CreateCommand extends MultiverseCommand { public CreateCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Create World"; - this.commandDesc = "Creates a new world and loads it."; - this.commandUsage = "/mvcreate" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]]"; - this.minimumArgLength = 2; - this.maximumArgLength = 6; - this.commandKeys.add("mvcreate"); - this.commandKeys.add("mvc"); - this.commandKeys.add("mv create"); - this.permission = "multiverse.world.create"; - this.opRequired = true; + this.setName("Create World"); + this.setCommandUsage("/mvcreate" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]]"); + this.setArgRange(2, 6); + this.addKey("mvcreate"); + this.addKey("mvc"); + this.addKey("mv create"); + this.setPermission("multiverse.core.create", "Creates a new world and loads it.", PermissionDefault.OP); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/DeleteCommand.java b/src/com/onarandombox/MultiverseCore/commands/DeleteCommand.java index c2045c34..c630b8fa 100644 --- a/src/com/onarandombox/MultiverseCore/commands/DeleteCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/DeleteCommand.java @@ -4,6 +4,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -11,15 +12,12 @@ public class DeleteCommand extends MultiverseCommand { public DeleteCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Delete World"; - this.commandDesc = "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY."; - this.commandUsage = "/mvdelete" + ChatColor.GREEN + " {WORLD} "; - this.minimumArgLength = 1; - this.maximumArgLength = 1; - this.commandKeys.add("mvdelete"); - this.commandKeys.add("mv delete"); - this.permission = "multiverse.world.delete"; - this.opRequired = true; + this.setName("Delete World"); + this.setCommandUsage("/mvdelete" + ChatColor.GREEN + " {WORLD}"); + this.setArgRange(1, 1); + this.addKey("mvdelete"); + this.addKey("mv delete"); + this.setPermission("multiverse.core.delete", "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java b/src/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java index 130971c7..c9a3004f 100644 --- a/src/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java @@ -4,6 +4,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -12,15 +13,12 @@ public class EnvironmentCommand extends MultiverseCommand { public EnvironmentCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "List Environments"; - this.commandDesc = "Lists valid known environments."; - this.commandUsage = "/mvenv"; - this.minimumArgLength = 0; - this.maximumArgLength = 0; - this.commandKeys.add("mvenv"); - this.commandKeys.add("mv env"); - this.permission = "multiverse.world.list.environments"; - this.opRequired = false; + this.setName("List Environments"); + this.setCommandUsage("/mvenv"); + this.setArgRange(0, 0); + this.addKey("mvenv"); + this.addKey("mv env"); + this.setPermission("multiverse.core.list.environments", "Lists valid known environments.", PermissionDefault.TRUE); } diff --git a/src/com/onarandombox/MultiverseCore/commands/HelpCommand.java b/src/com/onarandombox/MultiverseCore/commands/HelpCommand.java index a43c72f4..a7ca7e4e 100644 --- a/src/com/onarandombox/MultiverseCore/commands/HelpCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/HelpCommand.java @@ -7,6 +7,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; import com.pneumaticraft.commandhandler.Command; @@ -16,16 +17,13 @@ public class HelpCommand extends MultiverseCommand { public HelpCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Get Help with Multiverse"; - this.commandDesc = "Displays a nice help menu."; - this.commandUsage = "/mv " + ChatColor.GOLD + "[PAGE #]"; - this.minimumArgLength = 0; - this.maximumArgLength = 1; - this.commandKeys.add("mv"); - this.commandKeys.add("mvhelp"); - this.commandKeys.add("mv help"); - this.permission = "multiverse.help"; - this.opRequired = false; + this.setName("Get Help with Multiverse"); + this.setCommandUsage("/mv " + ChatColor.GOLD + "[PAGE #]"); + this.setArgRange(0, 1); + this.addKey("mv"); + this.addKey("mvhelp"); + this.addKey("mv help"); + this.setPermission("multiverse.help", "Displays a nice help menu.", PermissionDefault.TRUE); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/ImportCommand.java b/src/com/onarandombox/MultiverseCore/commands/ImportCommand.java index 759be69d..02223229 100644 --- a/src/com/onarandombox/MultiverseCore/commands/ImportCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/ImportCommand.java @@ -6,6 +6,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.World.Environment; import org.bukkit.command.CommandSender; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -13,16 +14,13 @@ public class ImportCommand extends MultiverseCommand { public ImportCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Import World"; - this.commandDesc = "Imports a new world of the specified type"; - this.commandUsage = "/mvimport" + ChatColor.GREEN + " {NAME} {ENV} " + ChatColor.GOLD + "[GENERATOR[:ID]]"; - this.minimumArgLength = 2; - this.maximumArgLength = 3; - this.commandKeys.add("mvimport"); - this.commandKeys.add("mvi"); - this.commandKeys.add("mv import"); - this.permission = "multiverse.world.import"; - this.opRequired = true; + this.setName("Import World"); + this.setCommandUsage("/mvimport" + ChatColor.GREEN + " {NAME} {ENV} " + ChatColor.GOLD + "[GENERATOR[:ID]]"); + this.setArgRange(2, 3); + this.addKey("mvimport"); + this.addKey("mvi"); + this.addKey("mv import"); + this.setPermission("multiverse.core.import", "Imports a new world of the specified type.", PermissionDefault.TRUE); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/InfoCommand.java b/src/com/onarandombox/MultiverseCore/commands/InfoCommand.java index b707cfde..a791ebe5 100644 --- a/src/com/onarandombox/MultiverseCore/commands/InfoCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/InfoCommand.java @@ -6,6 +6,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -14,16 +15,13 @@ public class InfoCommand extends MultiverseCommand { public InfoCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "World Information"; - this.commandDesc = "Returns detailed information on the world."; - this.commandUsage = "/mvinfo" + ChatColor.GOLD + " [WORLD] "; - this.minimumArgLength = 0; - this.maximumArgLength = 2; - this.commandKeys.add("mvinfo"); - this.commandKeys.add("mv info"); - this.commandKeys.add("mvi"); - this.permission = "multiverse.world.info"; - this.opRequired = false; + this.setName("World Information"); + this.setCommandUsage("/mvinfo" + ChatColor.GOLD + " [WORLD]"); + this.setArgRange(0, 1); + this.addKey("mvinfo"); + this.addKey("mvi"); + this.addKey("mv info"); + this.setPermission("multiverse.world.coord", "Returns detailed information on the world.", PermissionDefault.TRUE); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/ListCommand.java b/src/com/onarandombox/MultiverseCore/commands/ListCommand.java index bffea12f..b89b3191 100644 --- a/src/com/onarandombox/MultiverseCore/commands/ListCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/ListCommand.java @@ -6,6 +6,7 @@ import org.bukkit.ChatColor; import org.bukkit.World.Environment; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -14,16 +15,13 @@ public class ListCommand extends MultiverseCommand { public ListCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "World Listing"; - this.commandDesc = "Displays a listing of all worlds that you can enter"; - this.commandUsage = "/mvlist"; - this.minimumArgLength = 0; - this.maximumArgLength = 0; - this.commandKeys.add("mvlist"); - this.commandKeys.add("mvl"); - this.commandKeys.add("mv list"); - this.permission = "multiverse.world.list"; - this.opRequired = false; + this.setName("World Listing"); + this.setCommandUsage("/mvlist"); + this.setArgRange(0, 0); + this.addKey("mvlist"); + this.addKey("mvl"); + this.addKey("mv list"); + this.setPermission("multiverse.core.list.worlds", "Displays a listing of all worlds that you can enter.", PermissionDefault.TRUE); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/ModifyAddCommand.java b/src/com/onarandombox/MultiverseCore/commands/ModifyAddCommand.java index 41400303..c93b19f5 100644 --- a/src/com/onarandombox/MultiverseCore/commands/ModifyAddCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/ModifyAddCommand.java @@ -5,6 +5,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -16,17 +17,14 @@ public class ModifyAddCommand extends MultiverseCommand { public ModifyAddCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Modify a World (Add a value)"; - this.commandDesc = "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used."; - this.commandUsage = "/mvmodify " + ChatColor.GREEN + "ADD {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] "; - this.minimumArgLength = 2; - this.maximumArgLength = 3; - this.commandKeys.add("mvmodify add"); - this.commandKeys.add("mv modify add"); - this.commandKeys.add("mvm add"); - this.commandKeys.add("mvmadd"); - this.permission = "multiverse.world.modify"; - this.opRequired = true; + this.setName("Modify a World (Add a value)"); + this.setCommandUsage("/mvmodify " + ChatColor.GREEN + "ADD {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] "); + this.setArgRange(2, 3); + this.addKey("mvm add"); + this.addKey("mvmadd"); + this.addKey("mv modify add"); + this.addKey("mvmodify add"); + this.setPermission("multiverse.core.modify.add", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP); } @Override @@ -39,8 +37,8 @@ public class ModifyAddCommand extends MultiverseCommand { if (args.size() == 2 && p == null) { sender.sendMessage(ChatColor.RED + "From the console, WORLD is required."); - sender.sendMessage(this.commandDesc); - sender.sendMessage(this.commandUsage); + sender.sendMessage(this.getCommandDesc()); + sender.sendMessage(this.getCommandUsage()); sender.sendMessage("Nothing changed."); return; } diff --git a/src/com/onarandombox/MultiverseCore/commands/ModifyClearCommand.java b/src/com/onarandombox/MultiverseCore/commands/ModifyClearCommand.java index 6a9e90ac..5b28f980 100644 --- a/src/com/onarandombox/MultiverseCore/commands/ModifyClearCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/ModifyClearCommand.java @@ -5,6 +5,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -13,17 +14,14 @@ public class ModifyClearCommand extends MultiverseCommand { public ModifyClearCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Modify a World (Clear a property)"; - this.commandDesc = "Removes all values from a property. This will work on properties that contain lists."; - this.commandUsage = "/mvmodify" + ChatColor.GREEN + " CLEAR {PROPERTY}" + ChatColor.GOLD + " [WORLD] "; - this.minimumArgLength = 1; - this.maximumArgLength = 2; - this.commandKeys.add("mvmodify clear"); - this.commandKeys.add("mv modify clear"); - this.commandKeys.add("mvm clear"); - this.commandKeys.add("mvmclear"); - this.permission = "multiverse.world.modify"; - this.opRequired = true; + this.setName("Modify a World (Clear a property)"); + this.setCommandUsage("/mvmodify" + ChatColor.GREEN + " clear {PROPERTY}" + ChatColor.GOLD + " [WORLD]"); + this.setArgRange(1, 2); + this.addKey("mvm clear"); + this.addKey("mvmclear"); + this.addKey("mv modify clear"); + this.addKey("mvmodify clear"); + this.setPermission("multiverse.core.modify.clear", "Removes all values from a property. This will work on properties that contain lists.", PermissionDefault.OP); } @Override @@ -35,8 +33,8 @@ public class ModifyClearCommand extends MultiverseCommand { } if (args.size() == 1 && p == null) { sender.sendMessage(ChatColor.RED + "From the console, WORLD is required."); - sender.sendMessage(this.commandDesc); - sender.sendMessage(this.commandUsage); + sender.sendMessage(this.getCommandDesc()); + sender.sendMessage(this.getCommandUsage()); sender.sendMessage("Nothing changed."); return; } diff --git a/src/com/onarandombox/MultiverseCore/commands/ModifyCommand.java b/src/com/onarandombox/MultiverseCore/commands/ModifyCommand.java index 2747ceb7..3a721b3c 100644 --- a/src/com/onarandombox/MultiverseCore/commands/ModifyCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/ModifyCommand.java @@ -1,9 +1,13 @@ package com.onarandombox.MultiverseCore.commands; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -24,16 +28,18 @@ public class ModifyCommand extends MultiverseCommand { public ModifyCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Modify a World"; - this.commandDesc = "MVModify requires an extra parameter: SET,ADD,REMOVE or CLEAR. See below for usage."; - this.commandUsage = "/mvmodify" + ChatColor.GREEN + " {SET|ADD|REMOVE|CLEAR} ..."; - // Make it so they can NEVER execute this one - this.minimumArgLength = 1; - this.maximumArgLength = 0; - this.commandKeys.add("mvmodify"); - this.commandKeys.add("mvm"); - this.permission = "multiverse.world.modify"; - this.opRequired = true; + this.setName("Modify a World"); + this.setCommandUsage("/mvmodify" + ChatColor.GREEN + " {set|add|remove|clear} ..."); + this.setArgRange(2, 3); + this.addKey("mvm"); + this.addKey("mvmodify"); + Map children = new HashMap(); + children.put("multiverse.core.modify.add", true); + children.put("multiverse.core.modify.modify", true); + children.put("multiverse.core.modify.clear", true); + children.put("multiverse.core.modify.remove", true); + Permission modify = new Permission("multiverse.core.modify", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP, children); + this.setPermission(modify); } protected static boolean validateAction(Action action, String property) { diff --git a/src/com/onarandombox/MultiverseCore/commands/ModifyRemoveCommand.java b/src/com/onarandombox/MultiverseCore/commands/ModifyRemoveCommand.java index 8e03fc91..a62d312c 100644 --- a/src/com/onarandombox/MultiverseCore/commands/ModifyRemoveCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/ModifyRemoveCommand.java @@ -5,6 +5,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -13,17 +14,14 @@ public class ModifyRemoveCommand extends MultiverseCommand { public ModifyRemoveCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Modify a World"; - this.commandDesc = "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used."; - this.commandUsage = "/mvmodify" + ChatColor.GREEN + "REMOVE {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]"; - this.minimumArgLength = 2; - this.maximumArgLength = 3; - this.commandKeys.add("mvmodify remove"); - this.commandKeys.add("mv modify remove"); - this.commandKeys.add("mvm remove"); - this.commandKeys.add("mvmremove"); - this.permission = "multiverse.world.modify"; - this.opRequired = true; + this.setName("Modify a World (Remove a value)"); + this.setCommandUsage("/mvmodify" + ChatColor.GREEN + "REMOVE {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]"); + this.setArgRange(2, 3); + this.addKey("mvm remove"); + this.addKey("mvmremove"); + this.addKey("mv modify remove"); + this.addKey("mvmodify remove"); + this.setPermission("multiverse.core.modify.remove", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP); } @Override @@ -36,8 +34,8 @@ public class ModifyRemoveCommand extends MultiverseCommand { if (args.size() == 2 && p == null) { sender.sendMessage(ChatColor.RED + "From the console, WORLD is required."); - sender.sendMessage(this.commandDesc); - sender.sendMessage(this.commandUsage); + sender.sendMessage(this.getCommandDesc()); + sender.sendMessage(this.getCommandUsage()); sender.sendMessage("Nothing changed."); return; } diff --git a/src/com/onarandombox/MultiverseCore/commands/ModifySetCommand.java b/src/com/onarandombox/MultiverseCore/commands/ModifySetCommand.java index 9596a4be..3f4679d8 100644 --- a/src/com/onarandombox/MultiverseCore/commands/ModifySetCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/ModifySetCommand.java @@ -5,6 +5,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -13,17 +14,14 @@ public class ModifySetCommand extends MultiverseCommand { public ModifySetCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Modify a World (Set a value)"; - this.commandDesc = "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used."; - this.commandUsage = "/mvmodify" + ChatColor.GREEN + " set {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]"; - this.minimumArgLength = 2; - this.maximumArgLength = 3; - this.commandKeys.add("mvmodify set"); - this.commandKeys.add("mv modify set"); - this.commandKeys.add("mvm set"); - this.commandKeys.add("mvmset"); - this.permission = "multiverse.world.modify"; - this.opRequired = true; + this.setName("Modify a World (Set a value)"); + this.setCommandUsage("/mvmodify" + ChatColor.GREEN + " set {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]"); + this.setArgRange(2, 3); + this.addKey("mvm set"); + this.addKey("mvmset"); + this.addKey("mv modify set"); + this.addKey("mvmodify set"); + this.setPermission("multiverse.core.modify.set", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP); } @Override @@ -36,8 +34,8 @@ public class ModifySetCommand extends MultiverseCommand { if (args.size() == 2 && p == null) { sender.sendMessage("From the command line, WORLD is required."); - sender.sendMessage(this.commandDesc); - sender.sendMessage(this.commandUsage); + sender.sendMessage(this.getCommandDesc()); + sender.sendMessage(this.getCommandUsage()); sender.sendMessage("Nothing changed."); return; } diff --git a/src/com/onarandombox/MultiverseCore/commands/PurgeCommand.java b/src/com/onarandombox/MultiverseCore/commands/PurgeCommand.java index abbcb6bf..2e0a94ab 100644 --- a/src/com/onarandombox/MultiverseCore/commands/PurgeCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/PurgeCommand.java @@ -7,6 +7,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -16,15 +17,12 @@ public class PurgeCommand extends MultiverseCommand { public PurgeCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Purge the world "; - this.commandDesc = "Removed the specified type of mob from the specified world."; - this.commandUsage = "/mvpurge" + ChatColor.GOLD + " [WORLD|all] " + ChatColor.GREEN + "{all|animals|monsters|MOBNAME}"; - this.minimumArgLength = 1; - this.maximumArgLength = 2; - this.commandKeys.add("mvpurge"); - this.commandKeys.add("mv purge"); - this.permission = "multiverse.world.purge"; - this.opRequired = true; + this.setName("Purge World of Creatures"); + this.setCommandUsage("/mvpurge" + ChatColor.GOLD + " [WORLD|all] " + ChatColor.GREEN + "{all|animals|monsters|MOBNAME}"); + this.setArgRange(1, 2); + this.addKey("mvpurge"); + this.addKey("mv purge"); + this.setPermission("multiverse.core.purge", "Removed the specified type of mob from the specified world.", PermissionDefault.OP); } @Override @@ -35,7 +33,7 @@ public class PurgeCommand extends MultiverseCommand { } if (args.size() == 1 && p == null) { sender.sendMessage("This command requires a WORLD when being run from the console!"); - sender.sendMessage(this.commandUsage); + sender.sendMessage(this.getCommandUsage()); return; } String worldName = null; diff --git a/src/com/onarandombox/MultiverseCore/commands/ReloadCommand.java b/src/com/onarandombox/MultiverseCore/commands/ReloadCommand.java index 5da60b6f..dc0edc9b 100644 --- a/src/com/onarandombox/MultiverseCore/commands/ReloadCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/ReloadCommand.java @@ -1,9 +1,9 @@ package com.onarandombox.MultiverseCore.commands; import java.util.List; -import java.util.logging.Level; import org.bukkit.command.CommandSender; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -11,24 +11,20 @@ public class ReloadCommand extends MultiverseCommand { public ReloadCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Reload"; - this.commandDesc = "Reloads worlds.yml and config.yml."; - this.commandUsage = "/mvreload"; - this.minimumArgLength = 0; - this.maximumArgLength = 0; - this.commandKeys.add("mvreload"); - this.commandKeys.add("mv reload"); - this.commandKeys.add("mvr"); - this.permission = "multiverse.reload"; - this.opRequired = true; + this.setName("Reload Configs"); + this.setCommandUsage("/mvreload"); + this.setArgRange(0, 0); + this.addKey("mvreload"); + this.addKey("mv reload"); + this.setPermission("multiverse.core.reload", "Reloads worlds.yml and config.yml.", PermissionDefault.OP); } @Override public void runCommand(CommandSender sender, List args) { - this.plugin.log(Level.INFO, "Reloading Multiverse-Core config.yml and worlds.yml"); + sender.sendMessage("Reloading Multiverse-Core config.yml and worlds.yml"); this.plugin.loadConfigs(); this.plugin.loadWorlds(true); - this.plugin.log(Level.INFO, "Reload Complete!"); + sender.sendMessage("Reload Complete!"); } } diff --git a/src/com/onarandombox/MultiverseCore/commands/RemoveCommand.java b/src/com/onarandombox/MultiverseCore/commands/RemoveCommand.java index e34f4ba1..9c988a47 100644 --- a/src/com/onarandombox/MultiverseCore/commands/RemoveCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/RemoveCommand.java @@ -4,6 +4,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -11,15 +12,11 @@ public class RemoveCommand extends MultiverseCommand { public RemoveCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Remove World"; - this.commandDesc = "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder."; - this.commandUsage = "/mvremove " + ChatColor.GREEN + " {WORLD} "; - this.minimumArgLength = 1; - this.maximumArgLength = 1; - this.commandKeys.add("mvremove"); - this.commandKeys.add("mv remove"); - this.permission = "multiverse.world.remove"; - this.opRequired = true; + this.setName("Remove World"); + this.setCommandUsage("/mvremove " + ChatColor.GREEN + " {WORLD}"); + this.setArgRange(1, 1); + this.addKey("mvcoord"); + this.setPermission("multiverse.core.remove", "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder.", PermissionDefault.OP); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java b/src/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java index 6c362dbd..8e47eb5e 100644 --- a/src/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java @@ -6,6 +6,7 @@ import org.bukkit.Location; import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -13,16 +14,13 @@ public class SetSpawnCommand extends MultiverseCommand { public SetSpawnCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Set World Spawn"; - this.commandDesc = "Sets the spawn for the current world."; - this.commandUsage = "/mvsetspawn"; - this.minimumArgLength = 0; - this.maximumArgLength = 0; - this.commandKeys.add("mvsetspawn"); - this.commandKeys.add("mvss"); - this.commandKeys.add("mv set spawn"); - this.permission = "multiverse.world.spawn.set"; - this.opRequired = true; + this.setName("Set World Spawn"); + this.setCommandUsage("/mvsetspawn"); + this.setArgRange(0, 0); + this.addKey("mvsetspawn"); + this.addKey("mvss"); + this.addKey("mv set spawn"); + this.setPermission("multiverse.core.spawn.set", "Sets the spawn for the current world.", PermissionDefault.OP); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/SleepCommand.java b/src/com/onarandombox/MultiverseCore/commands/SleepCommand.java index c0a947b9..9b778294 100644 --- a/src/com/onarandombox/MultiverseCore/commands/SleepCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/SleepCommand.java @@ -4,6 +4,7 @@ import java.util.List; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVPlayerSession; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -12,14 +13,11 @@ public class SleepCommand extends MultiverseCommand { public SleepCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Go To Sleep"; - this.commandDesc = "Takes you the latest bed you've slept in."; - this.commandUsage = "/mv sleep"; - this.minimumArgLength = 0; - this.maximumArgLength = 0; - this.commandKeys.add("mv sleep"); - this.permission = "multiverse.sleep"; - this.opRequired = true; + this.setName("Go to Sleep"); + this.setCommandUsage("/mv sleep"); + this.setArgRange(0, 0); + this.addKey("mv sleep"); + this.setPermission("multiverse.core.sleep", "Takes you the latest bed you've slept in (Currently BROKEN).", PermissionDefault.OP); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/SpawnCommand.java b/src/com/onarandombox/MultiverseCore/commands/SpawnCommand.java index ea10e311..4ec4eb43 100644 --- a/src/com/onarandombox/MultiverseCore/commands/SpawnCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/SpawnCommand.java @@ -5,6 +5,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -12,16 +13,13 @@ public class SpawnCommand extends MultiverseCommand { public SpawnCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Spawn"; - this.commandDesc = "Teleports target player to the Spawn Point of the world they are in."; - this.commandUsage = "/mvspawn" + ChatColor.GOLD + " [PLAYER]"; - this.minimumArgLength = 0; - this.maximumArgLength = 1; - this.commandKeys.add("mvspawn"); - this.commandKeys.add("mv spawn"); - this.commandKeys.add("mvs"); - this.permission = "multiverse.world.spawn"; - this.opRequired = false; + this.setName("Spawn"); + this.setCommandUsage("/mvspawn" + ChatColor.GOLD + " [PLAYER]"); + this.setArgRange(0, 1); + this.addKey("mvspawn"); + this.addKey("mv spawn"); + this.addKey("mvs"); + this.setPermission("multiverse.core.spawn.use", "Teleports target player to the Spawn Point of the world they are in.", PermissionDefault.OP); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/TeleportCommand.java b/src/com/onarandombox/MultiverseCore/commands/TeleportCommand.java index a5480052..aa746247 100644 --- a/src/com/onarandombox/MultiverseCore/commands/TeleportCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/TeleportCommand.java @@ -1,11 +1,15 @@ package com.onarandombox.MultiverseCore.commands; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVTeleport; import com.onarandombox.MultiverseCore.MVWorld; @@ -18,16 +22,21 @@ public class TeleportCommand extends MultiverseCommand { public TeleportCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Teleport"; - this.commandDesc = "Teleports target player to a different world. If no player is specified, teleports you instead."; - this.commandUsage = "/mvtp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}"; - this.minimumArgLength = 1; - this.maximumArgLength = 2; - this.commandKeys.add("mvtp"); - this.commandKeys.add("mv tp"); - this.playerTeleporter = new MVTeleport(plugin); - this.permission = "multiverse.world.tp"; - this.opRequired = true; + Permission self = new Permission("multiverse.core.tp.self", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP); + Permission other = new Permission("multiverse.core.tp.self", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP); + this.plugin.getServer().getPluginManager().addPermission(self); + this.plugin.getServer().getPluginManager().addPermission(other); + Map children = new HashMap(); + children.put(self.getName(), true); + children.put(other.getName(), true); + Permission tp = new Permission("multiverse.core.tp", "Allows teleportation to other worlds.", PermissionDefault.OP, children); + + this.setName("Teleport"); + this.setCommandUsage("/mvtp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}"); + this.setArgRange(1, 2); + this.addKey("mvtp"); + this.addKey("mv tp"); + this.setPermission(tp); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/UnloadCommand.java b/src/com/onarandombox/MultiverseCore/commands/UnloadCommand.java index bf306f60..461c3952 100644 --- a/src/com/onarandombox/MultiverseCore/commands/UnloadCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/UnloadCommand.java @@ -4,6 +4,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -11,15 +12,12 @@ public class UnloadCommand extends MultiverseCommand { public UnloadCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Unload World"; - this.commandDesc = "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file."; - this.commandUsage = "/mvunload" + ChatColor.GREEN + " {WORLD} "; - this.minimumArgLength = 1; - this.maximumArgLength = 1; - this.commandKeys.add("mvunload"); - this.commandKeys.add("mv unload"); - this.permission = "multiverse.world.unload"; - this.opRequired = true; + this.setName("Unload World"); + this.setCommandUsage("/mvunload" + ChatColor.GREEN + " {WORLD}"); + this.setArgRange(1, 1); + this.addKey("mvunload"); + this.addKey("mv unload"); + this.setPermission("multiverse.core.unload", "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.", PermissionDefault.OP); } @Override diff --git a/src/com/onarandombox/MultiverseCore/commands/WhoCommand.java b/src/com/onarandombox/MultiverseCore/commands/WhoCommand.java index 2083b447..726617aa 100644 --- a/src/com/onarandombox/MultiverseCore/commands/WhoCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/WhoCommand.java @@ -6,6 +6,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionDefault; import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; @@ -14,14 +15,11 @@ public class WhoCommand extends MultiverseCommand { public WhoCommand(MultiverseCore plugin) { super(plugin); - this.commandName = "Who"; - this.commandDesc = "States who is in what world."; - this.commandUsage = "/mvwho" + ChatColor.GOLD + " [WORLD]"; - this.minimumArgLength = 0; - this.maximumArgLength = 1; - this.commandKeys.add("mvwho"); - this.permission = "multiverse.world.list.who"; - this.opRequired = false; + this.setName("Who?"); + this.setCommandUsage("/mvwho" + ChatColor.GOLD + " [WORLD]"); + this.setArgRange(0, 1); + this.addKey("mvwho"); + this.setPermission("multiverse.core.list.who", "States who is in what world.", PermissionDefault.TRUE); } @Override