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 Summary
ConstructorsConstructorDescriptionVaultManager(ILocalizer localizer, ITextFactory textFactory, IConfig config, StructureTypeManager structureTypeManager, DebuggableRegistry debuggableRegistry, IExecutor executor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbuyStructure(IPlayer player, IWorld world, StructureType type, int blockCount) Buys a structure for a player.Gets the debug information for this object.getMaxPermissionSuffix(IPlayer player, String permissionBase) Gets the highest numerical permission suffix of the base permission node it can find, if any.getMaxPermissionSuffix(org.bukkit.entity.Player player, String permissionBase) Gets the highest numerical permission suffix of the base permission node it can find, if any.getPrice(StructureType type, int blockCount) Gets the price ofStructureTypefor a specific number of blocks.booleanhasBypassPermissionsForAttribute(IPlayer player, StructureAttribute structureAttribute) Checks if a player has bypass permissions for a specific attribute.booleanhasBypassPermissionsForAttribute(org.bukkit.entity.Player player, StructureAttribute structureAttribute) Checks if a player has bypass permissions for a specific attribute.booleanhasPermission(IPlayer player, String permissionNode) Checks if a player has a certain permission node or not.booleanhasPermission(org.bukkit.entity.Player player, String permission) Checks if a player has a certain permission node or not.hasPermissionOffline(org.bukkit.World world, org.bukkit.OfflinePlayer player, String permission) Asynchronously checks if an (offline) player has a certain permission node.booleanhasPermissionToCreateStructure(ICommandSender sender, StructureType type) Checks if the given command sender has permission to create a structure of the given type.voidHandles the initialization.booleanChecks if the economy manager is enabled.booleanChecks if the given player is a server operator or not.booleanisOp(@Nullable org.bukkit.entity.Player player) Checks if the given player is a server operator or not.voidshutDown()Handles a shutdown.
-
Constructor Details
-
VaultManager
@Inject public VaultManager(ILocalizer localizer, ITextFactory textFactory, IConfig config, StructureTypeManager structureTypeManager, DebuggableRegistry debuggableRegistry, IExecutor executor)
-
-
Method Details
-
buyStructure
Description copied from interface:IEconomyManagerBuys a structure for a player.- Specified by:
buyStructurein interfaceIEconomyManager- Parameters:
player- The player whose bank account to use.world- The world the structure is in.type- TheStructureTypeof 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:IEconomyManagerChecks if the economy manager is enabled.- Specified by:
isEconomyEnabledin interfaceIEconomyManager- Returns:
- True if the economy manager is enabled.
-
hasPermission
Description copied from interface:IPermissionsManagerSpigotChecks if a player has a certain permission node or not.- Specified by:
hasPermissionin interfaceIPermissionsManagerSpigot- 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:IPermissionsManagerSpigotAsynchronously checks if an (offline) player has a certain permission node.- Specified by:
hasPermissionOfflinein interfaceIPermissionsManagerSpigot- 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
Description copied from interface:IEconomyManagerGets the price ofStructureTypefor a specific number of blocks.- Specified by:
getPricein interfaceIEconomyManager- Parameters:
type- TheStructureType.blockCount- The number of blocks.- Returns:
- The price of this
StructureTypewith this number of blocks.
-
initialize
public void initialize()Description copied from interface:IRestartableHandles the initialization.- Specified by:
initializein interfaceIRestartable
-
shutDown
public void shutDown()Description copied from interface:IRestartableHandles a shutdown.- Specified by:
shutDownin interfaceIRestartable
-
getMaxPermissionSuffix
Description copied from interface:IPermissionsManagerSpigotGets 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:
getMaxPermissionSuffixin interfaceIPermissionsManagerSpigot- 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
Description copied from interface:IPermissionsManagerGets 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:
getMaxPermissionSuffixin interfaceIPermissionsManager- 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
Description copied from interface:IPermissionsManagerChecks if a player has a certain permission node or not.- Specified by:
hasPermissionin interfaceIPermissionsManager- 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:IPermissionsManagerSpigotChecks 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:
hasBypassPermissionsForAttributein interfaceIPermissionsManagerSpigot- 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:IPermissionsManagerChecks 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:
hasBypassPermissionsForAttributein interfaceIPermissionsManager- 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 @Nullable org.bukkit.entity.Player player) Description copied from interface:IPermissionsManagerSpigotChecks if the given player is a server operator or not.- Specified by:
isOpin interfaceIPermissionsManagerSpigot- Parameters:
player- The player to check.- Returns:
- True if the player is a server operator on this server.
-
isOp
Description copied from interface:IPermissionsManagerChecks if the given player is a server operator or not.- Specified by:
isOpin interfaceIPermissionsManager- Parameters:
player- The player to check.- Returns:
- True if the player is a server operator on this server.
-
hasPermissionToCreateStructure
Description copied from interface:IPermissionsManagerChecks if the given command sender has permission to create a structure of the given type.- Specified by:
hasPermissionToCreateStructurein interfaceIPermissionsManager- 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
Description copied from interface:IDebuggableGets the debug information for this object.- Specified by:
getDebugInformationin interfaceIDebuggable- Returns:
- The debug information or null if there's nothing to log at this time.
-