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 Type
    Method
    Description
    boolean
    contains(net.kyori.adventure.key.Key key)
    Checks if the specified key is contained within the link tree.
    boolean
    contains(org.bukkit.World world)
    Checks if the provided world is contained within the link tree.
    Optional<org.bukkit.World>
    Retrieves the End world associated with this LinkTree, if available.
    Retrieves the LinkProvider associated with this LinkTree.
    Optional<org.bukkit.World>
    Retrieves the Nether world associated with this LinkTree, if available.
    org.bukkit.World
    Retrieves the Overworld associated with this LinkTree, if available.
    Optional<net.kyori.adventure.key.Key>
    Retrieves the persisted key associated with the End world, if available.
    Optional<net.kyori.adventure.key.Key>
    Retrieves the persisted key associated with the Nether world, if available.
    Optional<org.bukkit.World>
    getWorld(org.bukkit.World.Environment environment)
    Retrieves the world mapped to the specified environment, if available.
    boolean
    Determines whether the link tree is empty, signifying that no worlds are associated with it.
    boolean
    remove(net.kyori.adventure.key.Key key)
    Removes the specified key from the link tree if it exists.
    boolean
    remove(org.bukkit.World world)
    Removes the specified world from the link tree if it exists.
    boolean
    setEnd(@Nullable org.bukkit.World world)
    Sets the End world for this LinkTree.
    boolean
    setNether(@Nullable org.bukkit.World world)
    Sets the Nether world for this LinkTree.
  • Method Details

    • getOverworld

      @Contract(pure=true) org.bukkit.World getOverworld()
      Retrieves the Overworld associated with this LinkTree, if available.
      Returns:
      the World associated with this LinkTree
    • getNether

      @Contract(pure=true) Optional<org.bukkit.World> getNether()
      Retrieves the Nether world associated with this LinkTree, if available.
      Returns:
      an Optional containing the world, or empty if undefined or not loaded
    • getPersistedNether

      @Contract(pure=true) Optional<net.kyori.adventure.key.Key> getPersistedNether()
      Retrieves the persisted key associated with the Nether world, 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 the Nether world for this LinkTree.
      Parameters:
      world - the World to be set, or null to clear the current world mapping
      Returns:
      true if the world mapping was successfully set or cleared, false otherwise
    • getEnd

      @Contract(pure=true) Optional<org.bukkit.World> getEnd()
      Retrieves the End world associated with this LinkTree, if available.
      Returns:
      an Optional containing the world, or empty if undefined or not loaded
    • getPersistedEnd

      @Contract(pure=true) Optional<net.kyori.adventure.key.Key> getPersistedEnd()
      Retrieves the persisted key associated with the End world, 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 the End world for this LinkTree.
      Parameters:
      world - the World to 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

      @Contract(pure=true) Optional<org.bukkit.World> getWorld(org.bukkit.World.Environment environment)
      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

      @Contract(pure=true) LinkProvider getLinkProvider()
      Retrieves the LinkProvider associated with this LinkTree.
      Returns:
      the LinkProvider managing associations and interactions for this LinkTree