Package net.thenextlvl.worlds.api.link
Interface LinkTree
@NullMarked
public interface LinkTree
A LinkTree is a mapping between one Overworld, one Nether, and one End.
Links restore vanilla portal behavior.
- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(net.kyori.adventure.key.Key key) Checks if the specified key is contained within the link tree.booleancontains(org.bukkit.World world) Checks if the provided world is contained within the link tree.Optional<org.bukkit.World> getEnd()Retrieves theEndworld associated with thisLinkTree, if available.Retrieves theLinkProviderassociated with thisLinkTree.Optional<org.bukkit.World> Retrieves theNetherworld associated with thisLinkTree, if available.org.bukkit.WorldRetrieves theOverworldassociated with thisLinkTree, if available.Optional<net.kyori.adventure.key.Key> Retrieves the persisted key associated with theEndworld, if available.Optional<net.kyori.adventure.key.Key> Retrieves the persisted key associated with theNetherworld, if available.Optional<org.bukkit.World> getWorld(org.bukkit.World.Environment environment) Retrieves the world mapped to the specified environment, if available.booleanisEmpty()Determines whether the link tree is empty, signifying that no worlds are associated with it.booleanremove(net.kyori.adventure.key.Key key) Removes the specified key from the link tree if it exists.booleanremove(org.bukkit.World world) Removes the specified world from the link tree if it exists.booleansetEnd(@Nullable org.bukkit.World world) Sets theEndworld for thisLinkTree.booleansetNether(@Nullable org.bukkit.World world) Sets theNetherworld for thisLinkTree.
-
Method Details
-
getOverworld
@Contract(pure=true) org.bukkit.World getOverworld()Retrieves theOverworldassociated with thisLinkTree, if available.- Returns:
- the
Worldassociated with thisLinkTree
-
getNether
Retrieves theNetherworld associated with thisLinkTree, if available.- Returns:
- an Optional containing the world, or empty if undefined or not loaded
-
getPersistedNether
Retrieves the persisted key associated with theNetherworld, if available.- Returns:
- an Optional containing the key of the world, or empty if undefined
-
setNether
@Contract(mutates="this") boolean setNether(@Nullable org.bukkit.World world) Sets theNetherworld for thisLinkTree.- Parameters:
world- theWorldto be set, or null to clear the current world mapping- Returns:
- true if the world mapping was successfully set or cleared, false otherwise
-
getEnd
Retrieves theEndworld associated with thisLinkTree, if available.- Returns:
- an Optional containing the world, or empty if undefined or not loaded
-
getPersistedEnd
Retrieves the persisted key associated with theEndworld, if available.- Returns:
- an Optional containing the key of the world, or empty if undefined
-
setEnd
@Contract(mutates="this") boolean setEnd(@Nullable org.bukkit.World world) Sets theEndworld for thisLinkTree.- Parameters:
world- theWorldto be set, or null to clear the current world mapping- Returns:
- true if the world mapping was successfully set or cleared, false otherwise
-
isEmpty
@Contract(pure=true) boolean isEmpty()Determines whether the link tree is empty, signifying that no worlds are associated with it.- Returns:
- true if the link tree contains no associations, false otherwise
-
contains
@Contract(pure=true) boolean contains(net.kyori.adventure.key.Key key) Checks if the specified key is contained within the link tree.- Parameters:
key- the key to check for containment within the link tree- Returns:
- true if the specified key is present in the link tree, false otherwise
-
contains
@Contract(pure=true) boolean contains(org.bukkit.World world) Checks if the provided world is contained within the link tree.- Parameters:
world- the world to check for containment within the link tree- Returns:
- true if the specified world is present in the link tree, false otherwise
-
remove
@Contract(mutates="this") boolean remove(net.kyori.adventure.key.Key key) Removes the specified key from the link tree if it exists.- Parameters:
key- the key associated with the world to be removed from the link tree- Returns:
- true if the key was successfully removed, false otherwise
-
remove
@Contract(mutates="this") boolean remove(org.bukkit.World world) Removes the specified world from the link tree if it exists.- Parameters:
world- the world to be removed from the link tree- Returns:
- true if the world was successfully removed, false otherwise
-
getWorld
Retrieves the world mapped to the specified environment, if available.- Parameters:
environment- the environment for which the associated world is to be retrieved- Returns:
- an Optional containing the associated world, or an empty Optional if none exists
-
getLinkProvider
Retrieves theLinkProviderassociated with thisLinkTree.- Returns:
- the
LinkProvidermanaging associations and interactions for this LinkTree
-