Interface RegistryAPI

All Known Implementing Classes:
StargateRegistry

public interface RegistryAPI
The API for the stargate registry.
Author:
Thorin
  • Method Details

    • unregisterPortal

      @Internal void unregisterPortal(Portal portal)
      Removes the given portal from registry. Only modifies this registry, use NetworkManager.destroyPortal(RealPortal) instead
      Parameters:
      portal -

      The portal to remove

    • updateAllPortals

      void updateAllPortals()
      Update all portals handled by this registry
    • getPortal

      RealPortal getPortal(BlockLocation blockLocation, GateStructureType structureType)
      Get the portal with the given structure type at the given location
      Parameters:
      blockLocation -

      The location the portal is located at

      structureType -

      The structure type to look for

      Returns:

      The found portal, or null if no such portal exists

    • getPortal

      RealPortal getPortal(BlockLocation blockLocation, GateStructureType[] structureTypes)
      Get the portal with any of the given structure types at the given location
      Parameters:
      blockLocation -

      The location the portal is located at

      structureTypes -

      The structure types to look for

      Returns:

      The found portal, or null if no such portal exists

    • getPortal

      RealPortal getPortal(org.bukkit.Location location, GateStructureType structureType)
      Gets the portal with the given structure type at the given location
      Parameters:
      location -

      The location to check for portal structures

      structureType -

      The structure type to look for

      Returns:

      The found portal, or null if no portal was found

    • getPortal

      RealPortal getPortal(org.bukkit.Location location, GateStructureType[] structureTypes)
      Gets the portal with any of the given structure types at the given location
      Parameters:
      location -

      The location to check for portal structures

      structureTypes -

      The structure types to look for

      Returns:

      The found portal, or null if no portal was found

    • getPortal

      RealPortal getPortal(org.bukkit.Location location)
      Get the portal at the given location
      Parameters:
      location -

      The location to check for portal structures

      Returns:

      The found portal, or null if no portal was found

    • isPartOfPortal

      boolean isPartOfPortal(List<org.bukkit.block.Block> blocks)
      Checks if any of the given blocks belong to a portal
      Parameters:
      blocks -

      The blocks to check

      Returns:

      True if any of the given blocks belong to a portal

    • isNextToPortal

      boolean isNextToPortal(org.bukkit.Location location, GateStructureType structureType)
      Checks one block away from the given location to check if it's adjacent to a portal structure

      Checks North, west, south, east direction. Not up / down, as it is currently not necessary and a waste of resources.

      Parameters:
      location -

      The location to check for adjacency

      structureType -

      The structure type to look for

      Returns:

      True if the given location is adjacent to a location containing the given structure type

    • getPortalsFromTouchingBlock

      List<RealPortal> getPortalsFromTouchingBlock(org.bukkit.Location location, GateStructureType structureType)
      Get portal from block next to portal, will randomly choose one portal if block is next to two portals
      Parameters:
      location -

      The location to check for

      structureType -

      The structure type to check for

      Returns:
    • registerLocations

      void registerLocations(GateStructureType structureType, Map<BlockLocation,RealPortal> locationsMap)
      Registers the existence of the given structure type in the given locations

      Stores the portals that exist at the given locations, but using the structure type as the key to be able to check locations for the given structure type.

      Does not save to storage!

      Parameters:
      structureType -

      The structure type to register

      locationsMap -

      The locations and the corresponding portals to register

    • registerLocation

      void registerLocation(GateStructureType structureType, BlockLocation location, RealPortal portal)
      Registers a location with attached portal and structure type to this registry
      Parameters:
      structureType -

      The structure type to register

      location -

      The location to register

      portal -

      The portal to register

    • unRegisterLocation

      void unRegisterLocation(GateStructureType structureType, BlockLocation blockLocation)
      Un-registers all portal blocks with the given structure type, at the given block location
      Parameters:
      structureType -

      The type of structure to un-register

      blockLocation -

      The location to un-register

    • registerPortal

      void registerPortal(RealPortal portal)
      Register a portal to this registry
      Parameters:
      portal -

      The portal to register

    • networkExists

      boolean networkExists(String networkName, StorageType storageType)
      Checks whether the given network name exists
      Parameters:
      networkName -

      The network name to check

      storageType -

      The storage type of the network

      Returns:

      True if the network exists

    • getNetworkRegistry

      NetworkRegistry getNetworkRegistry(StorageType storageType)
      Get the network registry
      Parameters:
      storageType -
      Returns:
    • getNetwork

      @Nullable @Nullable Network getNetwork(String id, StorageType storageType)
      Gets the network with the given
      Parameters:
      id -

      The id of the network to get

      storageType -

      Whether the network is a BungeeCord network

      Returns:

      The network with the given name

    • getValidNewName

      String getValidNewName(Network network) throws InvalidNameException
      Get a non-clashing name close to the current name of the network.
      Parameters:
      network -

      The network to rename

      Throws:
      InvalidNameException -

      If the name is a uuid

    • getPortalPositions

      Map<BlockLocation,PortalPosition> getPortalPositions()
      Get all portal positions
      Returns:

      Data on all portal positions

    • getPortalPositionsOwnedByPlugin

      Map<BlockLocation,PortalPosition> getPortalPositionsOwnedByPlugin(org.bukkit.plugin.Plugin plugin)
      Parameters:
      plugin -

      The plugin owning the positions

      Returns:

      Data on the portal positions owned by specified plugin

    • savePortalPosition

      PortalPosition savePortalPosition(RealPortal portal, org.bukkit.Location location, PositionType type, org.bukkit.plugin.Plugin plugin)
      Save given portal position to storage and register it to the registry
      Parameters:
      portal -

      The portal the position is linked to

      location -

      The location of the position

      type -

      The type of the position

      plugin -

      The plugin this position relates to

    • removePortalPosition

      void removePortalPosition(org.bukkit.Location location)
      Remove portal position from registry
      Parameters:
      location -

      The location of the portal position

    • registerPortalPosition

      @Internal void registerPortalPosition(PortalPosition portalPosition, org.bukkit.Location location, RealPortal portal)
      Register given portal position to registry. Does not save to database, therefore internal
      Parameters:
      portalPosition -

      The portal position

      location -

      The location of the position

      portal -

      The portal of the position

    • getPortalPosition

      @Nullable @Nullable PortalPosition getPortalPosition(org.bukkit.Location location)
      Gets the portal position at given location
      Parameters:
      location -

      The location of the portal position

      Returns:

      The portal position, or null if none was found

    • registerNetwork

      @Internal void registerNetwork(Network network)
      Use NetworkManager instead. This does not save to database, and is not cross server compatible
      Parameters:
      network -

      The network to register

    • renameNetwork

      @Internal void renameNetwork(String newId, String oldId, StorageType storageType) throws InvalidNameException, UnimplementedFlagException, NameLengthException
      Use NetworkManager instead. This does not save to database, and is not cross server compatible
      Parameters:
      newId -

      The new id of the network

      oldId -

      The old id of the network

      Throws:
      InvalidNameException
      UnimplementedFlagException
      NameLengthException
    • getPortalsInChunk

      @NotNull @NotNull Set<RealPortal> getPortalsInChunk(StargateChunk chunk)
      Get all the portals in a chunk
      Parameters:
      chunk -

      The chunk to retrieve portals from

      Returns:

      The portals in the chunk