Interface RegistryAPI
- All Known Implementing Classes:
StargateRegistry
- Author:
- Thorin
-
Method Summary
Modifier and TypeMethodDescription@Nullable Network
getNetwork
(String id, StorageType storageType) Gets the network with the givengetNetworkRegistry
(StorageType storageType) Get the network registrygetPortal
(org.bukkit.Location location) Get the portal at the given locationgetPortal
(org.bukkit.Location location, GateStructureType structureType) Gets the portal with the given structure type at the given locationgetPortal
(org.bukkit.Location location, GateStructureType[] structureTypes) Gets the portal with any of the given structure types at the given locationgetPortal
(BlockLocation blockLocation, GateStructureType structureType) Get the portal with the given structure type at the given locationgetPortal
(BlockLocation blockLocation, GateStructureType[] structureTypes) Get the portal with any of the given structure types at the given location@Nullable PortalPosition
getPortalPosition
(org.bukkit.Location location) Gets the portal position at given locationGet all portal positionsgetPortalPositionsOwnedByPlugin
(org.bukkit.plugin.Plugin plugin) 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@NotNull Set
<RealPortal> getPortalsInChunk
(StargateChunk chunk) Get all the portals in a chunkgetValidNewName
(Network network) Get a non-clashing name close to the current name of the network.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 structureboolean
isPartOfPortal
(List<org.bukkit.block.Block> blocks) Checks if any of the given blocks belong to a portalboolean
networkExists
(String networkName, StorageType storageType) Checks whether the given network name existsvoid
registerLocation
(GateStructureType structureType, BlockLocation location, RealPortal portal) Registers a location with attached portal and structure type to this registryvoid
registerLocations
(GateStructureType structureType, Map<BlockLocation, RealPortal> locationsMap) Registers the existence of the given structure type in the given locationsvoid
registerNetwork
(Network network) UseNetworkManager
instead.void
registerPortal
(RealPortal portal) Register a portal to this registryvoid
registerPortalPosition
(PortalPosition portalPosition, org.bukkit.Location location, RealPortal portal) Register given portal position to registry.void
removePortalPosition
(org.bukkit.Location location) Remove portal position from registryvoid
renameNetwork
(String newId, String oldId, StorageType storageType) UseNetworkManager
instead.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 registryvoid
unRegisterLocation
(GateStructureType structureType, BlockLocation blockLocation) Un-registers all portal blocks with the given structure type, at the given block locationvoid
unregisterPortal
(Portal portal) Removes the given portal from registry.void
Update all portals handled by this registry
-
Method Details
-
unregisterPortal
Removes the given portal from registry. Only modifies this registry, useNetworkManager.destroyPortal(RealPortal)
instead- Parameters:
portal
-The portal to remove
-
updateAllPortals
void updateAllPortals()Update all portals handled by this registry -
getPortal
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
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
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
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
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
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
Checks one block away from the given location to check if it's adjacent to a portal structureChecks 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
Registers the existence of the given structure type in the given locationsStores 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
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
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
Register a portal to this registry- Parameters:
portal
-The portal to register
-
networkExists
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
Get the network registry- Parameters:
storageType
-- Returns:
-
getNetwork
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
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
- 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
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
UseNetworkManager
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 UseNetworkManager
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
Get all the portals in a chunk- Parameters:
chunk
-The chunk to retrieve portals from
- Returns:
The portals in the chunk
-