Class StargateNetwork
- All Implemented Interfaces:
Network
-
Constructor Summary
ConstructorsConstructorDescriptionStargateNetwork(String name, Set<PortalFlag> flags, StorageType storageType) Instantiates a new networkStargateNetwork(String name, NetworkType type, StorageType storageType) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given portal to this networkvoidassignToRegistry(RegistryAPI registry) Assign the network to a registrybooleancanSeePortal(Portal portalToSee, Portal origin, org.bukkit.entity.Player player) Whether the origin portal can list / choose the portal to see.voiddestroy()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 networkbooleanisPortalNameTaken(String name) Checks whether there is already a portal in this network with the given namevoidremovePortal(Portal portal) Removes the given portal from this networkvoidrenamePortal(String newName, String oldName) Renames the portal, does not save to database and is also not cross server compatible.voidChange the name of the networkintsize()Gets the current number of portals in this networkvoidUpdates 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
NameLengthExceptionUnimplementedFlagException
-
StargateNetwork
public StargateNetwork(String name, NetworkType type, StorageType storageType) throws InvalidNameException, NameLengthException, UnimplementedFlagException
-
-
Method Details
-
getId
Description copied from interface:NetworkGets the unique identifier for this network -
getAllPortals
Description copied from interface:NetworkGets all portals belonging to this network- Specified by:
getAllPortalsin interfaceNetwork- Returns:
All portals belonging to this network
-
getPortal
Description copied from interface:NetworkGets the portal with the given name -
removePortal
Description copied from interface:NetworkRemoves the given portal from this network- Specified by:
removePortalin interfaceNetwork- Parameters:
portal-The portal to remove
-
addPortal
Description copied from interface:NetworkAdds the given portal to this network- Specified by:
addPortalin 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:NetworkChecks whether there is already a portal in this network with the given name- Specified by:
isPortalNameTakenin 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:NetworkUpdates all portals in this network- Specified by:
updatePortalsin interfaceNetwork
-
getAvailablePortals
Description copied from interface:NetworkGets names of all portals available to the given player from the given portal- Specified by:
getAvailablePortalsin 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:NetworkWhether the origin portal can list / choose the portal to see.- Specified by:
canSeePortalin 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:NetworkGets the style this network should be highlighted with by default- Specified by:
getHighlightingStylein interfaceNetwork- Returns:
The highlighting style of this network
-
destroy
public void destroy()Description copied from interface:NetworkDestroys this network and every portal contained in it -
getName
Description copied from interface:NetworkGets the name of this network -
size
public int size()Description copied from interface:NetworkGets the current number of portals in this network -
assignToRegistry
Description copied from interface:NetworkAssign the network to a registry- Specified by:
assignToRegistryin interfaceNetwork- Parameters:
registry-The registry API to register to
-
getType
Description copied from interface:NetworkGets the NetworkType of this network -
getStorageType
Description copied from interface:NetworkGets how the network is stored- Specified by:
getStorageTypein interfaceNetwork- Returns:
The storage type of the portal
-
setID
public void setID(String newName) throws InvalidNameException, NameLengthException, UnimplementedFlagException Description copied from interface:NetworkChange the name of the networkDoes not save to database. Use
NetworkManager.rename(Network, String)instead.- Specified by:
setIDin interfaceNetwork- Parameters:
newName-The new name of the network
- Throws:
InvalidNameExceptionNameLengthExceptionUnimplementedFlagException
-
getPluginMessageSender
- Specified by:
getPluginMessageSenderin interfaceNetwork- Returns:
The plugin message sender
-
renamePortal
Description copied from interface:NetworkRenames the portal, does not save to database and is also not cross server compatible. Instead useNetworkManager.rename(Portal, String)- Specified by:
renamePortalin interfaceNetwork- Parameters:
newName-oldName-- Throws:
InvalidNameException
-