Clean up code formatting

This commit is contained in:
Leonardo-DGS 2021-11-03 17:48:28 +01:00
parent af58e675c3
commit 7d0d62ea4c
2 changed files with 286 additions and 233 deletions

View File

@ -23,57 +23,59 @@ import org.bukkit.entity.Player;
/**
* The main Chat API - allows for Prefix/Suffix nodes along with generic Info nodes if the linked Chat system supports them
*
*/
public abstract class Chat {
private Permission perms;
public Chat(Permission perms) {
this.perms = perms;
}
private Permission perms;
public Chat(Permission perms) {
this.perms = perms;
}
/**
* Gets name of permission method
*
* @return Name of Permission Method
*/
abstract public String getName();
/**
* Checks if permission method is enabled.
*
* @return Success or Failure
*/
abstract public boolean isEnabled();
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead.
*
* Get players prefix
* @param world World name
* @param player Player name
* @return Prefix
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead.
*
* Get players prefix
*/
@Deprecated
abstract public String getPlayerPrefix(String world, String player);
/**
* Get a players prefix in the given world
* Use NULL for world if requesting a global prefix
*
*
* @param world World name
* @param player OfflinePlayer
* @return Prefix
*/
public String getPlayerPrefix(String world, OfflinePlayer player) {
return getPlayerPrefix(world, player.getName());
return getPlayerPrefix(world, player.getName());
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead.
*
* Get players prefix
* @param world World Object
* @param player Player name
* @return Prefix
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead.
*
* Get players prefix
*/
@Deprecated
public String getPlayerPrefix(World world, String player) {
@ -81,9 +83,9 @@ public abstract class Chat {
}
/**
* Get players prefix from the world they are currently in.
* Get players prefix from the world they are currently in.
* May or may not return the global prefix depending on implementation.
*
*
* @param player Player Object
* @return Prefix
*/
@ -92,12 +94,12 @@ public abstract class Chat {
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead.
*
* Set players prefix
* @param world World name
* @param player Player name
* @param prefix Prefix
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead.
*
* Set players prefix
*/
@Deprecated
abstract public void setPlayerPrefix(String world, String player, String prefix);
@ -105,23 +107,22 @@ public abstract class Chat {
/**
* Sets players prefix in the given world.
* Use NULL for world for setting in the Global scope.
*
*
* @param world World name
* @param player OfflinePlayer
* @param prefix Prefix
*/
public void setPlayerPrefix(String world, OfflinePlayer player, String prefix) {
setPlayerPrefix(world, player.getName(), prefix);
setPlayerPrefix(world, player.getName(), prefix);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead.
*
* Set players prefix in the given world.
*
* @param world World Object
* @param player Player name
* @param prefix Prefix
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead.
*
* Set players prefix in the given world.
*/
@Deprecated
public void setPlayerPrefix(World world, String player, String prefix) {
@ -130,7 +131,7 @@ public abstract class Chat {
/**
* Set players prefix in the world they are currently in.
*
*
* @param player Player Object
* @param prefix Prefix
*/
@ -139,34 +140,34 @@ public abstract class Chat {
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead.
*
* Get players suffix
* @param world World name
* @param player Player name
* @return Suffix
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead.
*
* Get players suffix
*/
@Deprecated
abstract public String getPlayerSuffix(String world, String player);
/**
* Get players suffix in the specified world.
*
*
* @param world World name
* @param player OfflinePlayer name
* @return Suffix
*/
public String getPlayerSuffix(String world, OfflinePlayer player) {
return getPlayerSuffix(world, player.getName());
return getPlayerSuffix(world, player.getName());
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead.
*
* Get players suffix
* @param world World Object
* @param player Player name
* @return Suffix
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead.
*
* Get players suffix
*/
@Deprecated
public String getPlayerSuffix(World world, String player) {
@ -175,7 +176,7 @@ public abstract class Chat {
/**
* Get players suffix in the world they are currently in.
*
*
* @param player Player Object
* @return Suffix
*/
@ -184,34 +185,34 @@ public abstract class Chat {
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead.
*
* Set players suffix
* @param world World name
* @param player Player name
* @param suffix Suffix
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead.
*
* Set players suffix
*/
@Deprecated
abstract public void setPlayerSuffix(String world, String player, String suffix);
/**
* Set players suffix for the world specified
*
*
* @param world World name
* @param player OfflinePlayer
* @param suffix Suffix
*/
public void setPlayerSuffix(String world, OfflinePlayer player, String suffix) {
setPlayerSuffix(world, player.getName(), suffix);
setPlayerSuffix(world, player.getName(), suffix);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead.
*
* Set players suffix
* @param world World Object
* @param player Player name
* @param suffix Suffix
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead.
*
* Set players suffix
*/
@Deprecated
public void setPlayerSuffix(World world, String player, String suffix) {
@ -220,7 +221,7 @@ public abstract class Chat {
/**
* Set players suffix in the world they currently occupy.
*
*
* @param player Player Object
* @param suffix Suffix
*/
@ -230,6 +231,7 @@ public abstract class Chat {
/**
* Get group prefix
*
* @param world World name
* @param group Group name
* @return Prefix
@ -238,6 +240,7 @@ public abstract class Chat {
/**
* Get group prefix
*
* @param world World Object
* @param group Group name
* @return Prefix
@ -248,6 +251,7 @@ public abstract class Chat {
/**
* Set group prefix
*
* @param world World name
* @param group Group name
* @param prefix Prefix
@ -256,6 +260,7 @@ public abstract class Chat {
/**
* Set group prefix
*
* @param world World Object
* @param group Group name
* @param prefix Prefix
@ -266,6 +271,7 @@ public abstract class Chat {
/**
* Get group suffix
*
* @param world World name
* @param group Group name
* @return Suffix
@ -274,6 +280,7 @@ public abstract class Chat {
/**
* Get group suffix
*
* @param world World Object
* @param group Group name
* @return Suffix
@ -284,6 +291,7 @@ public abstract class Chat {
/**
* Set group suffix
*
* @param world World name
* @param group Group name
* @param suffix Suffix
@ -292,6 +300,7 @@ public abstract class Chat {
/**
* Set group suffix
*
* @param world World Object
* @param group Group name
* @param suffix Suffix
@ -300,8 +309,9 @@ public abstract class Chat {
setGroupSuffix(world.getName(), group, suffix);
}
/**
/**
* Get a players informational node (Integer) value
*
* @param world World name
* @param player OfflinePlayer
* @param node Permission node
@ -309,30 +319,30 @@ public abstract class Chat {
* @return Value
*/
public int getPlayerInfoInteger(String world, OfflinePlayer player, String node, int defaultValue) {
return getPlayerInfoInteger(world, player.getName(), node, defaultValue);
return getPlayerInfoInteger(world, player.getName(), node, defaultValue);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead.
* Get a players informational node (Integer) value
/**
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead.
* Get a players informational node (Integer) value
*/
@Deprecated
abstract public int getPlayerInfoInteger(String world, String player, String node, int defaultValue);
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead.
*
* 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
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead.
*
* Get a players informational node (Integer) value
*/
@Deprecated
public int getPlayerInfoInteger(World world, String player, String node, int defaultValue) {
@ -341,6 +351,7 @@ public abstract class Chat {
/**
* Get a players informational node (Integer) value
*
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
@ -352,35 +363,36 @@ public abstract class Chat {
/**
* Set a players informational node (Integer) value
*
* @param world World name
* @param player OfflinePlayer
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoInteger(String world, OfflinePlayer player, String node, int value) {
setPlayerInfoInteger(world, player.getName(), node, value);
setPlayerInfoInteger(world, player.getName(), node, value);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead.
*
* Set a players informational node (Integer) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead.
*
* Set a players informational node (Integer) value
*/
@Deprecated
abstract public void setPlayerInfoInteger(String world, String player, String node, int value);
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead.
*
* Set a players informational node (Integer) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param value Value to set
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead.
*
* Set a players informational node (Integer) value
*/
@Deprecated
public void setPlayerInfoInteger(World world, String player, String node, int value) {
@ -389,6 +401,7 @@ public abstract class Chat {
/**
* Set a players informational node (Integer) value
*
* @param player Player Object
* @param node Permission node
* @param value Value to set
@ -399,6 +412,7 @@ public abstract class Chat {
/**
* Get a groups informational node (Integer) value
*
* @param world World name
* @param group Group name
* @param node Permission node
@ -409,6 +423,7 @@ public abstract class Chat {
/**
* Get a groups informational node (Integer) value
*
* @param world World Object
* @param group Group name
* @param node Permission node
@ -421,6 +436,7 @@ public abstract class Chat {
/**
* Set a groups informational node (Integer) value
*
* @param world World name
* @param group Group name
* @param node Permission node
@ -430,6 +446,7 @@ public abstract class Chat {
/**
* Set a groups informational node (Integer) value
*
* @param world World Object
* @param group Group name
* @param node Permission node
@ -441,6 +458,7 @@ public abstract class Chat {
/**
* Get a players informational node (Double) value
*
* @param world World name
* @param player OfflinePlayer
* @param node Permission node
@ -448,31 +466,31 @@ public abstract class Chat {
* @return Value
*/
public double getPlayerInfoDouble(String world, OfflinePlayer player, String node, double defaultValue) {
return getPlayerInfoDouble(world, player.getName(), node, defaultValue);
return getPlayerInfoDouble(world, player.getName(), node, defaultValue);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead.
*
* Get a players informational node (Double) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead.
*
* Get a players informational node (Double) value
*/
@Deprecated
abstract public double getPlayerInfoDouble(String world, String player, String node, double defaultValue);
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead
*
* 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
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead
*
* Get a players informational node (Double) value
*/
@Deprecated
public double getPlayerInfoDouble(World world, String player, String node, double defaultValue) {
@ -481,6 +499,7 @@ public abstract class Chat {
/**
* Get a players informational node (Double) value
*
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
@ -492,33 +511,34 @@ public abstract class Chat {
/**
* Set a players informational node (Double) value
*
* @param world World name
* @param player OfflinePlayer
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoDouble(String world, OfflinePlayer player, String node, double value) {
setPlayerInfoDouble(world, player.getName(), node, value);
setPlayerInfoDouble(world, player.getName(), node, value);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead.
* Set a players informational node (Double) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead.
* Set a players informational node (Double) value
*/
@Deprecated
abstract public void setPlayerInfoDouble(String world, String player, String node, double value);
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead.
* Set a players informational node (Double) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param value Value to set
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead.
* Set a players informational node (Double) value
*/
@Deprecated
public void setPlayerInfoDouble(World world, String player, String node, double value) {
@ -527,6 +547,7 @@ public abstract class Chat {
/**
* Set a players informational node (Double) value
*
* @param player Player Object
* @param node Permission node
* @param value Value to set
@ -537,6 +558,7 @@ public abstract class Chat {
/**
* Get a groups informational node (Double) value
*
* @param world World name
* @param group Group name
* @param node Permission node
@ -547,6 +569,7 @@ public abstract class Chat {
/**
* Get a groups informational node (Double) value
*
* @param world World Object
* @param group Group name
* @param node Permission node
@ -559,6 +582,7 @@ public abstract class Chat {
/**
* Set a groups informational node (Double) value
*
* @param world World name
* @param group Group name
* @param node Permission node
@ -568,6 +592,7 @@ public abstract class Chat {
/**
* Set a groups informational node (Double) value
*
* @param world World Object
* @param group Group name
* @param node Permission node
@ -579,6 +604,7 @@ public abstract class Chat {
/**
* Get a players informational node (Boolean) value
*
* @param world World name
* @param player OfflinePlayer
* @param node Permission node
@ -586,31 +612,31 @@ public abstract class Chat {
* @return Value
*/
public boolean getPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean defaultValue) {
return getPlayerInfoBoolean(world, player.getName(), node, defaultValue);
return getPlayerInfoBoolean(world, player.getName(), node, defaultValue);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead.
*
* Get a players informational node (Boolean) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead.
*
* Get a players informational node (Boolean) value
*/
@Deprecated
abstract public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue);
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead.
*
* 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
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead.
*
* Get a players informational node (Boolean) value
*/
@Deprecated
public boolean getPlayerInfoBoolean(World world, String player, String node, boolean defaultValue) {
@ -619,6 +645,7 @@ public abstract class Chat {
/**
* Get a players informational node (Boolean) value
*
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
@ -630,33 +657,34 @@ public abstract class Chat {
/**
* Set a players informational node (Boolean) value
*
* @param world World name
* @param player OfflinePlayer
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean value) {
setPlayerInfoBoolean(world, player.getName(), node, value);
setPlayerInfoBoolean(world, player.getName(), node, value);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead.
* Set a players informational node (Boolean) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead.
* Set a players informational node (Boolean) value
*/
@Deprecated
abstract public void setPlayerInfoBoolean(String world, String player, String node, boolean value);
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead.
* Set a players informational node (Boolean) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param value Value to set
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead.
* Set a players informational node (Boolean) value
*/
@Deprecated
public void setPlayerInfoBoolean(World world, String player, String node, boolean value) {
@ -665,6 +693,7 @@ public abstract class Chat {
/**
* Set a players informational node (Boolean) value
*
* @param player Player Object
* @param node Permission node
* @param value Value to set
@ -675,6 +704,7 @@ public abstract class Chat {
/**
* Get a groups informational node (Boolean) value
*
* @param world Name of World
* @param group Name of Group
* @param node Permission node
@ -685,6 +715,7 @@ public abstract class Chat {
/**
* Set a players informational node (Boolean) value
*
* @param world World Object
* @param group Group name
* @param node Permission node
@ -697,6 +728,7 @@ public abstract class Chat {
/**
* Set a groups informational node (Boolean) value
*
* @param world World name
* @param group Group name
* @param node Permission node
@ -706,6 +738,7 @@ public abstract class Chat {
/**
* Set a players informational node (Boolean) value
*
* @param world World Object
* @param group Group name
* @param node Permission node
@ -714,9 +747,10 @@ public abstract class Chat {
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 World name
* @param player OfflinePlayer
* @param node Permission node
@ -724,30 +758,30 @@ public abstract class Chat {
* @return Value
*/
public String getPlayerInfoString(String world, OfflinePlayer player, String node, String defaultValue) {
return getPlayerInfoString(world, player.getName(), node, defaultValue);
return getPlayerInfoString(world, player.getName(), node, defaultValue);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead.
*
* Get a players informational node (String) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead.
*
* Get a players informational node (String) value
*/
@Deprecated
abstract public String getPlayerInfoString(String world, String player, String node, String defaultValue);
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead.
* 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
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead.
* Get a players informational node (String) value
*/
@Deprecated
public String getPlayerInfoString(World world, String player, String node, String defaultValue) {
@ -756,6 +790,7 @@ public abstract class Chat {
/**
* Get a players informational node (String) value
*
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
@ -764,36 +799,37 @@ public abstract class Chat {
public String getPlayerInfoString(Player player, String node, String defaultValue) {
return getPlayerInfoString(player.getWorld().getName(), player, node, defaultValue);
}
/**
* Set a players informational node (String) value
*
* @param world World name
* @param player OfflinePlayer
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoString(String world, OfflinePlayer player, String node, String value) {
setPlayerInfoString(world, player.getName(), node, value);
setPlayerInfoString(world, player.getName(), node, value);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead.
* Set a players informational node (String) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead.
* Set a players informational node (String) value
*/
@Deprecated
abstract public void setPlayerInfoString(String world, String player, String node, String value);
/**
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead.
* Set a players informational node (String) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
* @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead.
* Set a players informational node (String) value
*/
@Deprecated
public void setPlayerInfoString(World world, String player, String node, String value) {
@ -802,6 +838,7 @@ public abstract class Chat {
/**
* Set a players informational node (String) value
*
* @param player Player Object
* @param node Permission node
* @param value Value ot set
@ -812,6 +849,7 @@ public abstract class Chat {
/**
* Get a groups informational node (String) value
*
* @param world Name of World
* @param group Name of Group
* @param node Permission node
@ -822,6 +860,7 @@ public abstract class Chat {
/**
* Set a players informational node (String) value
*
* @param world World Object
* @param group Group name
* @param node Permission node
@ -834,6 +873,7 @@ public abstract class Chat {
/**
* Set a groups informational node (String) value
*
* @param world World name
* @param group Group name
* @param node Permission node
@ -843,6 +883,7 @@ public abstract class Chat {
/**
* Set a groups informational node (String) value
*
* @param world World name
* @param group Group name
* @param node Permission node
@ -851,38 +892,39 @@ public abstract class Chat {
public void setGroupInfoString(World world, String group, String node, String value) {
setGroupInfoString(world.getName(), group, node, value);
}
/**
* Check if player is member of a group.
*
* @param world World name
* @param player OfflinePlayer
* @param group Group name
* @return Success or Failure
*/
public boolean playerInGroup(String world, OfflinePlayer player, String group) {
return perms.playerInGroup(world, player, group);
return perms.playerInGroup(world, player, group);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead.
* Check if player is member of a group.
* @param world World name
* @param player Player name
* @param group Group name
* @return Success or Failure
* @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead.
* Check if player is member of a group.
*/
@Deprecated
public boolean playerInGroup(String world, String player, String group) {
return perms.playerInGroup(world, player, group);
return perms.playerInGroup(world, player, group);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead.
* Check if player is member of a group.
* @param world World Object
* @param player Player name
* @param group Group name
* @return Success or Failure
* @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead.
* Check if player is member of a group.
*/
@Deprecated
public boolean playerInGroup(World world, String player, String group) {
@ -891,6 +933,7 @@ public abstract class Chat {
/**
* Check if player is member of a group.
*
* @param player Player Object
* @param group Group name
* @return Success or Failure
@ -898,35 +941,36 @@ public abstract class Chat {
public boolean playerInGroup(Player player, String group) {
return playerInGroup(player.getWorld().getName(), player, group);
}
/**
* Gets the list of groups that this player has
*
* @param world World name
* @param player OfflinePlayer
* @return Array of groups
*/
public String[] getPlayerGroups(String world, OfflinePlayer player) {
return perms.getPlayerGroups(world, player);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerGroups(String, OfflinePlayer)} instead.
* Gets the list of groups that this player has
* @param world World name
* @param player Player name
* @return Array of groups
*/
@Deprecated
public String[] getPlayerGroups(String world, String player) {
return perms.getPlayerGroups(world, player);
return perms.getPlayerGroups(world, player);
}
/**
* @param world World name
* @param player Player name
* @return Array of groups
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerGroups(String, OfflinePlayer)} instead.
* Gets the list of groups that this player has
*/
@Deprecated
public String[] getPlayerGroups(String world, String player) {
return perms.getPlayerGroups(world, player);
}
/**
* @param world World Object
* @param player Player name
* @return Array of groups
* @deprecated As of VaultAPI 1.4 use {{@link #getPlayerGroups(String, OfflinePlayer)} instead.
* Gets the list of groups that this player has
*/
@Deprecated
public String[] getPlayerGroups(World world, String player) {
@ -935,41 +979,43 @@ public abstract class Chat {
/**
* 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);
}
/**
* Gets players primary group
*
* @param world World name
* @param player OfflinePlayer
* @return Players primary group
*/
public String getPrimaryGroup(String world, OfflinePlayer player) {
return perms.getPrimaryGroup(world, player);
return perms.getPrimaryGroup(world, player);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead.
* Gets players primary group
* @param world World name
* @param player Player name
* @return Players primary group
* @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead.
* Gets players primary group
*/
@Deprecated
public String getPrimaryGroup(String world, String player) {
return perms.getPrimaryGroup(world, player);
return perms.getPrimaryGroup(world, player);
}
/**
* @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead.
* Gets players primary group
* @param world World Object
* @param player Player name
* @return Players primary group
* @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead.
* Gets players primary group
*/
@Deprecated
public String getPrimaryGroup(World world, String player) {
@ -978,18 +1024,20 @@ public abstract class Chat {
/**
* Get players primary group
*
* @param player Player Object
* @return Players primary group
*/
public String getPrimaryGroup(Player player) {
return getPrimaryGroup(player.getWorld().getName(), player);
}
/**
* Returns a list of all known groups
*
* @return an Array of String of all groups
*/
public String[] getGroups() {
return perms.getGroups();
return perms.getGroups();
}
}

View File

@ -27,31 +27,33 @@ import org.bukkit.plugin.Plugin;
/**
* The main Permission API - allows for group and player based permission tests
*
*/
public abstract class Permission {
protected static final Logger log = Logger.getLogger("Minecraft");
protected static final Logger log = Logger.getLogger("Minecraft");
protected Plugin plugin = null;
/**
* Gets name of permission method
*
* @return Name of Permission Method
*/
abstract public String getName();
/**
* Checks if permission method is enabled.
*
* @return Success or Failure
*/
abstract public boolean isEnabled();
/**
* Returns if the permission system is or attempts to be compatible with super-perms.
*
* @return True if this permission implementation works with super-perms
*/
abstract public boolean hasSuperPermsCompat();
/**
* @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead.
*/
@ -78,8 +80,9 @@ public abstract class Permission {
* Checks if a CommandSender has a permission node.
* This will return the result of bukkits, generic .hasPermission() method and is identical in all cases.
* This method will explicitly fail if the registered permission system does not register permissions in bukkit.
*
*
* For easy checking of a commandsender
*
* @param sender to check permissions on
* @param permission to check for
* @return true if the sender has the permission
@ -90,6 +93,7 @@ public abstract class Permission {
/**
* Checks if player has a permission node. (Short for playerHas(...)
*
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
@ -114,21 +118,21 @@ public abstract class Permission {
}
return playerHas(world.getName(), player, permission);
}
/**
* Checks if player has a permission node.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world String world name
* @param player to check
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerHas(String world, OfflinePlayer player, String permission) {
if (world == null) {
return has((String) null, player.getName(), permission);
}
if (world == null) {
return has((String) null, player.getName(), permission);
}
return has(world, player.getName(), permission);
}
@ -136,7 +140,7 @@ public abstract class Permission {
* Checks if player has a permission node.
* Defaults to world-specific permission check if the permission system supports it.
* See {@link #playerHas(String, OfflinePlayer, String)} for explicit global or world checks.
*
*
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
@ -146,15 +150,14 @@ public abstract class Permission {
}
/**
* @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead.
* Add permission to a player.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
* @param world World name
* @param player Player name
* @param permission Permission node
* @return Success or Failure
* @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead.
* Add permission to a player.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*/
@Deprecated
abstract public boolean playerAdd(String world, String player, String permission);
@ -174,7 +177,7 @@ public abstract class Permission {
* Add permission to a player.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world String world name
* @param player to add to
* @param permission Permission node
@ -191,7 +194,7 @@ public abstract class Permission {
* Add permission to a player ONLY for the world the player is currently on.
* This is a world-specific operation, if you want to add global permission you must explicitly use NULL for the world.
* See {@link #playerAdd(String, OfflinePlayer, String)} for global permission use.
*
*
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
@ -199,97 +202,97 @@ public abstract class Permission {
public boolean playerAdd(Player player, String permission) {
return playerAdd(player.getWorld().getName(), player, permission);
}
/**
* Add transient permission to a player.
* This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e.
* This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e.
* one that only needs the built-in Bukkit API to add transient permissions to a player.
*
*
* @param player to add to
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerAddTransient(OfflinePlayer player, String permission) throws UnsupportedOperationException {
if (player.isOnline()) {
return playerAddTransient((Player) player, permission);
}
throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!");
}
if (player.isOnline()) {
return playerAddTransient((Player) player, permission);
}
throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!");
}
/**
* Add transient permission to a player.
* This operation adds a permission onto the player object in bukkit via Bukkit's permission interface.
*
*
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerAddTransient(Player player, String permission) {
for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) {
if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) {
paInfo.getAttachment().setPermission(permission, true);
return true;
}
}
for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) {
if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) {
paInfo.getAttachment().setPermission(permission, true);
return true;
}
}
PermissionAttachment attach = player.addAttachment(plugin);
attach.setPermission(permission, true);
PermissionAttachment attach = player.addAttachment(plugin);
attach.setPermission(permission, true);
return true;
return true;
}
/**
* Adds a world specific transient permission to the player, may only work with some permission managers.
* Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions!
*
*
* @param worldName to check on
* @param player to add to
* @param permission to test
* @return Success or Failure
*/
public boolean playerAddTransient(String worldName, OfflinePlayer player, String permission) {
return playerAddTransient(player, permission);
return playerAddTransient(player, permission);
}
/**
* Adds a world specific transient permission to the player, may only work with some permission managers.
* Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions!
*
*
* @param worldName to check on
* @param player to check
* @param permission to check for
* @return Success or Failure
*/
public boolean playerAddTransient(String worldName, Player player, String permission) {
return playerAddTransient(player, permission);
return playerAddTransient(player, permission);
}
/**
* Removes a world specific transient permission from the player, may only work with some permission managers.
* Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions!
*
*
* @param worldName to remove for
* @param player to remove for
* @param permission to remove
* @return Success or Failure
*/
public boolean playerRemoveTransient(String worldName, OfflinePlayer player, String permission) {
return playerRemoveTransient(player, permission);
return playerRemoveTransient(player, permission);
}
/**
* Removes a world specific transient permission from the player, may only work with some permission managers.
* Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions!
*
*
* @param worldName to check on
* @param player to check
* @param permission to check for
* @return Success or Failure
*/
public boolean playerRemoveTransient(String worldName, Player player, String permission) {
return playerRemoveTransient((OfflinePlayer) player, permission);
return playerRemoveTransient((OfflinePlayer) player, permission);
}
/**
* @deprecated As of VaultAPI 1.4 use {@link #playerRemove(String, OfflinePlayer, String)} instead.
*/
@ -300,7 +303,7 @@ public abstract class Permission {
* Remove permission from a player.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World name
* @param player OfflinePlayer
* @param permission Permission node
@ -317,7 +320,7 @@ public abstract class Permission {
* Remove permission from a player.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World name
* @param player Player name
* @param permission Permission node
@ -334,7 +337,7 @@ public abstract class Permission {
/**
* Remove permission from a player.
* Will attempt to remove permission from the player on the player's current world. This is NOT a global operation.
*
*
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
@ -342,48 +345,48 @@ public abstract class Permission {
public boolean playerRemove(Player player, String permission) {
return playerRemove(player.getWorld().getName(), player, permission);
}
/**
* Remove transient permission from a player.
* This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e.
* This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e.
* one that only needs the built-in Bukkit API to remove transient permissions from a player. Any subclass
* implementing a plugin which provides its own API for this needs to override this method.
*
*
* @param player OfflinePlayer
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerRemoveTransient(OfflinePlayer player, String permission) {
if (player.isOnline()) {
return playerRemoveTransient((Player) player, permission);
} else {
return false;
}
}
public boolean playerRemoveTransient(OfflinePlayer player, String permission) {
if (player.isOnline()) {
return playerRemoveTransient((Player) player, permission);
} else {
return false;
}
}
/**
* Remove transient permission from a player.
*
*
* @param player Player Object
* @param permission Permission node
* @return Success or Failure
*/
public boolean playerRemoveTransient(Player player, String permission) {
for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) {
if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) {
paInfo.getAttachment().unsetPermission(permission);
return true;
}
}
return false;
for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) {
if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) {
paInfo.getAttachment().unsetPermission(permission);
return true;
}
}
return false;
}
/**
* Checks if group has a permission node.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World name
* @param group Group name
* @param permission Permission node
@ -395,7 +398,7 @@ public abstract class Permission {
* Checks if group has a permission node.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World Object
* @param group Group name
* @param permission Permission node
@ -412,7 +415,7 @@ public abstract class Permission {
* Add permission to a group.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World name
* @param group Group name
* @param permission Permission node
@ -424,7 +427,7 @@ public abstract class Permission {
* Add permission to a group.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World Object
* @param group Group name
* @param permission Permission node
@ -441,7 +444,7 @@ public abstract class Permission {
* Remove permission from a group.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World name
* @param group Group name
* @param permission Permission node
@ -453,7 +456,7 @@ public abstract class Permission {
* Remove permission from a group.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World Object
* @param group Group name
* @param permission Permission node
@ -482,12 +485,12 @@ public abstract class Permission {
}
return playerInGroup(world.getName(), player, group);
}
/**
* Check if player is member of a group.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World Object
* @param player to check
* @param group Group name
@ -504,7 +507,7 @@ public abstract class Permission {
* Check if player is member of a group.
* This method will ONLY check groups for which the player is in that are defined for the current world.
* This may result in odd return behaviour depending on what permission system has been registered.
*
*
* @param player Player Object
* @param group Group name
* @return Success or Failure
@ -534,7 +537,7 @@ public abstract class Permission {
* Add player to a group.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world String world name
* @param player to add
* @param group Group name
@ -546,12 +549,12 @@ public abstract class Permission {
}
return playerAddGroup(world, player.getName(), group);
}
/**
* Add player to a group.
* This will add a player to the group on the current World. This may return odd results if the permission system
* being used on the server does not support world-specific groups, or if the group being added to is a global group.
*
*
* @param player Player Object
* @param group Group name
* @return Success or Failure
@ -576,12 +579,12 @@ public abstract class Permission {
}
return playerRemoveGroup(world.getName(), player, group);
}
/**
* Remove player from a group.
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world World Object
* @param player to remove
* @param group Group name
@ -598,7 +601,7 @@ public abstract class Permission {
* Remove player from a group.
* This will add a player to the group on the current World. This may return odd results if the permission system
* being used on the server does not support world-specific groups, or if the group being added to is a global group.
*
*
* @param player Player Object
* @param group Group name
* @return Success or Failure
@ -623,25 +626,25 @@ public abstract class Permission {
}
return getPlayerGroups(world.getName(), player);
}
/**
* Gets the list of groups that this player has
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world String world name
* @param player OfflinePlayer
* @return Array of groups
*/
public String[] getPlayerGroups(String world, OfflinePlayer player) {
return getPlayerGroups(world, player.getName());
return getPlayerGroups(world, player.getName());
}
/**
* Returns a list of world-specific groups that this player is currently in. May return unexpected results if
* you are looking for global groups, or if the registered permission system does not support world-specific groups.
* See {@link #getPlayerGroups(String, OfflinePlayer)} for better control of World-specific or global groups.
*
*
* @param player Player Object
* @return Array of groups
*/
@ -665,12 +668,12 @@ public abstract class Permission {
}
return getPrimaryGroup(world.getName(), player);
}
/**
* Gets players primary group
* Supports NULL value for World if the permission system registered supports global permissions.
* But May return odd values if the servers registered permission system does not have a global permission store.
*
*
* @param world String world name
* @param player to get from
* @return Players primary group
@ -683,22 +686,24 @@ public abstract class Permission {
* Get players primary group.
* Defaults to the players current world, so may return only world-specific groups.
* In most cases {@link #getPrimaryGroup(String, OfflinePlayer)} is preferable.
*
*
* @param player Player Object
* @return Players primary group
*/
public String getPrimaryGroup(Player player) {
return getPrimaryGroup(player.getWorld().getName(), player);
}
/**
* Returns a list of all known groups
*
* @return an Array of String of all groups
*/
abstract public String[] getGroups();
/**
* Returns true if the given implementation supports groups.
*
* @return true if the implementation supports groups
*/
abstract public boolean hasGroupSupport();