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())); 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" })) { if (packageExists(new String[] { "com.nijiko.permissions.ModularControl" })) {
Permission nPerms = new Permission_Permissions3(this); Permission nPerms = new Permission_Permissions3(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, nPerms, this, ServicePriority.Low); 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 { } 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"} )) { if (packageExists(new String[] { "com.nijiko.permissions.Control"} )) {
Permission oPerms = new Permission_Permissions2(this); Permission oPerms = new Permission_Permissions2(this);
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, oPerms, this, ServicePriority.Lowest); 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 { } 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(...) * Checks if player has a permission node. (Short for playerHas(...)
* @param worldName * @param world World name
* @param playerName * @param player Player name
* @param permission Permission node * @param permission Permission node
* @return Success or Failure * @return Success or Failure
*/ */
public boolean has(String worldName, String playerName, String permission) { public boolean has(String world, String player, String permission) {
return playerHas(worldName, playerName, 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) { public boolean has(Player player, String permission) {
return playerHas(player.getWorld().getName(), player.getName(), permission); return playerHas(player.getWorld().getName(), player.getName(), permission);
} }
/** /**
* Checks if player has a permission node. * Checks if player has a permission node.
* @param player Player instance * @param world World name
* @param player Player name
* @param permission Permission node * @param permission Permission node
* @return Success or Failure * @return Success or Failure
*/ */
abstract public boolean playerHas(String worldName, String playerName, String permission); abstract public boolean playerHas(String world, String player, String permission);
public boolean playerHas(World world, String playerName, String permission) { /**
return playerHas(world.getName(), playerName, 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) { public boolean playerHas(Player player, String permission) {
return playerHas(player.getWorld().getName(), player.getName(), permission); return playerHas(player.getWorld().getName(), player.getName(), permission);
} }
/** /**
* Add permission to a player. * Add permission to a player.
* @param worldName Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param permission Permission node * @param permission Permission node
* @return Success or Failure * @return Success or Failure
*/ */
abstract public boolean playerAdd(String worldName, String playerName, String permission); abstract public boolean playerAdd(String world, String player, String permission);
public boolean playerAdd(World world, String playerName, String permission) { /**
return playerAdd(world.getName(), playerName, 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) { public boolean playerAdd(Player player, String permission) {
return playerAdd(player.getWorld().getName(), player.getName(), permission); return playerAdd(player.getWorld().getName(), player.getName(), permission);
} }
/** /**
* Remove permission from a player. * Remove permission from a player.
* @param worldName Name of World * @param world World name
* @param playerName Name of Player * @param player Name of Player
* @param permission Permission node * @param permission Permission node
* @return Success or Failure * @return Success or Failure
*/ */
abstract public boolean playerRemove(String worldName, String playerName, String permission); abstract public boolean playerRemove(String world, String player, String permission);
public boolean playerRemove(World world, String playerName, String permission) { /**
return playerRemove(world.getName(), playerName, 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) { public boolean playerRemove(Player player, String permission) {
return playerRemove(player.getWorld().getName(), player.getName(), permission); return playerRemove(player.getWorld().getName(), player.getName(), permission);
} }
/** /**
* Checks if group has a permission node. * Checks if group has a permission node.
* @param worldName Name of World * @param world World name
* @param groupName Name of Group * @param group Group name
* @param permission Permission node * @param permission Permission node
* @return Success or Failure * @return Success or Failure
*/ */
abstract public boolean groupHas(String worldName, String groupName, String permission); abstract public boolean groupHas(String world, String group, String permission);
public boolean groupHas(World world, String groupName, String permission) { /**
return groupHas(world.getName(), groupName, 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. * Add permission to a group.
* @param worldName Name of World * @param world World name
* @param groupName Name of Group * @param group Group name
* @param permission Permission node * @param permission Permission node
* @return Success or Failure * @return Success or Failure
*/ */
abstract public boolean groupAdd(String worldName, String groupName, String permission); abstract public boolean groupAdd(String world, String group, String permission);
public boolean groupAdd(World world, String groupName, String permission) { /**
return groupAdd(world.getName(), groupName, 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. * Remove permission from a group.
* @param worldName Name of World * @param world World name
* @param groupName Name of Group * @param group Group name
* @param permission Permission node * @param permission Permission node
* @return Success or Failure * @return Success or Failure
*/ */
abstract public boolean groupRemove(String worldName, String groupName, String permission); abstract public boolean groupRemove(String world, String group, String permission);
public boolean groupRemove(World world, String groupName, String permission) { /**
return groupRemove(world.getName(), groupName, 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. * Check if player is member of a group.
* @param worldName Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param groupName Name of Group * @param group Group name
* @return Success or Failure * @return Success or Failure
*/ */
abstract public boolean playerInGroup(String worldName, String playerName, String groupName); abstract public boolean playerInGroup(String world, String player, String group);
public boolean playerInGroup(World world, String playerName, String groupName) { /**
return playerInGroup(world.getName(), playerName, groupName); * 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. * Add player to a group.
* @param worldName Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param groupName Name of Group * @param group Group name
* @return Success or Failure * @return Success or Failure
*/ */
abstract public boolean playerAddGroup(String worldName, String playerName, String groupName); abstract public boolean playerAddGroup(String world, String player, String group);
public boolean playerAddGroup(World world, String playerName, String groupName) { /**
return playerAddGroup(world.getName(), playerName, groupName); * 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. * Remove player from a group.
* @param worldName Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param groupName Name of Group * @param group Group name
* @return Success or Failure * @return Success or Failure
*/ */
abstract public boolean playerRemoveGroup(String worldName, String playerName, String groupName); abstract public boolean playerRemoveGroup(String world, String player, String group);
public boolean playerRemoveGroup(World world, String playerName, String groupName) { /**
return playerRemoveGroup(world.getName(), playerName, groupName); * 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 * Get a players informational node (Integer) value
* @param world Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param node Permission node * @param node Permission node
* @param defaultValue Default value (if node is not defined) * @param defaultValue Default value
* @return Value * @return Value
*/ */
abstract public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue); abstract public int getPlayerInfoInteger(String world, String player, String node, int defaultValue);
public int getPlayerInfoInteger(World world, String playerName, String node, int defaultValue) { /**
return getPlayerInfoInteger(world.getName(), playerName, node, 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) { public int getPlayerInfoInteger(Player player, String node, int defaultValue) {
return getPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, defaultValue); return getPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, defaultValue);
} }
/** /**
* Set a players informational node (Integer) value * Set a players informational node (Integer) value
* @param world Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param node Permission node * @param node Permission node
* @param value Value to set * @param value Value to set
*/ */
abstract public void setPlayerInfoInteger(String world, String playerName, String node, int value); abstract public void setPlayerInfoInteger(String world, String player, String node, int value);
public void setPlayerInfoInteger(World world, String playerName, String node, int value) { /**
setPlayerInfoInteger(world.getName(), playerName, node, 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) { public void setPlayerInfoInteger(Player player, String node, int value) {
setPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, value); setPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, value);
} }
/** /**
* Get a groups informational node (Integer) value * Get a groups informational node (Integer) value
* @param world Name of World * @param world World name
* @param groupName Name of Group * @param group Group name
* @param node Permission node * @param node Permission node
* @param defaultValue Default value (if node is not defined) * @param defaultValue Default value
* @return Value * @return Value
*/ */
abstract public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue); abstract public int getGroupInfoInteger(String world, String group, String node, int defaultValue);
public int getGroupInfoInteger(World world, String groupName, String node, int defaultValue) { /**
return getGroupInfoInteger(world.getName(), groupName, node, 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 * Set a groups informational node (Integer) value
* @param world Name of World * @param world World name
* @param groupName Name of Group * @param group Group name
* @param node Permission node * @param node Permission node
* @param value Value to set * @param value Value to set
*/ */
abstract public void setGroupInfoInteger(String world, String groupName, String node, int value); abstract public void setGroupInfoInteger(String world, String group, String node, int value);
public void setGroupInfoInteger(World world, String groupName, String node, int value) { /**
setGroupInfoInteger(world.getName(), groupName, node, 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 * Get a players informational node (Double) value
* @param world Name of World * @param world World name
* @param playerName Name of Group * @param player Group name
* @param node Permission node * @param node Permission node
* @param defaultValue Default value (if node is not defined) * @param defaultValue Default value
* @return Value * @return Value
*/ */
abstract public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue); abstract public double getPlayerInfoDouble(String world, String player, String node, double defaultValue);
public double getPlayerInfoDouble(World world, String playerName, String node, double defaultValue) { /**
return getPlayerInfoDouble(world.getName(), playerName, node, 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) { public double getPlayerInfoDouble(Player player, String node, double defaultValue) {
return getPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, defaultValue); return getPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, defaultValue);
} }
/** /**
* Set a players informational node (Double) value * Set a players informational node (Double) value
* @param world Name of World * @param world World name
* @param playerName Name of Group * @param player Group name
* @param node Permission node * @param node Permission node
* @param value Value to set * @param value Value to set
*/ */
abstract public void setPlayerInfoDouble(String world, String playerName, String node, double value); abstract public void setPlayerInfoDouble(String world, String player, String node, double value);
public void setPlayerInfoDouble(World world, String playerName, String node, double value) { /**
setPlayerInfoDouble(world.getName(), playerName, node, 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) { public void setPlayerInfoDouble(Player player, String node, double value) {
setPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, value); setPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, value);
} }
/** /**
* Get a groups informational node (Double) value * Get a groups informational node (Double) value
* @param world Name of World * @param world World name
* @param groupName Name of Group * @param group Group name
* @param node Permission node * @param node Permission node
* @param defaultValue Default value (if node is not defined) * @param defaultValue Default value
* @return Value * @return Value
*/ */
abstract public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue); abstract public double getGroupInfoDouble(String world, String group, String node, double defaultValue);
public double getGroupInfoDouble(World world, String groupName, String node, double defaultValue) { /**
return getGroupInfoDouble(world.getName(), groupName, node, 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 * Set a groups informational node (Double) value
* @param world Name of World * @param world World name
* @param groupName Name of Group * @param group Group name
* @param node Permission node * @param node Permission node
* @param value Value to set * @param value Value to set
*/ */
abstract public void setGroupInfoDouble(String world, String groupName, String node, double value); abstract public void setGroupInfoDouble(String world, String group, String node, double value);
public void setGroupInfoDouble(World world, String groupName, String node, double value) { /**
setGroupInfoDouble(world.getName(), groupName, node, 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 * Get a players informational node (Boolean) value
* @param world Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param node Permission node * @param node Permission node
* @param defaultValue Default value (if node is not defined) * @param defaultValue Default value
* @return Value * @return Value
*/ */
abstract public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue); abstract public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue);
public boolean getPlayerInfoBoolean(World world, String playerName, String node, boolean defaultValue) { /**
return getPlayerInfoBoolean(world.getName(), playerName, node, 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) { public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue) {
return getPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, defaultValue); return getPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, defaultValue);
} }
/** /**
* Set a players informational node (Boolean) value * Set a players informational node (Boolean) value
* @param world Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param node Permission node * @param node Permission node
* @param value Value to set * @param value Value to set
*/ */
abstract public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value); abstract public void setPlayerInfoBoolean(String world, String player, String node, boolean value);
public void setPlayerInfoBoolean(World world, String playerName, String node, boolean value) { /**
setPlayerInfoBoolean(world.getName(), playerName, node, 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) { public void setPlayerInfoBoolean(Player player, String node, boolean value) {
setPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, value); setPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, value);
} }
@ -324,55 +551,98 @@ public abstract class Permission {
/** /**
* Get a groups informational node (Boolean) value * Get a groups informational node (Boolean) value
* @param world Name of World * @param world Name of World
* @param groupName Name of Group * @param group Name of Group
* @param node Permission node * @param node Permission node
* @param defaultValue Default value (if node is not defined) * @param defaultValue Default value
* @return Value * @return Value
*/ */
abstract public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue); abstract public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue);
public boolean getGroupInfoBoolean(World world, String groupName, String node, boolean defaultValue) { /**
return getGroupInfoBoolean(world.getName(), groupName, node, 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 * Set a groups informational node (Boolean) value
* @param world Name of World * @param world World name
* @param groupName Name of Group * @param group Group name
* @param node Permission node * @param node Permission node
* @param value Value to set * @param value Value to set
*/ */
abstract public void setGroupInfoBoolean(String world, String groupName, String node, boolean value); abstract public void setGroupInfoBoolean(String world, String group, String node, boolean value);
public void setGroupInfoBoolean(World world, String groupName, String node, boolean value) { /**
setGroupInfoBoolean(world.getName(), groupName, node, 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 * Get a players informational node (String) value
* @param world Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param node Permission node * @param node Permission node
* @param defaultValue Default value (if node is not defined) * @param defaultValue Default value
* @return Value * @return Value
*/ */
abstract public String getPlayerInfoString(String world, String playerName, String node, String defaultValue); abstract public String getPlayerInfoString(String world, String player, String node, String defaultValue);
public String getPlayerInfoString(World world, String playerName, String node, String defaultValue) { /**
return getPlayerInfoString(world.getName(), playerName, node, 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) { public String getPlayerInfoString(Player player, String node, String defaultValue) {
return getPlayerInfoString(player.getWorld().getName(), player.getName(), node, defaultValue); return getPlayerInfoString(player.getWorld().getName(), player.getName(), node, defaultValue);
} }
/** /**
* Set a players informational node (String) value * Set a players informational node (String) value
* @param world Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @param node Permission node * @param node Permission node
* @param value Value to set * @param value Value to set
*/ */
abstract public void setPlayerInfoString(String world, String playerName, String node, String value); abstract public void setPlayerInfoString(String world, String player, String node, String value);
public void setPlayerInfoString(World world, String playerName, String node, String value) { /**
setPlayerInfoString(world.getName(), playerName, node, 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) { public void setPlayerInfoString(Player player, String node, String value) {
setPlayerInfoString(player.getWorld().getName(), player.getName(), node, value); setPlayerInfoString(player.getWorld().getName(), player.getName(), node, value);
} }
@ -380,71 +650,190 @@ public abstract class Permission {
/** /**
* Get a groups informational node (String) value * Get a groups informational node (String) value
* @param world Name of World * @param world Name of World
* @param groupName Name of Group * @param group Name of Group
* @param node Permission node * @param node Permission node
* @param defaultValue Default value (if node is not defined) * @param defaultValue Default value
* @return Value * @return Value
*/ */
abstract public String getGroupInfoString(String world, String groupName, String node, String defaultValue); abstract public String getGroupInfoString(String world, String group, String node, String defaultValue);
public String getGroupInfoString(World world, String groupName, String node, String defaultValue) { /**
return getGroupInfoString(world.getName(), groupName, node, 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 * Set a groups informational node (String) value
* @param world Name of World * @param world World name
* @param groupName Name of Group * @param group Group name
* @param node Permission node * @param node Permission node
* @param value Value to set * @param value Value to set
*/ */
abstract public void setGroupInfoString(String world, String groupName, String node, String value); abstract public void setGroupInfoString(String world, String group, String node, String value);
public void setGroupInfoString(World world, String groupName, String node, String value) { /**
setGroupInfoString(world.getName(), groupName, node, 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 * Gets the list of groups that this player has
* @param world Name of World * @param world World name
* @param playerName Name of Player * @param player Player name
* @return Array of groups * @return Array of groups
*/ */
abstract public String[] getPlayerGroups(String world, String playerName); abstract public String[] getPlayerGroups(String world, String player);
public String[] getPlayerGroups(World world, String playerName) { /**
return getPlayerGroups(world.getName(), playerName); * 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) { public String[] getPlayerGroups(Player player) {
return getPlayerGroups(player.getWorld().getName(), player.getName()); return getPlayerGroups(player.getWorld().getName(), player.getName());
} }
/** /**
* Gets users primary group * Gets players primary group
* @param world * @param world World name
* @param playerName * @param player Player name
* @return Players primary group * @return Players primary group
*/ */
abstract public String getPrimaryGroup(String world, String playerName); abstract public String getPrimaryGroup(String world, String player);
public String getPrimaryGroup(World world, String playerName) { /**
return getPrimaryGroup(world.getName(), playerName); * 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) { public String getPrimaryGroup(Player player) {
return getPrimaryGroup(player.getWorld().getName(), player.getName()); return getPrimaryGroup(player.getWorld().getName(), player.getName());
} }
abstract public String getPlayerPrefix(String world, String playerName); /**
public String getPlayerPrefix(World world, String playerName) { * Get players prefix
return getPlayerPrefix(world.getName(), playerName); * @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) { public String getPlayerPrefix(Player player) {
return getPlayerPrefix(player.getWorld().getName(), player.getName()); return getPlayerPrefix(player.getWorld().getName(), player.getName());
} }
abstract public String getPlayerSuffix(String world, String playerName); /**
public String getPlayerSuffix(World world, String playerName) { * Set players prefix
return getPlayerSuffix(world.getName(), playerName); * @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) { public String getPlayerSuffix(Player player) {
return getPlayerSuffix(player.getWorld().getName(), player.getName()); 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 java.util.logging.Logger;
import net.milkbowl.vault.permission.Permission;
import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler; import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent; 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.Plugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import net.milkbowl.vault.permission.Permission;
public class Permission_GroupManager extends Permission { public class Permission_GroupManager extends Permission {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
@ -101,12 +100,12 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public boolean playerAdd(String worldName, String playerName, String permission) { public boolean playerAdd(String worldName, String playerName, String permission) {
return false; throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
public boolean playerRemove(String worldName, String playerName, String permission) { public boolean playerRemove(String worldName, String playerName, String permission) {
return false; throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
@ -116,12 +115,12 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public boolean groupAdd(String worldName, String groupName, String permission) { public boolean groupAdd(String worldName, String groupName, String permission) {
return false; throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
public boolean groupRemove(String worldName, String groupName, String permission) { public boolean groupRemove(String worldName, String groupName, String permission) {
return false; throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
@ -151,6 +150,7 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) { public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
@ -160,6 +160,7 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) { public void setGroupInfoInteger(String world, String groupName, String node, int value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
@ -169,6 +170,7 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) { public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
@ -178,6 +180,7 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) { public void setGroupInfoDouble(String world, String groupName, String node, double value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
@ -187,6 +190,7 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) { public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
@ -196,6 +200,7 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public void setGroupInfoBoolean(String world, String groupName,String node, boolean value) { public void setGroupInfoBoolean(String world, String groupName,String node, boolean value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
@ -205,6 +210,7 @@ public class Permission_GroupManager extends Permission {
@Override @Override
public void setPlayerInfoString(String world, String playerName,String node, String value) { public void setPlayerInfoString(String world, String playerName,String node, String value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
} }
@Override @Override
@ -237,7 +243,12 @@ public class Permission_GroupManager extends Permission {
} }
@Override @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 { public class Permission_Permissions2 extends Permission {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private String name = "Permissions (Phoenix)"; private String name = "Permissions 2 (Phoenix)";
private PermissionHandler perms; private PermissionHandler perms;
private Plugin plugin = null; private Plugin plugin = null;
private PluginManager pluginManager = null; private PluginManager pluginManager = null;
@ -112,20 +112,17 @@ public class Permission_Permissions2 extends Permission {
@Override @Override
public boolean groupHas(String worldName, String groupName, String permission) { public boolean groupHas(String worldName, String groupName, String permission) {
//Unable to directly check group permissions in P2 throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
return false;
} }
@Override @Override
public boolean groupAdd(String worldName, String groupName,String permission) { public boolean groupAdd(String worldName, String groupName,String permission) {
//Unable to alter group permissions in P2 throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
return false;
} }
@Override @Override
public boolean groupRemove(String worldName, String groupName, String permission) { public boolean groupRemove(String worldName, String groupName, String permission) {
//Unable to alter group permissions in P2 throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
return false;
} }
@Override @Override
@ -135,14 +132,12 @@ public class Permission_Permissions2 extends Permission {
@Override @Override
public boolean playerAddGroup(String worldName, String playerName, String groupName) { public boolean playerAddGroup(String worldName, String playerName, String groupName) {
//Unable to add groups in P2 throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
return false;
} }
@Override @Override
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) { public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
//Unable to remove groups in P2 throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
return false;
} }
@Override @Override
@ -153,7 +148,7 @@ public class Permission_Permissions2 extends Permission {
@Override @Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) { 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) { public void setGroupInfo(String world, String groupName, String node, Object value) {
@ -179,7 +174,7 @@ public class Permission_Permissions2 extends Permission {
@Override @Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) { 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 @Override
@ -201,7 +196,7 @@ public class Permission_Permissions2 extends Permission {
@Override @Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) { 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 @Override
@ -222,7 +217,7 @@ public class Permission_Permissions2 extends Permission {
@Override @Override
public void setPlayerInfoString(String world, String playerName, String node, String value) { 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 @Override
@ -257,8 +252,13 @@ public class Permission_Permissions2 extends Permission {
} }
@Override @Override
public void setPlayerSuffix(Player player, String suffix) { public void setPlayerSuffix(String world, String player, String suffix) {
//Unable to set player info nodes in P2 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 { public class Permission_Permissions3 extends Permission {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private String name = "Permissions (Yeti)"; private String name = "Permissions 3 (Yeti)";
private PermissionHandler perms; private PermissionHandler perms;
private Plugin plugin = null; private Plugin plugin = null;
private PluginManager pluginManager = null; private PluginManager pluginManager = null;
@ -284,7 +284,12 @@ public class Permission_Permissions3 extends Permission {
} }
@Override @Override
public void setPlayerSuffix(Player player, String suffix) { public void setPlayerSuffix(String world, String player, String suffix) {
this.perms.addUserInfo(player.getWorld().getName(), player.getName(), "suffix", 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 @Override
public void setPlayerSuffix(Player player, String suffix) { public void setPlayerSuffix(String world, String player, String suffix) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(player); PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
if (user != null) if (user != null) {
user.setSuffix(suffix); 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);
}
}
} }