diff --git a/src/net/milkbowl/vault/permission/Permission.java b/src/net/milkbowl/vault/permission/Permission.java index d4d258f..17d9370 100644 --- a/src/net/milkbowl/vault/permission/Permission.java +++ b/src/net/milkbowl/vault/permission/Permission.java @@ -24,6 +24,7 @@ import java.util.logging.Logger; import net.milkbowl.vault.Vault; import org.bukkit.World; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo; @@ -77,6 +78,17 @@ public abstract class Permission { return playerHas(world.getName(), player, permission); } + /** + * Checks if a CommandSender has a permission node. + * For easy checking of a commandsender + * @param sender + * @param permission + * @return true if the sender has the permission + */ + public boolean has(CommandSender sender, String permission) { + return sender.hasPermission(permission); + } + /** * Checks if player has a permission node. (Short for playerHas(...) * @param player Player Object diff --git a/src/net/milkbowl/vault/permission/plugins/Permission_Permissions3.java b/src/net/milkbowl/vault/permission/plugins/Permission_Permissions3.java index 45eef43..dd0dc48 100644 --- a/src/net/milkbowl/vault/permission/plugins/Permission_Permissions3.java +++ b/src/net/milkbowl/vault/permission/plugins/Permission_Permissions3.java @@ -27,6 +27,8 @@ import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.craftbukkit.command.ColouredConsoleSender; import org.bukkit.entity.Player; import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Type; @@ -114,6 +116,15 @@ public class Permission_Permissions3 extends Permission { return name; } + @Override + public boolean has(CommandSender sender, String permission) { + if (sender.isOp() || sender instanceof ColouredConsoleSender) { + return true; + } else { + return has(((Player) sender).getWorld().getName(), sender.getName(), permission); + } + } + @Override public boolean playerAddGroup(String worldName, String playerName, String groupName) { if (worldName == null)