JavaDocs, Throw UnsupportedOperationExceptions when appropriate, finish PlayerPrefix & Suffix

This commit is contained in:
Morgan 2011-08-11 16:55:28 -04:00
parent c3689d8909
commit 42f048a669
6 changed files with 618 additions and 204 deletions

View File

@ -136,22 +136,22 @@ public class Vault extends JavaPlugin {
log.info(String.format("[%s][Permission] GroupManager not found.", getDescription().getName()));
}
// Try to load Permissions (Yeti)
// Try to load Permissions 3 (Yeti)
if (packageExists(new String[] { "com.nijiko.permissions.ModularControl" })) {
Permission nPerms = new Permission_Permissions3(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, nPerms, this, ServicePriority.Low);
log.info(String.format("[%s][Permission] Permissions (Yeti) found: %s", getDescription().getName(), nPerms.isEnabled() ? "Loaded" : "Waiting"));
log.info(String.format("[%s][Permission] Permissions 3 (Yeti) found: %s", getDescription().getName(), nPerms.isEnabled() ? "Loaded" : "Waiting"));
} else {
log.info(String.format("[%s][Permission] Permissions (Yeti) not found.", getDescription().getName()));
log.info(String.format("[%s][Permission] Permissions 3 (Yeti) not found.", getDescription().getName()));
}
//Try to load Permissions (Phoenix)
//Try to load Permissions 2 (Phoenix)
if (packageExists(new String[] { "com.nijiko.permissions.Control"} )) {
Permission oPerms = new Permission_Permissions2(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, oPerms, this, ServicePriority.Lowest);
log.info(String.format("[%s][Permission] Permissions (Phoenix) found: %s", getDescription().getName(), oPerms.isEnabled() ? "Loaded" : "Waiting"));
log.info(String.format("[%s][Permission] Permissions 2 (Phoenix) found: %s", getDescription().getName(), oPerms.isEnabled() ? "Loaded" : "Waiting"));
} else {
log.info(String.format("[%s][Permission] Permissions (Phoenix) not found.", getDescription().getName()));
log.info(String.format("[%s][Permission] Permissions 2 (Phoenix) not found.", getDescription().getName()));
}

View File

