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,34 +23,36 @@ 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;
private Permission perms;
public Chat(Permission perms) {
this.perms = 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);
@ -64,16 +66,16 @@ public abstract class Chat {
* @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) {
@ -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);
@ -111,17 +113,16 @@ public abstract class Chat {
* @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) {
@ -139,12 +140,12 @@ 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);
@ -157,16 +158,16 @@ public abstract class Chat {
* @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) {
@ -184,12 +185,12 @@ 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);
@ -202,16 +203,16 @@ public abstract class Chat {
* @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) {
@ -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
@ -717,6 +750,7 @@ public abstract class Chat {
/**
* 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
@ -767,33 +802,34 @@ public abstract class Chat {
/**
* 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
@ -854,35 +895,36 @@ public abstract class Chat {
/**
* 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
@ -901,32 +944,33 @@ public abstract class Chat {
/**
* 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);
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 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);
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 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,6 +979,7 @@ public abstract class Chat {
/**
* Gets the list of groups that this player has
*
* @param player Player Object
* @return Array of groups
*/
@ -944,32 +989,33 @@ public abstract class Chat {
/**
* 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,6 +1024,7 @@ public abstract class Chat {
/**
* Get players primary group
*
* @param player Player Object
* @return Players primary group
*/
@ -987,9 +1034,10 @@ public abstract class Chat {
/**
* 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,27 +27,29 @@ 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();
@ -80,6 +82,7 @@ public abstract class Permission {
* 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
@ -126,9 +130,9 @@ public abstract class Permission {
* @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);
}
@ -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);
@ -210,11 +213,11 @@ public abstract class Permission {
* @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.
@ -225,17 +228,17 @@ public abstract class Permission {
* @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;
}
/**
@ -248,7 +251,7 @@ public abstract class Permission {
* @return Success or Failure
*/
public boolean playerAddTransient(String worldName, OfflinePlayer player, String permission) {
return playerAddTransient(player, permission);
return playerAddTransient(player, permission);
}
/**
@ -261,7 +264,7 @@ public abstract class Permission {
* @return Success or Failure
*/
public boolean playerAddTransient(String worldName, Player player, String permission) {
return playerAddTransient(player, permission);
return playerAddTransient(player, permission);
}
/**
@ -274,7 +277,7 @@ public abstract class Permission {
* @return Success or Failure
*/
public boolean playerRemoveTransient(String worldName, OfflinePlayer player, String permission) {
return playerRemoveTransient(player, permission);
return playerRemoveTransient(player, permission);
}
/**
@ -287,7 +290,7 @@ public abstract class Permission {
* @return Success or Failure
*/
public boolean playerRemoveTransient(String worldName, Player player, String permission) {
return playerRemoveTransient((OfflinePlayer) player, permission);
return playerRemoveTransient((OfflinePlayer) player, permission);
}
/**
@ -354,13 +357,13 @@ public abstract class Permission {
* @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.
@ -370,13 +373,13 @@ public abstract class Permission {
* @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;
}
/**
@ -634,7 +637,7 @@ public abstract class Permission {
* @return Array of groups
*/
public String[] getPlayerGroups(String world, OfflinePlayer player) {
return getPlayerGroups(world, player.getName());
return getPlayerGroups(world, player.getName());
}
/**
@ -693,12 +696,14 @@ public abstract class Permission {
/**
* 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();