Class PermissionsManager

java.lang.Object
net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager

public final class PermissionsManager extends Object
Author:
phaed
  • Constructor Details

    • PermissionsManager

      public PermissionsManager()
  • Method Details

    • hasEconomy

      public boolean hasEconomy()
      Whether economy plugin exists and is enabled
    • loadPermissions

      public void loadPermissions()
      Loads the permissions for each clan from the config
    • savePermissions

      public void savePermissions()
      Saves the permissions for each clan from the config
    • updateClanPermissions

      public void updateClanPermissions(Clan clan)
      Adds all permissions for a clan
    • addPlayerPermissions

      public void addPlayerPermissions(@Nullable @Nullable ClanPlayer cp)
      Adds permissions for a player
    • removeClanPermissions

      public void removeClanPermissions(Clan clan)
      Removes permissions for a clan (when it gets disbanded for example)
    • removeClanPlayerPermissions

      public void removeClanPlayerPermissions(@Nullable @Nullable ClanPlayer cp)
      Removes permissions for a player (when he gets kicked for example)
    • removeClanPermissions

      public void removeClanPermissions(ClanPlayer cp)
      Removes permissions linked to a clan from the player
    • getPermissions

      public List<String> getPermissions(Clan clan)
      Returns:
      the permissions for a clan
    • format

      public String format(double value)
    • playerChargeMoney

      @Deprecated public boolean playerChargeMoney(org.bukkit.OfflinePlayer player, double money)
      Deprecated.
      Charge a player some money
    • chargePlayer

      public boolean chargePlayer(org.bukkit.OfflinePlayer player, double money)
      Charges the specified amount of money from the player's account.

      As the EconomyTransactionEvent.Cause is not passed, this method won't fire the EconomyTransactionEvent. Use this method when you don't need to track the cause or handle custom transaction events.

      Parameters:
      player - The player whose account will be charged.
      money - The amount of money to charge.
      See Also:
    • chargePlayer

      public boolean chargePlayer(@NotNull @NotNull org.bukkit.OfflinePlayer player, double money, @Nullable @Nullable EconomyTransactionEvent.Cause cause)
      Charges the specified amount of money from the player's account.
      Parameters:
      player - The player whose account will be charged.
      money - The amount of money to charge.
      cause - The cause of the transaction.
      Returns:
      true if the charge was successful, false otherwise.
      See Also:
    • playerGrantMoney

      @Deprecated public boolean playerGrantMoney(org.bukkit.OfflinePlayer player, double money)
      Deprecated.
      Grants a player some money
    • grantPlayer

      public boolean grantPlayer(org.bukkit.OfflinePlayer player, double money)
      Grants the specified amount of money to the player's account.

      As the EconomyTransactionEvent.Cause is not passed, this method won't fire the EconomyTransactionEvent. Use this method when you don't need to track the cause or handle custom transaction events.

      Parameters:
      player - The player to whom the money will be granted.
      money - The amount of money to grant.
      See Also:
    • grantPlayer

      public boolean grantPlayer(@NotNull @NotNull org.bukkit.OfflinePlayer player, double money, @Nullable @Nullable EconomyTransactionEvent.Cause cause)
      Grants the specified amount of money to the player's account.
      Parameters:
      player - The player to whom the money will be granted.
      money - The amount of money to grant.
      cause - The cause of the transaction.
      Returns:
      true if the grant was successful, false otherwise.
      See Also:
    • playerHasMoney

      public boolean playerHasMoney(org.bukkit.OfflinePlayer player, double money)
      Check if a user has the money
      Returns:
      whether he has the money
    • playerGetMoney

      public double playerGetMoney(org.bukkit.OfflinePlayer player)
      Returns the players money
      Returns:
      the players money
    • has

      public boolean has(@Nullable @Nullable org.bukkit.entity.Player player, String perm)
      Check if a player has permissions
      Parameters:
      player - the player
      perm - the permission
      Returns:
      whether he has the permission
    • has

      @Deprecated public boolean has(org.bukkit.entity.Player player, RankPermission permission, PermissionLevel level, boolean notify)
      Checks if the player has the rank permission or the permission level, and the equivalent Bukkit permission
      Parameters:
      player - the player
      permission - the rank permission
      notify - notify the player if they don't have permission
    • has

      public boolean has(org.bukkit.entity.Player player, RankPermission permission, boolean notify)
      Checks if the player has the rank permission or the permission level, and the equivalent Bukkit permission
      Parameters:
      player - the player
      permission - the rank permission
      notify - notify the player if they don't have permission
    • addClanPermissions

      public void addClanPermissions(ClanPlayer cp)
      Gives the player permissions linked to a clan
    • getPrefix

      public String getPrefix(org.bukkit.entity.Player p)
    • getSuffix

      public String getSuffix(org.bukkit.entity.Player p)