Class VaultManager

java.lang.Object
nl.pim16aap2.animatedarchitecture.spigot.core.managers.VaultManager
All Implemented Interfaces:
IDebuggable, IEconomyManager, IPermissionsManager, IRestartable, IPermissionsManagerSpigot

@Singleton public final class VaultManager extends Object implements IRestartable, IEconomyManager, IPermissionsManagerSpigot, IDebuggable
Manages all interactions with Vault.
  • Constructor Details

  • Method Details

    • buyStructure

      public boolean buyStructure(IPlayer player, IWorld world, StructureType type, int blockCount)
      Description copied from interface: IEconomyManager
      Buys a structure for a player.
      Specified by:
      buyStructure in interface IEconomyManager
      Parameters:
      player - The player whose bank account to use.
      world - The world the structure is in.
      type - The StructureType of the structure.
      blockCount - The number of blocks in the structure.
      Returns:
      True if the player bought the structure successfully.
    • isEconomyEnabled

      public boolean isEconomyEnabled()
      Description copied from interface: IEconomyManager
      Checks if the economy manager is enabled.
      Specified by:
      isEconomyEnabled in interface IEconomyManager
      Returns:
      True if the economy manager is enabled.
    • hasPermission

      public boolean hasPermission(org.bukkit.entity.Player player, String permission)
      Description copied from interface: IPermissionsManagerSpigot
      Checks if a player has a certain permission node or not.
      Specified by:
      hasPermission in interface IPermissionsManagerSpigot
      Parameters:
      player - The player whose permissions to check.

      This player CANNOT be offline or a fake player! Use IPermissionsManagerSpigot.hasPermissionOffline(World, OfflinePlayer, String) instead.

      permission - The permission node to check.
      Returns:
      True if the player has the permission node.
    • hasPermissionOffline

      public CompletableFuture<Boolean> hasPermissionOffline(org.bukkit.World world, org.bukkit.OfflinePlayer player, String permission)
      Description copied from interface: IPermissionsManagerSpigot
      Asynchronously checks if an (offline) player has a certain permission node.
      Specified by:
      hasPermissionOffline in interface IPermissionsManagerSpigot
      Parameters:
      world - The world to check in.
      player - The player whose permissions to check.
      permission - The permission node to check.
      Returns:
      A CompletableFuture that will be completed with true if the player has the permission node, false
    • getPrice

      public OptionalDouble getPrice(StructureType type, int blockCount)
      Description copied from interface: IEconomyManager
      Gets the price of StructureType for a specific number of blocks.
      Specified by:
      getPrice in interface IEconomyManager
      Parameters:
      type - The StructureType.
      blockCount - The number of blocks.
      Returns:
      The price of this StructureType with this number of blocks.
    • initialize

      public void initialize()
      Description copied from interface: IRestartable
      Handles the initialization.
      Specified by:
      initialize in interface IRestartable
    • shutDown

      public void shutDown()
      Description copied from interface: IRestartable
      Handles a shutdown.
      Specified by:
      shutDown in interface IRestartable
    • getMaxPermissionSuffix

      public OptionalInt getMaxPermissionSuffix(org.bukkit.entity.Player player, String permissionBase)
      Description copied from interface: IPermissionsManagerSpigot
      Gets the highest numerical permission suffix of the base permission node it can find, if any.

      For example, if a player has "permission.node.1" and "permission.node.2", this method would return (the OptionalInt of) 2.

      Specified by:
      getMaxPermissionSuffix in interface IPermissionsManagerSpigot
      Parameters:
      player - The player whose permissions to check.
      permissionBase - The base permission. In the example above, this would be "permission.node." (note the '.' at the end).
      Returns:
      The highest numerical suffix of the base permission node if it exists, otherwise an empty OptionalInt.
    • getMaxPermissionSuffix

      public OptionalInt getMaxPermissionSuffix(IPlayer player, String permissionBase)
      Description copied from interface: IPermissionsManager
      Gets the highest numerical permission suffix of the base permission node it can find, if any.

      For example, if a player has "permission.node.1" and "permission.node.2", this method would return (the OptionalInt of) 2.

      Specified by:
      getMaxPermissionSuffix in interface IPermissionsManager
      Parameters:
      player - The player whose permissions to check.
      permissionBase - The base permission. In the example above, this would be "permission.node." (note the '.' at the end).
      Returns:
      The highest numerical suffix of the base permission node if it exists, otherwise an empty OptionalInt.
    • hasPermission

      public boolean hasPermission(IPlayer player, String permissionNode)
      Description copied from interface: IPermissionsManager
      Checks if a player has a certain permission node or not.
      Specified by:
      hasPermission in interface IPermissionsManager
      Parameters:
      player - The player whose permissions to check.
      permissionNode - The permission node to check.
      Returns:
      True if the player has the permission node.
    • hasBypassPermissionsForAttribute

      public boolean hasBypassPermissionsForAttribute(org.bukkit.entity.Player player, StructureAttribute structureAttribute)
      Description copied from interface: IPermissionsManagerSpigot
      Checks if a player has bypass permissions for a specific attribute.

      Having bypass permissions means that a player is able to access a given attribute for structures even if they are not co-owners of those structures.

      Specified by:
      hasBypassPermissionsForAttribute in interface IPermissionsManagerSpigot
      Parameters:
      player - The player whose permissions to check.
      structureAttribute - The attribute of the Structure for which to verify if the player has bypass permissions.
      Returns:
      True if the player has bypass permissions for the attribute.
    • hasBypassPermissionsForAttribute

      public boolean hasBypassPermissionsForAttribute(IPlayer player, StructureAttribute structureAttribute)
      Description copied from interface: IPermissionsManager
      Checks if a player has bypass permissions for a specific attribute.

      Having bypass permissions means that a player is able to access a given attribute for structures even if they are not co-owners of those structures.

      Specified by:
      hasBypassPermissionsForAttribute in interface IPermissionsManager
      Parameters:
      player - The player whose permissions to check.
      structureAttribute - The attribute of the Structure for which to verify if the player has bypass permissions.
      Returns:
      True if the player has bypass permissions for the attribute.
    • isOp

      public boolean isOp(@Nullable org.bukkit.entity.Player player)
      Description copied from interface: IPermissionsManagerSpigot
      Checks if the given player is a server operator or not.
      Specified by:
      isOp in interface IPermissionsManagerSpigot
      Parameters:
      player - The player to check.
      Returns:
      True if the player is a server operator on this server.
    • isOp

      public boolean isOp(IPlayer player)
      Description copied from interface: IPermissionsManager
      Checks if the given player is a server operator or not.
      Specified by:
      isOp in interface IPermissionsManager
      Parameters:
      player - The player to check.
      Returns:
      True if the player is a server operator on this server.
    • hasPermissionToCreateStructure

      public boolean hasPermissionToCreateStructure(ICommandSender sender, StructureType type)
      Description copied from interface: IPermissionsManager
      Checks if the given command sender has permission to create a structure of the given type.
      Specified by:
      hasPermissionToCreateStructure in interface IPermissionsManager
      Parameters:
      sender - The command sender to check.
      type - The type of structure to check.
      Returns:
      True if the sender has permission to create a structure of the given type.
    • getDebugInformation

      public String getDebugInformation()
      Description copied from interface: IDebuggable
      Gets the debug information for this object.
      Specified by:
      getDebugInformation in interface IDebuggable
      Returns:
      The debug information or null if there's nothing to log at this time.