diff --git a/lib/bukkit-1.7.2-R0.2.jar b/lib/bukkit-1.7.2-R0.2.jar deleted file mode 100644 index 2a13e19..0000000 Binary files a/lib/bukkit-1.7.2-R0.2.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index 920572b..6f43f8f 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms UTF-8 - 1.7.2-R0.3 + 1.7.9-R0.1-SNAPSHOT net.milkbowl.vault.Vault diff --git a/src/net/milkbowl/vault/permission/Permission.java b/src/net/milkbowl/vault/permission/Permission.java index eb5a3f9..98b3f69 100644 --- a/src/net/milkbowl/vault/permission/Permission.java +++ b/src/net/milkbowl/vault/permission/Permission.java @@ -15,8 +15,10 @@ */ package net.milkbowl.vault.permission; +import java.util.UUID; import java.util.logging.Logger; +import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -98,7 +100,7 @@ public abstract class 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 @@ -137,6 +139,21 @@ public abstract class Permission { } return playerHas(world.getName(), player, permission); } + + /** + * Checks if player has a permission node. + * + * @param world World Object + * @param playerId UUID of the player + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerHas(World world, UUID playerId, String permission) { + if (world == null) { + return has((String) null, Bukkit.getOfflinePlayer(playerId).getName(), permission); + } + return has(world.getName(), Bukkit.getOfflinePlayer(playerId).getName(), permission); + } /** * Checks if player has a permission node. @@ -177,6 +194,23 @@ public abstract class Permission { return playerAdd(world.getName(), player, permission); } + /** + * Add permission to a player. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param playerId UUId of the player + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerAdd(World world, UUID playerId, String permission) { + if (world == null) { + return playerAdd((String) null, Bukkit.getOfflinePlayer(playerId).getName(), permission); + } + return playerAdd(world.getName(), Bukkit.getOfflinePlayer(playerId).getName(), permission); + } + /** * Add permission to a player ONLY for the world the player is currently on. * This is a world-specific operation, if you want to add global permission you must explicitly use NULL for the world. @@ -206,6 +240,23 @@ public abstract class Permission { } return playerAddTransient(p, permission); } + + /** + * Add transient permission to a player. + * This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e. + * one that only needs the built-in Bukkit API to add transient permissions to a player. + * + * @param UUID playerId + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerAddTransient(UUID playerId, String permission) throws UnsupportedOperationException { + Player p = plugin.getServer().getPlayer(playerId); + if (p == null) { + throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!"); + } + return playerAddTransient(p, permission); + } /** * Add transient permission to a player. @@ -229,6 +280,18 @@ public abstract class Permission { return true; } + /** + * Adds a world specific transient permission to the player - ONLY WORKS IN PEX/P3 - otherwise it defaults to GLOBAL! + * + * @param worldName + * @param playerId + * @param permission + * @return Success or Failure + */ + public boolean playerAddTransient(String worldName, UUID playerId, String permission) { + return playerAddTransient(playerId, permission); + } + /** * Adds a world specific transient permission to the player - ONLY WORKS IN PEX/P3 - otherwise it defaults to GLOBAL! * @param worldName @@ -270,6 +333,17 @@ public abstract class Permission { return playerRemoveTransient(p, permission); } + /** + * Removes a world specific transient permission from the player - Only works in PEX/P3 - otherwise it defaults to Global! + * @param worldName + * @param playerId + * @param permission + * @return Success or Failure + */ + public boolean playerRemoveTransient(String worldName, UUID playerId, String permission) { + return playerRemoveTransient(playerId, permission); + } + /** * Removes a world specific transient permission from the player - Only works in PEX/P3 - otherwise it defaults to Global! * @param worldName @@ -336,6 +410,18 @@ public abstract class Permission { return playerRemoveTransient(p, permission); } + + + /** + * Remove transient permission from a player. + * + * @param UUID playerId + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerRemoveTransient(UUID playerId, String permission) { + return playerRemoveTransient(Bukkit.getPlayer(playerId), permission); + } /** * Remove transient permission from a player. @@ -472,6 +558,23 @@ public abstract class Permission { } return playerInGroup(world.getName(), player, group); } + + /** + * Check if player is member of a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param playerId UUID + * @param group Group name + * @return Success or Failure + */ + public boolean playerInGroup(World world, UUID playerId, String group) { + if (world == null) { + return playerInGroup((String) null, Bukkit.getOfflinePlayer(playerId).getName(), group); + } + return playerInGroup(world.getName(), Bukkit.getOfflinePlayer(playerId).getName(), group); + } /** * Check if player is member of a group. @@ -515,6 +618,23 @@ public abstract class Permission { return playerAddGroup(world.getName(), player, group); } + /** + * Add player to a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param playerId UUID + * @param group Group name + * @return Success or Failure + */ + public boolean playerAddGroup(World world, UUID playerId, String group) { + if (world == null) { + return playerAddGroup((String) null, Bukkit.getOfflinePlayer(playerId).getName(), group); + } + return playerAddGroup(world.getName(), Bukkit.getOfflinePlayer(playerId).getName(), group); + } + /** * Add player to a group. * This will add a player to the group on the current World. This may return odd results if the permission system @@ -556,6 +676,23 @@ public abstract class Permission { } return playerRemoveGroup(world.getName(), player, group); } + + /** + * Remove player from a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param playerId UUID + * @param group Group name + * @return Success or Failure + */ + public boolean playerRemoveGroup(World world, UUID playerId, String group) { + if (world == null) { + return playerRemoveGroup((String) null, Bukkit.getOfflinePlayer(playerId).getName(), group); + } + return playerRemoveGroup(world.getName(), Bukkit.getOfflinePlayer(playerId).getName(), group); + } /** * Remove player from a group. @@ -596,6 +733,19 @@ public abstract class Permission { } return getPlayerGroups(world.getName(), player); } + + /** + * Gets the list of groups that this player has + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param playerId UUID + * @return Array of groups + */ + public String[] getPlayerGroups(World world, UUID playerId) { + return getPlayerGroups(world, Bukkit.getOfflinePlayer(playerId).getName()); + } /** * Returns a list of world-specific groups that this player is currently in. May return unexpected results if @@ -634,6 +784,19 @@ public abstract class Permission { } return getPrimaryGroup(world.getName(), player); } + + /** + * Gets players primary group + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player Player name + * @return Players primary group + */ + public String getPrimaryGroup(World world, UUID playerId) { + return getPrimaryGroup(world, Bukkit.getOfflinePlayer(playerId).getName()); + } /** * Get players primary group