mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-28 20:19:00 +01:00
fixed permissions for commands, hasPermission() does "worldguard." + perm so do prefix with "worldguard."
This commit is contained in:
parent
9c91f06c5d
commit
2641cb7d4f
@ -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;
|
||||
|
||||
|
@ -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];
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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!");
|
||||
|
@ -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) {
|
||||
|
@ -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());
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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());
|
||||
|
@ -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 {
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user