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.
  • Method Details

    • getRegisteredHookDefinitions

      public Map<String, IProtectionHookSpigotSpecification> 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 IProtectionHookSpigotSpecification instances.
    • unloadHook

      public boolean unloadHook(IProtectionHookSpigot hook)
      Unload a hook.
      Parameters:
      hook - The hook to unload.
      Returns:
      True if a hook was unloaded, false otherwise.
    • unloadHook

      public boolean unloadHook(String pluginName)
      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

      public void registerHookDefinition(IProtectionHookSpigotSpecification hookDefinition)
      Registers a new hook definition.
      Parameters:
      hookDefinition - The hook definition to register.
    • canBreakBlock

      Description copied from interface: IProtectionHookManager
      Check if a player can break a block at a given location.
      Specified by:
      canBreakBlock in interface IProtectionHookManager
      Parameters:
      player - The IPlayer.
      location - The ILocation to 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: IProtectionHookManager
      Check if a player can break all blocks in a cuboid.
      Specified by:
      canBreakBlocksInCuboid in interface IProtectionHookManager
      Parameters:
      player - The IPlayer.
      cuboid - The Cuboid to check.
      world - The world.
      Returns:
      The name of the IProtectionCompat that objects, if any, or an empty Optional if allowed by all compats.
    • canSkipCheck

      public boolean canSkipCheck(IPlayer player)
      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()
      Description copied from interface: IProtectionHookManager
      Returns whether all checks for block-breaking access can be skipped.
      Specified by:
      canSkipCheck in interface IProtectionHookManager
      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:
      initialize in interface IRestartable
    • shutDown

      public void shutDown()
      Description copied from interface: IRestartable
      Handles a shutdown.
      Specified by:
      shutDown in interface IRestartable
    • 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.