Class ProtectionHookManagerSpigot
java.lang.Object
nl.pim16aap2.animatedarchitecture.spigot.core.hooks.ProtectionHookManagerSpigot
- All Implemented Interfaces:
IDebuggable,IProtectionHookManager,IRestartable,org.bukkit.event.Listener
@Singleton
public final class ProtectionHookManagerSpigot
extends Object
implements IRestartable, org.bukkit.event.Listener, IProtectionHookManager, IDebuggable
Class that manages all
IProtectionHookSpigot instances and provides a unified interface to them.-
Nested Class Summary
Nested classes/interfaces inherited from interface nl.pim16aap2.animatedarchitecture.core.api.IProtectionHookManager
IProtectionHookManager.HookCheckResult -
Method Summary
Modifier and TypeMethodDescriptioncanBreakBlock(IPlayer player, ILocation location) Check if a player can break a block at a given location.canBreakBlocksInCuboid(IPlayer player, Cuboid cuboid, IWorld world) Check if a player can break all blocks in a cuboid.booleanbooleancanSkipCheck(IPlayer player) Check if the checks can be skipped for a given player.Gets the debug information for this object.Getter for all registered protection hook specifications.voidHandles the initialization.voidregisterHookDefinition(IProtectionHookSpigotSpecification hookDefinition) Registers a new hook definition.voidshutDown()Handles a shutdown.booleanunloadHook(String pluginName) Unload a hook with a given name.booleanUnload a hook.
-
Method Details
-
getRegisteredHookDefinitions
Getter for all registered protection hook specifications.A registered specification can be used to load the hook it specifies when needed.
- Returns:
- The registered
IProtectionHookSpigotSpecificationinstances.
-
unloadHook
Unload a hook.- Parameters:
hook- The hook to unload.- Returns:
- True if a hook was unloaded, false otherwise.
-
unloadHook
Unload a hook with a given name.- Parameters:
pluginName- The name of the plugin to unload the hook for.- Returns:
- True if a hook was unloaded, false otherwise.
-
registerHookDefinition
Registers a new hook definition.- Parameters:
hookDefinition- The hook definition to register.
-
canBreakBlock
public CompletableFuture<IProtectionHookManager.HookCheckResult> canBreakBlock(IPlayer player, ILocation location) Description copied from interface:IProtectionHookManagerCheck if a player can break a block at a given location.- Specified by:
canBreakBlockin interfaceIProtectionHookManager- Parameters:
player- TheIPlayer.location- TheILocationto check.- Returns:
- The name of the IProtectionCompat that objects, if any, or an empty Optional if allowed by all compats.
-
canBreakBlocksInCuboid
public CompletableFuture<IProtectionHookManager.HookCheckResult> canBreakBlocksInCuboid(IPlayer player, Cuboid cuboid, IWorld world) Description copied from interface:IProtectionHookManagerCheck if a player can break all blocks in a cuboid.- Specified by:
canBreakBlocksInCuboidin interfaceIProtectionHookManager- Parameters:
player- TheIPlayer.cuboid- TheCuboidto check.world- The world.- Returns:
- The name of the IProtectionCompat that objects, if any, or an empty Optional if allowed by all compats.
-
canSkipCheck
Check if the checks can be skipped for a given player.- Parameters:
player- The player to check.- Returns:
- True if the checks can be skipped for the given player.
-
canSkipCheck
public boolean canSkipCheck()- Specified by:
canSkipCheckin interfaceIProtectionHookManager- Returns:
- True if all checks for block-breaking access can be skipped. This may happen when no hooks are enabled.
-
initialize
public void initialize()Handles the initialization.Reinitialize all protection hooks.
- Specified by:
initializein interfaceIRestartable
-
shutDown
public void shutDown()Description copied from interface:IRestartableHandles a shutdown.- Specified by:
shutDownin interfaceIRestartable
-
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.
-