Class StargateNetworkManager
- All Implemented Interfaces:
NetworkManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateNetwork
(String targetNetwork, Set<PortalFlag> flags, boolean isForced) Creates a new network assigned to this registrycreateNetwork
(String name, NetworkType type, StorageType storageType, boolean isForced) Creates a new network assigned to this registryvoid
destroyPortal
(RealPortal portal) Saves to databasevoid
loadPortals
(StargateAPI stargateAPI) Loads all portals from storagevoid
Rename the network to specified name, saves to storagevoid
void
savePortal
(RealPortal portal, Network network) Add portal to network and save to storage@NotNull Network
selectNetwork
(String name, PermissionManager permissionManager, org.bukkit.OfflinePlayer player, Set<PortalFlag> flags) Interprets a networkname and type, then selects it or creates it if it does not already exist@NotNull Network
selectNetwork
(String name, NetworkType type, StorageType storageType) Gets the network with the given name, and creates it if it doesn't already exist
-
Constructor Details
-
StargateNetworkManager
- Parameters:
registryAPI
-A registry containing all portal information
storageAPI
-A database interface able to give and modify information about portals
-
-
Method Details
-
selectNetwork
@NotNull public @NotNull Network selectNetwork(String name, PermissionManager permissionManager, org.bukkit.OfflinePlayer player, Set<PortalFlag> flags) throws TranslatableException Description copied from interface:NetworkManager
Interprets a networkname and type, then selects it or creates it if it does not already exist- Specified by:
selectNetwork
in interfaceNetworkManager
- Parameters:
name
-Initial name of the network
permissionManager
-A permission manager of the player
player
-The player selecting the network
flags
-flags of a portal this selection or creation comes from
- Returns:
The network the portal should be connected to
- Throws:
TranslatableException
-If invalid input is given
-
selectNetwork
@NotNull public @NotNull Network selectNetwork(String name, NetworkType type, StorageType storageType) throws TranslatableException Description copied from interface:NetworkManager
Gets the network with the given name, and creates it if it doesn't already exist- Specified by:
selectNetwork
in interfaceNetworkManager
- Parameters:
name
-The name of the network to get
type
-The type of network to get
storageType
-Whether or not the network works (or will work) across instances.
- Returns:
The network the portal should be connected to
- Throws:
TranslatableException
-If the network name is invalid
-
createNetwork
public Network createNetwork(String name, NetworkType type, StorageType storageType, boolean isForced) throws InvalidNameException, UnimplementedFlagException, NameLengthException, NameConflictException Description copied from interface:NetworkManager
Creates a new network assigned to this registry- Specified by:
createNetwork
in interfaceNetworkManager
- Parameters:
name
-The name of the new network
type
-The type of network to create
storageType
-Whether to create it as a Interserver network
isForced
-The authority for the creation
- Returns:
The network created
- Throws:
InvalidNameException
-If the given network name is invalid
UnimplementedFlagException
NameLengthException
NameConflictException
-
createNetwork
public Network createNetwork(String targetNetwork, Set<PortalFlag> flags, boolean isForced) throws InvalidNameException, NameLengthException, NameConflictException, UnimplementedFlagException Description copied from interface:NetworkManager
Creates a new network assigned to this registry- Specified by:
createNetwork
in interfaceNetworkManager
- Parameters:
targetNetwork
-The this network will attempt creation under
flags
-The flags containing the network's enabled options
isForced
-The authority for the creation
- Returns:
The network created
- Throws:
InvalidNameException
-If the given network name is invalid
NameLengthException
NameConflictException
UnimplementedFlagException
-
rename
public void rename(Network network, String newName) throws InvalidNameException, NameLengthException, UnimplementedFlagException Description copied from interface:NetworkManager
Rename the network to specified name, saves to storage- Specified by:
rename
in interfaceNetworkManager
- Parameters:
network
-The network to rename
newName
-The new name of the network
- Throws:
InvalidNameException
NameLengthException
UnimplementedFlagException
-
loadPortals
Description copied from interface:NetworkManager
Loads all portals from storage- Specified by:
loadPortals
in interfaceNetworkManager
- Parameters:
stargateAPI
-The stargate api
-
rename
- Specified by:
rename
in interfaceNetworkManager
- Parameters:
portal
-The portal to rename
newName
-The new name of the portal
- Throws:
NameConflictException
-
savePortal
Description copied from interface:NetworkManager
Add portal to network and save to storage- Specified by:
savePortal
in interfaceNetworkManager
- Parameters:
portal
-The portal to be saved
network
-The network to assign the portal to
- Throws:
NameConflictException
-
destroyPortal
Description copied from interface:NetworkManager
Saves to database- Specified by:
destroyPortal
in interfaceNetworkManager
- Parameters:
portal
-Destroy portal
-