added permissions worldguard.region.priority.own and worldguard.region.priority.all

This commit is contained in:
Redecouverte 2011-02-27 18:43:39 +01:00
parent c74433422a
commit 162cd20f80
2 changed files with 16 additions and 2 deletions

View File

@ -38,7 +38,8 @@ worldguard.region.save
worldguard.region.setparent.own
worldguard.region.setparent.all
worldguard.region.priority
worldguard.region.priority.own
worldguard.region.priority.all
worldguard.reloadwg

View File

@ -18,6 +18,7 @@
*/
package com.sk89q.worldguard.bukkit.commands;
import com.sk89q.worldguard.bukkit.BukkitPlayer;
import com.sk89q.worldguard.bukkit.WorldGuardConfiguration;
import com.sk89q.worldguard.bukkit.WorldGuardWorldConfiguration;
import com.sk89q.worldguard.bukkit.commands.CommandHandler.CommandHandlingException;
@ -26,6 +27,7 @@
import java.io.IOException;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*
@ -36,7 +38,6 @@ public class CommandRegionPriority extends WgRegionCommand {
public boolean handle(CommandSender sender, String senderName, String command, String[] args, WorldGuardConfiguration cfg, WorldGuardWorldConfiguration wcfg) throws CommandHandlingException {
CommandHandler.checkArgs(args, 1, 2, "/region priority <id> (<value>)");
cfg.checkRegionPermission(sender, "region.priority");
try {
String id = args[0].toLowerCase();
@ -50,6 +51,18 @@ public boolean handle(CommandSender sender, String senderName, String command, S
ProtectedRegion existing = mgr.getRegion(id);
if (sender instanceof Player) {
Player player = (Player) sender;
if (existing.isOwner(BukkitPlayer.wrapPlayer(cfg, player))) {
cfg.checkRegionPermission(sender, "region.priority.own");
} else {
cfg.checkRegionPermission(sender, "region.priority.all");
}
} else {
cfg.checkRegionPermission(sender, "region.priority.all");
}
if (args.length > 1) {
try {
Integer prio = Integer.valueOf(args[1]);