fixed permissions for commands, hasPermission() does "worldguard." + perm so do prefix with "worldguard."

This commit is contained in:
Redecouverte 2011-03-09 13:36:10 +01:00
parent 9c91f06c5d
commit 2641cb7d4f
22 changed files with 49 additions and 49 deletions

View File

@ -39,7 +39,7 @@ public class CommandAllowFire extends WgCommand {
public boolean handle(CommandSender sender, String senderName,
String command, String[] args, GlobalConfiguration cfg, WorldGuardPlugin plugin)
throws CommandHandlingException {
plugin.checkPermission(sender, "worldguard.fire-toggle.allow");
plugin.checkPermission(sender, "fire-toggle.allow");
String worldName;

View File

@ -58,7 +58,7 @@ public boolean handle(CommandSender sender, String senderName,
CommandHandler.checkArgs(args, 1, 2);
plugin.checkPermission(player, "worldguard.regions.buy");
plugin.checkPermission(player, "regions.buy");
String id = args[0];

View File

@ -42,7 +42,7 @@ public boolean handle(CommandSender sender, String senderName,
// Allow setting other people invincible
if (args.length > 0) {
plugin.checkPermission(sender, "worldguard.god.other");
plugin.checkPermission(sender, "god.other");
Player other = matchSinglePlayer(cfg.getWorldGuardPlugin().getServer(), args[0]);
if (other == null) {
@ -60,7 +60,7 @@ public boolean handle(CommandSender sender, String senderName,
}
// Invincibility for one's self
} else if(sender instanceof Player) {
plugin.checkPermission(sender, "worldguard.god");
plugin.checkPermission(sender, "god");
Player player = (Player)sender;
if (!cfg.isInvinciblePlayer(player.getName())) {
cfg.addInvinciblePlayer(player.getName());

View File

@ -42,7 +42,7 @@ public boolean handle(CommandSender sender, String senderName,
// Allow healing other people
if (args.length > 0) {
plugin.checkPermission(sender, "worldguard.heal.other");
plugin.checkPermission(sender, "heal.other");
Player other = matchSinglePlayer(cfg.getWorldGuardPlugin().getServer(), args[0]);
if (other == null) {
@ -53,7 +53,7 @@ public boolean handle(CommandSender sender, String senderName,
other.sendMessage(ChatColor.YELLOW + senderName + " has healed you!");
}
} else if (sender instanceof Player){
plugin.checkPermission(sender, "worldguard.heal");
plugin.checkPermission(sender, "heal");
Player player = (Player)sender;
player.setHealth(20);
player.sendMessage(ChatColor.YELLOW + "You have been healed!");

View File

@ -45,7 +45,7 @@ public boolean handle(CommandSender sender, String senderName,
}
Player player = (Player) sender;
plugin.checkPermission(sender, "worldguard.locate");
plugin.checkPermission(sender, "locate");
CommandHandler.checkArgs(args, 0, 3);
if (args.length == 1) {

View File

@ -51,12 +51,12 @@ public boolean handle(CommandSender sender, String senderName,
if (cmdIsOwner) {
CommandHandler.checkArgs(args, 2, -1, "/region addowner <id> [player1 [group1 [players/groups...]]]");
permOwn = "worldguard.region.addowner.own";
permAll = "worldguard.region.addowner";
permOwn = "region.addowner.own";
permAll = "region.addowner";
} else {
CommandHandler.checkArgs(args, 2, -1, "/region addmember <id> [player1 [group1 [players/groups...]]]");
permOwn = "worldguard.region.addmember.own";
permAll = "worldguard.region.addmember";
permOwn = "region.addmember.own";
permAll = "region.addmember";
}
RegionManager mgr = cfg.getWorldGuardPlugin().getGlobalRegionManager().getRegionManager(wcfg.getWorldName());

View File

@ -69,7 +69,7 @@ public boolean handle(CommandSender sender, String senderName,
return true;
}
plugin.checkPermission(player, "worldguard.region.claim");
plugin.checkPermission(player, "region.claim");
CommandHandler.checkArgs(args, 1, 1, "/region claim <id>");
try {

View File

@ -65,7 +65,7 @@ public boolean handle(CommandSender sender, String senderName,
sender.sendMessage(ChatColor.RED + "WorldEdit must be installed and enabled!");
return true;
}
plugin.checkPermission(sender, "worldguard.region.define");
plugin.checkPermission(sender, "region.define");
CommandHandler.checkArgs(args, 1, -1, "/region define <id> [owner1 [owner2 [owners...]]]");
try {

View File

@ -59,12 +59,12 @@ public boolean handle(CommandSender sender, String senderName,
Player player = (Player) sender;
if (existing.isOwner(BukkitPlayer.wrapPlayer(plugin, player))) {
plugin.checkPermission(sender, "worldguard.region.delete.own");
plugin.checkPermission(sender, "region.delete.own");
} else {
plugin.checkPermission(sender, "worldguard.region.delete");
plugin.checkPermission(sender, "region.delete");
}
} else {
plugin.checkPermission(sender, "worldguard.region.delete");
plugin.checkPermission(sender, "region.delete");
}
mgr.removeRegion(id);

View File

@ -76,14 +76,14 @@ public boolean handle(CommandSender sender, String senderName,
Player player = (Player) sender;
if (region.isOwner(BukkitPlayer.wrapPlayer(plugin, player))) {
plugin.checkPermission(sender, "worldguard.region.flag.own");
plugin.checkPermission(sender, "region.flag.own");
} else if (region.isMember(BukkitPlayer.wrapPlayer(plugin, player))) {
plugin.checkPermission(sender, "worldguard.region.flag.member");
plugin.checkPermission(sender, "region.flag.member");
} else {
plugin.checkPermission(sender, "worldguard.region.flag");
plugin.checkPermission(sender, "region.flag");
}
} else {
plugin.checkPermission(sender, "worldguard.region.flag");
plugin.checkPermission(sender, "region.flag");
}
RegionFlagInfo nfo = FlagDatabase.getFlagInfoFromName(nameStr);

View File

@ -61,14 +61,14 @@ public boolean handle(CommandSender sender, String senderName,
Player player = (Player) sender;
if (region.isOwner(BukkitPlayer.wrapPlayer(plugin, player))) {
plugin.checkPermission(sender, "worldguard.region.info.own");
plugin.checkPermission(sender, "region.info.own");
} else if (region.isMember(BukkitPlayer.wrapPlayer(plugin, player))) {
plugin.checkPermission(sender, "worldguard.region.info.member");
plugin.checkPermission(sender, "region.info.member");
} else {
plugin.checkPermission(sender, "worldguard.region.info");
plugin.checkPermission(sender, "region.info");
}
} else {
plugin.checkPermission(sender, "worldguard.region.info");
plugin.checkPermission(sender, "region.info");
}
RegionFlagContainer flags = region.getFlags();

View File

@ -42,7 +42,7 @@ public boolean handle(CommandSender sender, String senderName,
WorldConfiguration wcfg, WorldGuardPlugin plugin)
throws CommandHandlingException {
plugin.checkPermission(sender, "worldguard.region.list");
plugin.checkPermission(sender, "region.list");
CommandHandler.checkArgs(args, 0, 1, "/region list [page]");
int page = 0;

View File

@ -40,7 +40,7 @@ public boolean handle(CommandSender sender, String senderName,
WorldConfiguration wcfg, WorldGuardPlugin plugin)
throws CommandHandlingException {
plugin.checkPermission(sender, "worldguard.region.load");
plugin.checkPermission(sender, "region.load");
CommandHandler.checkArgs(args, 0, 0, "/region load");
try {

View File

@ -61,12 +61,12 @@ public boolean handle(CommandSender sender, String senderName,
Player player = (Player) sender;
if (existing.isOwner(BukkitPlayer.wrapPlayer(plugin, player))) {
plugin.checkPermission(sender, "worldguard.region.priority.own");
plugin.checkPermission(sender, "region.priority.own");
} else {
plugin.checkPermission(sender, "worldguard.region.priority");
plugin.checkPermission(sender, "region.priority");
}
} else {
plugin.checkPermission(sender, "worldguard.region.priority");
plugin.checkPermission(sender, "region.priority");
}
if (args.length > 1) {

View File

@ -51,12 +51,12 @@ public boolean handle(CommandSender sender, String senderName,
if (cmdIsOwner) {
CommandHandler.checkArgs(args, 2, -1, "/region removeowner <id> [player1 [group1 [players/groups...]]]");
permOwn = "worldguard.region.removeowner.own";
permAll = "worldguard.region.removeowner";
permOwn = "region.removeowner.own";
permAll = "region.removeowner";
} else {
CommandHandler.checkArgs(args, 2, -1, "/region removemember <id> [player1 [group1 [players/groups...]]]");
permOwn = "worldguard.region.removemember.own";
permAll = "worldguard.region.removemember";
permOwn = "region.removemember.own";
permAll = "region.removemember";
}
RegionManager mgr = cfg.getWorldGuardPlugin().getGlobalRegionManager().getRegionManager(wcfg.getWorldName());

View File

@ -41,7 +41,7 @@ public boolean handle(CommandSender sender, String senderName,
WorldConfiguration wcfg, WorldGuardPlugin plugin)
throws CommandHandlingException {
plugin.checkPermission(sender, "worldguard.region.save");
plugin.checkPermission(sender, "region.save");
CommandHandler.checkArgs(args, 0, 0, "/region save");
try {

View File

@ -61,12 +61,12 @@ public boolean handle(CommandSender sender, String senderName,
Player player = (Player) sender;
if (region.isOwner(BukkitPlayer.wrapPlayer(plugin, player))) {
plugin.checkPermission(sender, "worldguard.region.setparent.own");
plugin.checkPermission(sender, "region.setparent.own");
} else {
plugin.checkPermission(sender, "worldguard.region.setparent");
plugin.checkPermission(sender, "region.setparent");
}
} else {
plugin.checkPermission(sender, "worldguard.region.setparent");
plugin.checkPermission(sender, "region.setparent");
}
ProtectedRegion parent = null;
@ -84,12 +84,12 @@ public boolean handle(CommandSender sender, String senderName,
Player player = (Player) sender;
if (parent.isOwner(BukkitPlayer.wrapPlayer(plugin, player))) {
plugin.checkPermission(sender, "worldguard.region.setparent.own");
plugin.checkPermission(sender, "region.setparent.own");
} else {
plugin.checkPermission(sender, "worldguard.region.setparent");
plugin.checkPermission(sender, "region.setparent");
}
} else {
plugin.checkPermission(sender, "worldguard.region.setparent");
plugin.checkPermission(sender, "region.setparent");
}
}

View File

@ -38,7 +38,7 @@ public boolean handle(CommandSender sender, String senderName,
String command, String[] args, GlobalConfiguration cfg, WorldGuardPlugin plugin)
throws CommandHandlingException {
plugin.checkPermission(sender, "worldguard.reload");
plugin.checkPermission(sender, "reload");
CommandHandler.checkArgs(args, 0, 0);
LoggerToChatHandler handler = null;

View File

@ -42,7 +42,7 @@ public boolean handle(CommandSender sender, String senderName,
// Allow killing other people
if (args.length > 0) {
plugin.checkPermission(sender, "worldguard.slay.other");
plugin.checkPermission(sender, "slay.other");
Player other = BukkitUtil.matchSinglePlayer(cfg.getWorldGuardPlugin().getServer(), args[0]);
if (other == null) {
@ -53,7 +53,7 @@ public boolean handle(CommandSender sender, String senderName,
other.sendMessage(ChatColor.YELLOW + senderName + " has killed you!");
}
} else if (sender instanceof Player) {
plugin.checkPermission(sender, "worldguard.slay");
plugin.checkPermission(sender, "slay");
Player player = (Player)sender;
player.setHealth(0);

View File

@ -44,7 +44,7 @@ public boolean handle(CommandSender sender, String senderName,
return true;
}
Player player = (Player) sender;
plugin.checkPermission(sender, "worldguard.stack");
plugin.checkPermission(sender, "stack");
CommandHandler.checkArgs(args, 0, 0);
ItemStack[] items = player.getInventory().getContents();

View File

@ -39,7 +39,7 @@ public boolean handle(CommandSender sender, String senderName,
String command, String[] args, GlobalConfiguration cfg, WorldGuardPlugin plugin)
throws CommandHandlingException {
plugin.checkPermission(sender, "worldguard.fire-toggle.stop");
plugin.checkPermission(sender, "fire-toggle.stop");
CommandHandler.checkArgs(args, 0, 0);
String worldName;

View File

@ -35,14 +35,14 @@ public boolean handle(CommandSender sender, String senderName,
}
Player player = (Player) sender;
plugin.checkPermission(sender, "worldguard.region.teleport");
plugin.checkPermission(sender, "region.teleport");
CommandHandler.checkArgs(args, 1, 2, "/tpregion <region name> {spawn}");
String id = args[0];
Boolean spawn = false;
if (args.length == 2 && args[1].equals("spawn")) {
plugin.checkPermission(sender, "worldguard.region.teleport.spawn");
plugin.checkPermission(sender, "region.teleport.spawn");
spawn = true;
}
RegionManager mgr = cfg.getWorldGuardPlugin().getGlobalRegionManager().getRegionManager(player.getWorld().getName());
@ -59,11 +59,11 @@ public boolean handle(CommandSender sender, String senderName,
LocalPlayer lPlayer = BukkitPlayer.wrapPlayer(plugin, player);
if (flagright == RegionGroup.OWNER) {
if (!region.isOwner(lPlayer)) {
plugin.checkPermission(sender, "worldguard.region.teleport.override");
plugin.checkPermission(sender, "region.teleport.override");
}
} else if (flagright == RegionGroup.MEMBER) {
if (!region.isMember(lPlayer)) {
plugin.checkPermission(sender, "worldguard.region.teleport.override");
plugin.checkPermission(sender, "region.teleport.override");
}
}