Class StargateNetwork
- All Implemented Interfaces:
Network
-
Constructor Summary
ConstructorDescriptionStargateNetwork
(String name, Set<PortalFlag> flags, StorageType storageType) Instantiates a new networkStargateNetwork
(String name, NetworkType type, StorageType storageType) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given portal to this networkvoid
assignToRegistry
(RegistryAPI registry) Assign the network to a registryboolean
canSeePortal
(Portal portalToSee, Portal origin, org.bukkit.entity.Player player) Whether the origin portal can list / choose the portal to see.void
destroy()
Destroys this network and every portal contained in itGets all portals belonging to this networkgetAvailablePortals
(org.bukkit.entity.Player player, Portal requester) Gets names of all portals available to the given player from the given portalGets the style this network should be highlighted with by defaultgetId()
Gets the unique identifier for this networkgetName()
Gets the name of this networkGets the portal with the given nameGets how the network is storedgetType()
Gets the NetworkType of this networkboolean
isPortalNameTaken
(String name) Checks whether there is already a portal in this network with the given namevoid
removePortal
(Portal portal) Removes the given portal from this networkvoid
renamePortal
(String newName, String oldName) Renames the portal, does not save to database and is also not cross server compatible.void
Change the name of the networkint
size()
Gets the current number of portals in this networkvoid
Updates all portals in this network
-
Constructor Details
-
StargateNetwork
public StargateNetwork(String name, Set<PortalFlag> flags, StorageType storageType) throws InvalidNameException, NameLengthException, UnimplementedFlagException Instantiates a new network- Parameters:
name
-The name of the new network
flags
-The flags attached to this network
- Throws:
InvalidNameException
-If the network name is invalid
NameLengthException
UnimplementedFlagException
-
StargateNetwork
public StargateNetwork(String name, NetworkType type, StorageType storageType) throws InvalidNameException, NameLengthException, UnimplementedFlagException
-
-
Method Details
-
getId
Description copied from interface:Network
Gets the unique identifier for this network -
getAllPortals
Description copied from interface:Network
Gets all portals belonging to this network- Specified by:
getAllPortals
in interfaceNetwork
- Returns:
All portals belonging to this network
-
getPortal
Description copied from interface:Network
Gets the portal with the given name -
removePortal
Description copied from interface:Network
Removes the given portal from this network- Specified by:
removePortal
in interfaceNetwork
- Parameters:
portal
-The portal to remove
-
addPortal
Description copied from interface:Network
Adds the given portal to this network- Specified by:
addPortal
in interfaceNetwork
- Parameters:
portal
-The portal to add
- Throws:
NameConflictException
-if portal a portal with that name already exist in the network
-
isPortalNameTaken
Description copied from interface:Network
Checks whether there is already a portal in this network with the given name- Specified by:
isPortalNameTaken
in interfaceNetwork
- Parameters:
name
-The name to check for
- Returns:
True if an existing portal is already using the given name
-
updatePortals
public void updatePortals()Description copied from interface:Network
Updates all portals in this network- Specified by:
updatePortals
in interfaceNetwork
-
getAvailablePortals
Description copied from interface:Network
Gets names of all portals available to the given player from the given portal- Specified by:
getAvailablePortals
in interfaceNetwork
- Parameters:
player
-The player to get portals
requester
-The portal the player is viewing other portals from
- Returns:
The names of all portals the player is allowed to see
-
canSeePortal
Description copied from interface:Network
Whether the origin portal can list / choose the portal to see.- Specified by:
canSeePortal
in interfaceNetwork
- Parameters:
portalToSee
-The portal to see
origin
-The requesting portal
player
-The actor initiating this request
- Returns:
True if the origin portal and player has permission
-
getHighlightingStyle
Description copied from interface:Network
Gets the style this network should be highlighted with by default- Specified by:
getHighlightingStyle
in interfaceNetwork
- Returns:
The highlighting style of this network
-
destroy
public void destroy()Description copied from interface:Network
Destroys this network and every portal contained in it -
getName
Description copied from interface:Network
Gets the name of this network -
size
public int size()Description copied from interface:Network
Gets the current number of portals in this network -
assignToRegistry
Description copied from interface:Network
Assign the network to a registry- Specified by:
assignToRegistry
in interfaceNetwork
- Parameters:
registry
-The registry API to register to
-
getType
Description copied from interface:Network
Gets the NetworkType of this network -
getStorageType
Description copied from interface:Network
Gets how the network is stored- Specified by:
getStorageType
in interfaceNetwork
- Returns:
The storage type of the portal
-
setID
public void setID(String newName) throws InvalidNameException, NameLengthException, UnimplementedFlagException Description copied from interface:Network
Change the name of the networkDoes not save to database. Use
NetworkManager.rename(Network, String)
instead.- Specified by:
setID
in interfaceNetwork
- Parameters:
newName
-The new name of the network
- Throws:
InvalidNameException
NameLengthException
UnimplementedFlagException
-
getPluginMessageSender
- Specified by:
getPluginMessageSender
in interfaceNetwork
- Returns:
The plugin message sender
-
renamePortal
Description copied from interface:Network
Renames the portal, does not save to database and is also not cross server compatible. Instead useNetworkManager.rename(Portal, String)
- Specified by:
renamePortal
in interfaceNetwork
- Parameters:
newName
-oldName
-- Throws:
InvalidNameException
-