Class StargateNetworkManager
- All Implemented Interfaces:
NetworkManager
-
Constructor Summary
Constructors -
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 registryvoiddestroyPortal(RealPortal portal) Saves to databasevoidloadPortals(StargateAPI stargateAPI) Loads all portals from storagevoidRename the network to specified name, saves to storagevoidvoidsavePortal(RealPortal portal, Network network) Add portal to network and save to storage@NotNull NetworkselectNetwork(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 NetworkselectNetwork(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:NetworkManagerInterprets a networkname and type, then selects it or creates it if it does not already exist- Specified by:
selectNetworkin 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:NetworkManagerGets the network with the given name, and creates it if it doesn't already exist- Specified by:
selectNetworkin 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:NetworkManagerCreates a new network assigned to this registry- Specified by:
createNetworkin 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
UnimplementedFlagExceptionNameLengthExceptionNameConflictException
-
createNetwork
public Network createNetwork(String targetNetwork, Set<PortalFlag> flags, boolean isForced) throws InvalidNameException, NameLengthException, NameConflictException, UnimplementedFlagException Description copied from interface:NetworkManagerCreates a new network assigned to this registry- Specified by:
createNetworkin 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
NameLengthExceptionNameConflictExceptionUnimplementedFlagException
-
rename
public void rename(Network network, String newName) throws InvalidNameException, NameLengthException, UnimplementedFlagException Description copied from interface:NetworkManagerRename the network to specified name, saves to storage- Specified by:
renamein interfaceNetworkManager- Parameters:
network-The network to rename
newName-The new name of the network
- Throws:
InvalidNameExceptionNameLengthExceptionUnimplementedFlagException
-
loadPortals
Description copied from interface:NetworkManagerLoads all portals from storage- Specified by:
loadPortalsin interfaceNetworkManager- Parameters:
stargateAPI-The stargate api
-
rename
- Specified by:
renamein interfaceNetworkManager- Parameters:
portal-The portal to rename
newName-The new name of the portal
- Throws:
NameConflictException
-
savePortal
Description copied from interface:NetworkManagerAdd portal to network and save to storage- Specified by:
savePortalin interfaceNetworkManager- Parameters:
portal-The portal to be saved
network-The network to assign the portal to
- Throws:
NameConflictException
-
destroyPortal
Description copied from interface:NetworkManagerSaves to database- Specified by:
destroyPortalin interfaceNetworkManager- Parameters:
portal-Destroy portal
-