@ -38,285 +38,512 @@ public abstract class Permission {
/**
* Checks if player has a permission node. (Short for playerHas(...)
* @param worldName
* @param playerName
* @param world World name
* @param player Player name
* @param permission Permission node
* @return Success or Failure
*/
public boolean has(String worldName, String playerName, String permission) {
return playerHas(worldName, playerName, permission);
public boolean has(String world, String player, String permission) {
return playerHas(world, player, permission);
}
public boolean has(World world, String playerName, String permission) {
return playerHas(world.getName(), playerName, permission);
/**
* Checks if player has a permission node. (Short for playerHas(...)
* @param world World Object
* @param player Player name
* @param permission Permission node
* @return Success or Failure
*/
public boolean has(World world, String player, String permission) {
return playerHas(world.getName(), player, permission);
}
/**
* Checks if player has a permission node. (Short for playerHas(...)
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
*/
public boolean has(Player player, String permission) {
return playerHas(player.getWorld().getName(), player.getName(), permission);
}
/**
* Checks if player has a permission node.
* @param player Player instance
* @param world World name
* @param player Player name
* @param permission Permission node
* @return Success or Failure
*/
abstract public boolean playerHas(String worldName, String playerName, String permission);
public boolean playerHas(World world, String playerName, String permission) {
return playerHas(world.getName(), playerName, permission);
abstract public boolean playerHas(String world, String player, String permission);
/**
* Checks if player has a permission node.
* @param world World Object
* @param player Player name
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerHas(World world, String player, String permission) {
return playerHas(world.getName(), player, permission);
}
/**
* Checks if player has a permission node.
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerHas(Player player, String permission) {
return playerHas(player.getWorld().getName(), player.getName(), permission);
}
/**
* Add permission to a player.
* @param worldName Name of World
* @param playerName Name of Player
* @param world World name
* @param player Player name
* @param permission Permission node
* @return Success or Failure
*/
abstract public boolean playerAdd(String worldName, String playerName, String permission);
public boolean playerAdd(World world, String playerName, String permission) {
return playerAdd(world.getName(), playerName, permission);
abstract public boolean playerAdd(String world, String player, String permission);
/**
* Add permission to a player.
* @param world World Object
* @param player Player name
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerAdd(World world, String player, String permission) {
return playerAdd(world.getName(), player, permission);
}
/**
* Add permission to a player.
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerAdd(Player player, String permission) {
return playerAdd(player.getWorld().getName(), player.getName(), permission);
}
/**
* Remove permission from a player.
* @param worldName Name of World
* @param playerName Name of Player
* @param world World name
* @param player Name of Player
* @param permission Permission node
* @return Success or Failure
*/
abstract public boolean playerRemove(String worldName, String playerName, String permission);
public boolean playerRemove(World world, String playerName, String permission) {
return playerRemove(world.getName(), playerName, permission);
abstract public boolean playerRemove(String world, String player, String permission);
/**
* Remove permission from a player.
* @param world World name
* @param player Player name
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerRemove(World world, String player, String permission) {
return playerRemove(world.getName(), player, permission);
}
/**
* Remove permission from a player.
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerRemove(Player player, String permission) {
return playerRemove(player.getWorld().getName(), player.getName(), permission);
}
/**
* Checks if group has a permission node.
* @param worldName Name of World
* @param groupName Name of Group
* @param world World name
* @param group Group name
* @param permission Permission node
* @return Success or Failure
*/
abstract public boolean groupHas(String worldName, String groupName, String permission);
public boolean groupHas(World world, String groupName, String permission) {
return groupHas(world.getName(), groupName, permission);
abstract public boolean groupHas(String world, String group, String permission);
/**
* Checks if group has a permission node.
* @param world World Object
* @param group Group name
* @param permission Permission node
* @return Success or Failure
*/
public boolean groupHas(World world, String group, String permission) {
return groupHas(world.getName(), group, permission);
}
/**
* Add permission to a group.
* @param worldName Name of World
* @param groupName Name of Group
* @param world World name
* @param group Group name
* @param permission Permission node
* @return Success or Failure
*/
abstract public boolean groupAdd(String worldName, String groupName, String permission);
public boolean groupAdd(World world, String groupName, String permission) {
return groupAdd(world.getName(), groupName, permission);
abstract public boolean groupAdd(String world, String group, String permission);
/**
* Add permission to a group.
* @param world World Object
* @param group Group name
* @param permission Permission node
* @return Success or Failure
*/
public boolean groupAdd(World world, String group, String permission) {
return groupAdd(world.getName(), group, permission);
}
/**
* Remove permission from a group.
* @param worldName Name of World
* @param groupName Name of Group
* @param world World name
* @param group Group name
* @param permission Permission node
* @return Success or Failure
*/
abstract public boolean groupRemove(String worldName, String groupName, String permission);
public boolean groupRemove(World world, String groupName, String permission) {
return groupRemove(world.getName(), groupName, permission);
abstract public boolean groupRemove(String world, String group, String permission);
/**
* Remove permission from a group.
* @param world World Object
* @param group Group name
* @param permission Permission node
* @return Success or Failure
*/
public boolean groupRemove(World world, String group, String permission) {
return groupRemove(world.getName(), group, permission);
}
/**
* Check if player is member of a group.
* @param worldName Name of World
* @param playerName Name of Player
* @param groupName Name of Group
* @param world World name
* @param player Player name
* @param group Group name
* @return Success or Failure
*/
abstract public boolean playerInGroup(String worldName, String playerName, String groupName);
public boolean playerInGroup(World world, String playerName, String groupName) {
return playerInGroup(world.getName(), playerName, groupName);
abstract public boolean playerInGroup(String world, String player, String group);
/**
* Check if player is member of a group.
* @param world World Object
* @param player Player name
* @param group Group name
* @return Success or Failure
*/
public boolean playerInGroup(World world, String player, String group) {
return playerInGroup(world.getName(), player, group);
}
public boolean playerInGroup(Player player, String groupName) {
return playerInGroup(player.getWorld().getName(), player.getName(), groupName);
/**
* Check if player is member of a group.
* @param player Player Object
* @param group Group name
* @return Success or Failure
*/
public boolean playerInGroup(Player player, String group) {
return playerInGroup(player.getWorld().getName(), player.getName(), group);
}
/**
* Add player to a group.
* @param worldName Name of World
* @param playerName Name of Player
* @param groupName Name of Group
* @param world World name
* @param player Player name
* @param group Group name
* @return Success or Failure
*/
abstract public boolean playerAddGroup(String worldName, String playerName, String groupName);
public boolean playerAddGroup(World world, String playerName, String groupName) {
return playerAddGroup(world.getName(), playerName, groupName);
abstract public boolean playerAddGroup(String world, String player, String group);
/**
* Add player to a group.
* @param world World Object
* @param player Player name
* @param group Group name
* @return Success or Failure
*/
public boolean playerAddGroup(World world, String player, String group) {
return playerAddGroup(world.getName(), player, group);
}
public boolean playerAddGroup(Player player, String groupName) {
return playerAddGroup(player.getWorld().getName(), player.getName(), groupName);
/**
* Add player to a group.
* @param player Player Object
* @param group Group name
* @return Success or Failure
*/
public boolean playerAddGroup(Player player, String group) {
return playerAddGroup(player.getWorld().getName(), player.getName(), group);
}
/**
* Remove player from a group.
* @param worldName Name of World
* @param playerName Name of Player
* @param groupName Name of Group
* @param world World name
* @param player Player name
* @param group Group name
* @return Success or Failure
*/
abstract public boolean playerRemoveGroup(String worldName, String playerName, String groupName);
public boolean playerRemoveGroup(World world, String playerName, String groupName) {
return playerRemoveGroup(world.getName(), playerName, groupName);
abstract public boolean playerRemoveGroup(String world, String player, String group);
/**
* Remove player from a group.
* @param world World Object
* @param player Player name
* @param group Group name
* @return Success or Failure
*/
public boolean playerRemoveGroup(World world, String player, String group) {
return playerRemoveGroup(world.getName(), player, group);
}
public boolean playerRemoveGroup(Player player, String groupName) {
return playerRemoveGroup(player.getWorld().getName(), player.getName(), groupName);
/**
* Remove player from a group.
* @param player Player Object
* @param group Group name
* @return Success or Failure
*/
public boolean playerRemoveGroup(Player player, String group) {
return playerRemoveGroup(player.getWorld().getName(), player.getName(), group);
}
/**
* Get a players informational node (Integer) value
* @param world Name of World
* @param playerName Name of Player
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value (if node is not defined)
* @param defaultValue Default value
* @return Value
*/
abstract public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue);
public int getPlayerInfoInteger(World world, String playerName, String node, int defaultValue) {
return getPlayerInfoInteger(world.getName(), playerName, node, defaultValue);
abstract public int getPlayerInfoInteger(String world, String player, String node, int defaultValue);
/**
* Get a players informational node (Integer) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public int getPlayerInfoInteger(World world, String player, String node, int defaultValue) {
return getPlayerInfoInteger(world.getName(), player, node, defaultValue);
}
/**
* Get a players informational node (Integer) value
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public int getPlayerInfoInteger(Player player, String node, int defaultValue) {
return getPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, defaultValue);
}
/**
* Set a players informational node (Integer) value
* @param world Name of World
* @param playerName Name of Player
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
abstract public void setPlayerInfoInteger(String world, String playerName, String node, int value);
public void setPlayerInfoInteger(World world, String playerName, String node, int value) {
setPlayerInfoInteger(world.getName(), playerName, node, value);
abstract public void setPlayerInfoInteger(String world, String player, String node, int value);
/**
* Set a players informational node (Integer) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoInteger(World world, String player, String node, int value) {
setPlayerInfoInteger(world.getName(), player, node, value);
}
/**
* Set a players informational node (Integer) value
* @param player Player Object
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoInteger(Player player, String node, int value) {
setPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, value);
}
/**
* Get a groups informational node (Integer) value
* @param world Name of World
* @param groupName Name of Group
* @param world World name
* @param group Group name
* @param node Permission node
* @param defaultValue Default value (if node is not defined)
* @param defaultValue Default value
* @return Value
*/
abstract public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue);
public int getGroupInfoInteger(World world, String groupName, String node, int defaultValue) {
return getGroupInfoInteger(world.getName(), groupName, node, defaultValue);
abstract public int getGroupInfoInteger(String world, String group, String node, int defaultValue);
/**
* Get a groups informational node (Integer) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public int getGroupInfoInteger(World world, String group, String node, int defaultValue) {
return getGroupInfoInteger(world.getName(), group, node, defaultValue);
}
/**
* Set a groups informational node (Integer) value
* @param world Name of World
* @param groupName Name of Group
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setGroupInfoInteger(String world, String groupName, String node, int value);
public void setGroupInfoInteger(World world, String groupName, String node, int value) {
setGroupInfoInteger(world.getName(), groupName, node, value);
abstract public void setGroupInfoInteger(String world, String group, String node, int value);
/**
* Set a groups informational node (Integer) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
public void setGroupInfoInteger(World world, String group, String node, int value) {
setGroupInfoInteger(world.getName(), group, node, value);
}
/**
* Get a players informational node (Double) value
* @param world Name of World
* @param playerName Name of Group
* @param world World name
* @param player Group name
* @param node Permission node
* @param defaultValue Default value (if node is not defined)
* @param defaultValue Default value
* @return Value
*/
abstract public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue);
public double getPlayerInfoDouble(World world, String playerName, String node, double defaultValue) {
return getPlayerInfoDouble(world.getName(), playerName, node, defaultValue);
abstract public double getPlayerInfoDouble(String world, String player, String node, double defaultValue);
/**
* Get a players informational node (Double) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public double getPlayerInfoDouble(World world, String player, String node, double defaultValue) {
return getPlayerInfoDouble(world.getName(), player, node, defaultValue);
}
/**
* Get a players informational node (Double) value
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public double getPlayerInfoDouble(Player player, String node, double defaultValue) {
return getPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, defaultValue);
}
/**
* Set a players informational node (Double) value
* @param world Name of World
* @param playerName Name of Group
* @param world World name
* @param player Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setPlayerInfoDouble(String world, String playerName, String node, double value);
public void setPlayerInfoDouble(World world, String playerName, String node, double value) {
setPlayerInfoDouble(world.getName(), playerName, node, value);
abstract public void setPlayerInfoDouble(String world, String player, String node, double value);
/**
* Set a players informational node (Double) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoDouble(World world, String player, String node, double value) {
setPlayerInfoDouble(world.getName(), player, node, value);
}
/**
* Set a players informational node (Double) value
* @param player Player Object
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoDouble(Player player, String node, double value) {
setPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, value);
}
/**
* Get a groups informational node (Double) value
* @param world Name of World
* @param groupName Name of Group
* @param world World name
* @param group Group name
* @param node Permission node
* @param defaultValue Default value (if node is not defined)
* @param defaultValue Default value
* @return Value
*/
abstract public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue);
public double getGroupInfoDouble(World world, String groupName, String node, double defaultValue) {
return getGroupInfoDouble(world.getName(), groupName, node, defaultValue);
abstract public double getGroupInfoDouble(String world, String group, String node, double defaultValue);
/**
* Get a groups informational node (Double) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public double getGroupInfoDouble(World world, String group, String node, double defaultValue) {
return getGroupInfoDouble(world.getName(), group, node, defaultValue);
}
/**
* Set a groups informational node (Double) value
* @param world Name of World
* @param groupName Name of Group
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setGroupInfoDouble(String world, String groupName, String node, double value);
public void setGroupInfoDouble(World world, String groupName, String node, double value) {
setGroupInfoDouble(world.getName(), groupName, node, value);
abstract public void setGroupInfoDouble(String world, String group, String node, double value);
/**
* Set a groups informational node (Double) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
public void setGroupInfoDouble(World world, String group, String node, double value) {
setGroupInfoDouble(world.getName(), group, node, value);
}
/**
* Get a players informational node (Boolean) value
* @param world Name of World
* @param playerName Name of Player
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value (if node is not defined)
* @param defaultValue Default value
* @return Value
*/
abstract public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue);
public boolean getPlayerInfoBoolean(World world, String playerName, String node, boolean defaultValue) {
return getPlayerInfoBoolean(world.getName(), playerName, node, defaultValue);
abstract public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue);
/**
* Get a players informational node (Boolean) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public boolean getPlayerInfoBoolean(World world, String player, String node, boolean defaultValue) {
return getPlayerInfoBoolean(world.getName(), player, node, defaultValue);
}
/**
* Get a players informational node (Boolean) value
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue) {
return getPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, defaultValue);
}
/**
* Set a players informational node (Boolean) value
* @param world Name of World
* @param playerName Name of Player
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
abstract public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value);
public void setPlayerInfoBoolean(World world, String playerName, String node, boolean value) {
setPlayerInfoBoolean(world.getName(), playerName, node, value);
abstract public void setPlayerInfoBoolean(String world, String player, String node, boolean value);
/**
* Set a players informational node (Boolean) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoBoolean(World world, String player, String node, boolean value) {
setPlayerInfoBoolean(world.getName(), player, node, value);
}
/**
* Set a players informational node (Boolean) value
* @param player Player Object
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoBoolean(Player player, String node, boolean value) {
setPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, value);
}
@ -324,55 +551,98 @@ public abstract class Permission {
/**
* Get a groups informational node (Boolean) value
* @param world Name of World
* @param groupName Name of Group
* @param group Name of Group
* @param node Permission node
* @param defaultValue Default value (if node is not defined)
* @param defaultValue Default value
* @return Value
*/
abstract public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue);
public boolean getGroupInfoBoolean(World world, String groupName, String node, boolean defaultValue) {
return getGroupInfoBoolean(world.getName(), groupName, node, defaultValue);
abstract public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue);
/**
* Set a players informational node (Boolean) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue) {
return getGroupInfoBoolean(world.getName(), group, node, defaultValue);
}
/**
* Set a groups informational node (Boolean) value
* @param world Name of World
* @param groupName Name of Group
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setGroupInfoBoolean(String world, String groupName, String node, boolean value);
public void setGroupInfoBoolean(World world, String groupName, String node, boolean value) {
setGroupInfoBoolean(world.getName(), groupName, node, value);
abstract public void setGroupInfoBoolean(String world, String group, String node, boolean value);
/**
* Set a players informational node (Boolean) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
public void setGroupInfoBoolean(World world, String group, String node, boolean value) {
setGroupInfoBoolean(world.getName(), group, node, value);
}
/**
* Get a players informational node (String) value
* @param world Name of World
* @param playerName Name of Player
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value (if node is not defined)
* @param defaultValue Default value
* @return Value
*/
abstract public String getPlayerInfoString(String world, String playerName, String node, String defaultValue);
public String getPlayerInfoString(World world, String playerName, String node, String defaultValue) {
return getPlayerInfoString(world.getName(), playerName, node, defaultValue);
abstract public String getPlayerInfoString(String world, String player, String node, String defaultValue);
/**
* Get a players informational node (String) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public String getPlayerInfoString(World world, String player, String node, String defaultValue) {
return getPlayerInfoString(world.getName(), player, node, defaultValue);
}
/**
* Get a players informational node (String) value
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public String getPlayerInfoString(Player player, String node, String defaultValue) {
return getPlayerInfoString(player.getWorld().getName(), player.getName(), node, defaultValue);
}
/**
* Set a players informational node (String) value
* @param world Name of World
* @param playerName Name of Player
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
abstract public void setPlayerInfoString(String world, String playerName, String node, String value);
public void setPlayerInfoString(World world, String playerName, String node, String value) {
setPlayerInfoString(world.getName(), playerName, node, value);
abstract public void setPlayerInfoString(String world, String player, String node, String value);
/**
* Set a players informational node (String) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoString(World world, String player, String node, String value) {
setPlayerInfoString(world.getName(), player, node, value);
}
/**
* Set a players informational node (String) value
* @param player Player Object
* @param node Permission node
* @param value Value ot set
*/
public void setPlayerInfoString(Player player, String node, String value) {
setPlayerInfoString(player.getWorld().getName(), player.getName(), node, value);
}
@ -380,71 +650,190 @@ public abstract class Permission {
/**
* Get a groups informational node (String) value
* @param world Name of World
* @param groupName Name of Group
* @param group Name of Group
* @param node Permission node
* @param defaultValue Default value (if node is not defined)
* @param defaultValue Default value
* @return Value
*/
abstract public String getGroupInfoString(String world, String groupName, String node, String defaultValue);
public String getGroupInfoString(World world, String groupName, String node, String defaultValue) {
return getGroupInfoString(world.getName(), groupName, node, defaultValue);
abstract public String getGroupInfoString(String world, String group, String node, String defaultValue);
/**
* Set a players informational node (String) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public String getGroupInfoString(World world, String group, String node, String defaultValue) {
return getGroupInfoString(world.getName(), group, node, defaultValue);
}
/**
* Set a groups informational node (String) value
* @param world Name of World
* @param groupName Name of Group
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setGroupInfoString(String world, String groupName, String node, String value);
public void setGroupInfoString(World world, String groupName, String node, String value) {
setGroupInfoString(world.getName(), groupName, node, value);
abstract public void setGroupInfoString(String world, String group, String node, String value);
/**
* Set a groups informational node (String) value
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
public void setGroupInfoString(World world, String group, String node, String value) {
setGroupInfoString(world.getName(), group, node, value);
}
/**
* Gets the list of groups that this player has
* @param world Name of World
* @param playerName Name of Player
* @param world World name
* @param player Player name
* @return Array of groups
*/
abstract public String[] getPlayerGroups(String world, String playerName);
public String[] getPlayerGroups(World world, String playerName) {
return getPlayerGroups(world.getName(), playerName);
abstract public String[] getPlayerGroups(String world, String player);
/**
* Gets the list of groups that this player has
* @param world World Object
* @param player Player name
* @return Array of groups
*/
public String[] getPlayerGroups(World world, String player) {
return getPlayerGroups(world.getName(), player);
}
/**
* Gets the list of groups that this player has
* @param player Player Object
* @return Array of groups
*/
public String[] getPlayerGroups(Player player) {
return getPlayerGroups(player.getWorld().getName(), player.getName());
}
/**
* Gets users primary group
* @param world
* @param playerName
* Gets players primary group
* @param world World name
* @param player Player name
* @return Players primary group
*/
abstract public String getPrimaryGroup(String world, String playerName);
public String getPrimaryGroup(World world, String playerName) {
return getPrimaryGroup(world.getName(), playerName);
abstract public String getPrimaryGroup(String world, String player);
/**
* Gets players primary group
* @param world World Object
* @param player Player name
* @return Players primary group
*/
public String getPrimaryGroup(World world, String player) {
return getPrimaryGroup(world.getName(), player);
}
/**
* Get players primary group
* @param player Player Object
* @return Players primary group
*/
public String getPrimaryGroup(Player player) {
return getPrimaryGroup(player.getWorld().getName(), player.getName());
}
abstract public String getPlayerPrefix(String world, String playerName);
public String getPlayerPrefix(World world, String playerName) {
return getPlayerPrefix(world.getName(), playerName);
/**
* Get players prefix
* @param world World name
* @param player Player name
* @return Prefix
*/
abstract public String getPlayerPrefix(String world, String player);
/**
* Get players prefix
* @param world World Object
* @param player Player name
* @return Prefix
*/
public String getPlayerPrefix(World world, String player) {
return getPlayerPrefix(world.getName(), player);
}
/**
* Get players prefix
* @param player Player Object
* @return Prefix
*/
public String getPlayerPrefix(Player player) {
return getPlayerPrefix(player.getWorld().getName(), player.getName());
}
abstract public String getPlayerSuffix(String world, String playerName);
public String getPlayerSuffix(World world, String playerName) {
return getPlayerSuffix(world.getName(), playerName);
/**
* Set players prefix
* @param world World name
* @param player Player name
* @param prefix Prefix
*/
abstract public void setPlayerPrefix(String world, String player, String prefix);
/**
* Set players prefix
* @param world World Object
* @param player Player name
* @param prefix Prefix
*/
public void setPlayerPrefix(World world, String player, String prefix) {
setPlayerPrefix(world.getName(), player, prefix);
}
/**
* Set players prefix
* @param player Player Object
* @param prefix Prefix
*/
public void setPlayerPrefix(Player player, String prefix) {
setPlayerPrefix(player.getWorld().getName(), player.getName(), prefix);
}
/**
* Get players suffix
* @param world World name
* @param player Player name
* @return Suffix
*/
abstract public String getPlayerSuffix(String world, String player);
/**
* Get players suffix
* @param world World Object
* @param player Player name
* @return Suffix
*/
public String getPlayerSuffix(World world, String player) {
return getPlayerSuffix(world.getName(), player);
}
/**
* Get players suffix
* @param player Player Object
* @return Suffix
*/
public String getPlayerSuffix(Player player) {
return getPlayerSuffix(player.getWorld().getName(), player.getName());
}
abstract public void setPlayerSuffix(Player player, String suffix);
/**
* Set players suffix
* @param world World name
* @param player Player name
* @param suffix Suffix
*/
abstract public void setPlayerSuffix(String world, String player, String suffix);
/**
* Set players suffix
* @param world World Object
* @param player Player name
* @param suffix Suffix
*/
public void setPlayerSuffix(World world, String player, String suffix) {
setPlayerSuffix(world.getName(), player, suffix);
}
/**
* Set players suffix
* @param player Player Object
* @param suffix Suffix
*/
public void setPlayerSuffix(Player player, String suffix) {
setPlayerSuffix(player.getWorld().getName(), player.getName(), suffix);
}
}

View File

@ -2,9 +2,10 @@ package net.milkbowl.vault.permission.plugins;
import java.util.logging.Logger;
import net.milkbowl.vault.permission.Permission;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
@ -13,8 +14,6 @@ import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import net.milkbowl.vault.permission.Permission;
public class Permission_GroupManager extends Permission {
private static final Logger log = Logger.getLogger("Minecraft");
@ -101,12 +100,12 @@ public class Permission_GroupManager extends Permission {
@Override
public boolean playerAdd(String worldName, String playerName, String permission) {
return false;
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean playerRemove(String worldName, String playerName, String permission) {
return false;
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -116,12 +115,12 @@ public class Permission_GroupManager extends Permission {
@Override
public boolean groupAdd(String worldName, String groupName, String permission) {
return false;
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean groupRemove(String worldName, String groupName, String permission) {
return false;
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -151,6 +150,7 @@ public class Permission_GroupManager extends Permission {
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -160,6 +160,7 @@ public class Permission_GroupManager extends Permission {
@Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -169,6 +170,7 @@ public class Permission_GroupManager extends Permission {
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -178,6 +180,7 @@ public class Permission_GroupManager extends Permission {
@Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -187,6 +190,7 @@ public class Permission_GroupManager extends Permission {
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -196,6 +200,7 @@ public class Permission_GroupManager extends Permission {
@Override
public void setGroupInfoBoolean(String world, String groupName,String node, boolean value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -205,6 +210,7 @@ public class Permission_GroupManager extends Permission {
@Override
public void setPlayerInfoString(String world, String playerName,String node, String value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -237,7 +243,12 @@ public class Permission_GroupManager extends Permission {
}
@Override
public void setPlayerSuffix(Player player, String suffix) {
public void setPlayerSuffix(String world, String player, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
}

View File

@ -20,7 +20,7 @@ import net.milkbowl.vault.permission.Permission;
public class Permission_Permissions2 extends Permission {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "Permissions (Phoenix)";
private String name = "Permissions 2 (Phoenix)";
private PermissionHandler perms;
private Plugin plugin = null;
private PluginManager pluginManager = null;
@ -112,20 +112,17 @@ public class Permission_Permissions2 extends Permission {
@Override
public boolean groupHas(String worldName, String groupName, String permission) {
//Unable to directly check group permissions in P2
return false;
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean groupAdd(String worldName, String groupName,String permission) {
//Unable to alter group permissions in P2
return false;
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean groupRemove(String worldName, String groupName, String permission) {
//Unable to alter group permissions in P2
return false;
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -135,14 +132,12 @@ public class Permission_Permissions2 extends Permission {
@Override
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
//Unable to add groups in P2
return false;
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
//Unable to remove groups in P2
return false;
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -153,7 +148,7 @@ public class Permission_Permissions2 extends Permission {
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
//Unable to set player info nodes in P2
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
public void setGroupInfo(String world, String groupName, String node, Object value) {
@ -179,7 +174,7 @@ public class Permission_Permissions2 extends Permission {
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
//Unable to set player info nodes in P2
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -201,7 +196,7 @@ public class Permission_Permissions2 extends Permission {
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
//Unable to set player info nodes in P2
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -222,7 +217,7 @@ public class Permission_Permissions2 extends Permission {
@Override
public void setPlayerInfoString(String world, String playerName, String node, String value) {
//Unable to set player info nodes in P2
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
@ -257,8 +252,13 @@ public class Permission_Permissions2 extends Permission {
}
@Override
public void setPlayerSuffix(Player player, String suffix) {
//Unable to set player info nodes in P2
public void setPlayerSuffix(String world, String player, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
}

View File

@ -39,7 +39,7 @@ import com.nijikokun.bukkit.Permissions.Permissions;
public class Permission_Permissions3 extends Permission {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "Permissions (Yeti)";
private String name = "Permissions 3 (Yeti)";
private PermissionHandler perms;
private Plugin plugin = null;
private PluginManager pluginManager = null;
@ -284,7 +284,12 @@ public class Permission_Permissions3 extends Permission {
}
@Override
public void setPlayerSuffix(Player player, String suffix) {
this.perms.addUserInfo(player.getWorld().getName(), player.getName(), "suffix", suffix);
public void setPlayerSuffix(String world, String player, String suffix) {
this.perms.addUserInfo(world, player, "suffix", suffix);
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
this.perms.addUserInfo(world, player, "prefix", prefix);
}
}

View File

@ -391,9 +391,18 @@ public class Permission_PermissionsEx extends Permission {
}
@Override
public void setPlayerSuffix(Player player, String suffix) {
public void setPlayerSuffix(String world, String player, String suffix) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
if (user != null)
if (user != null) {
user.setSuffix(suffix);
}
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
if (user != null) {
user.setPrefix(prefix);
}
}
}