Class TeleportPlugin

All Implemented Interfaces:
CommandOwner

public class TeleportPlugin extends JavaPlugin
Teleport Plugin

A plugin that provides teleportation functionality, including warp points, teleport commands, and teleport history tracking.

  • Field Details

    • WARP_MODEL_ID

      public static final String WARP_MODEL_ID
      The asset ID of the model used for warp point entities.
      See Also:
  • Constructor Details

    • TeleportPlugin

      public TeleportPlugin(@Nonnull JavaPluginInit init)
      Default Constructor for a TeleportPlugin instance.
      Parameters:
      init - The plugin initialization step for this plugin.
  • Method Details

    • get

      @Nonnull public static TeleportPlugin get()
      Returns:
      the static instance of the TeleportPlugin.
    • getTeleportHistoryComponentType

      @Nonnull public ComponentType<EntityStore, TeleportHistory> getTeleportHistoryComponentType()
      Returns:
      the component type for the TeleportHistory component.
    • isWarpsLoaded

      public boolean isWarpsLoaded()
      Returns:
      true if warps have been loaded, false otherwise.
    • loadWarps

      public void loadWarps()
      Called to load all warps from the configuration file.
    • saveWarps

      public void saveWarps()
      Called to save all warps to the configuration file.
    • getWarps

      public Map<String,Warp> getWarps()
      Returns:
      a map of all registered warps, keyed by warp name (lowercase).
    • createWarp

      @Nonnull public Holder<EntityStore> createWarp(@Nonnull Warp warp, @Nonnull Store<EntityStore> store)
      Creates a entity holder containing a warp point marker entity that represents the given warp point.
    • addWarp

      public boolean addWarp(@Nonnull Warp warp, boolean replace)
      Helper for adding a new Warp, handling the creation of its associated Warp entity, cleanup of any existing Warp entities that the new warp replaces, and saving the changes to disk.

      > This method can be safely called from any thread, deferring any operations that need to happen on a specific world-thread appropriately.

      Parameters:
      warp - The warp instance to be added. Must not be null and should contain a valid identifier.
      replace - Flag indicating whether to replace the existing warp if one exists for the given identifier.
      Returns:
      true if the warp was successfully added, false if a warp with the same identifier already exists.
    • removeWarp

      public boolean removeWarp(@Nonnull String warpName)
      Helper for removing a Warp by name, handling the cleanup of any associated Warp entities which may be present, and saving the changes to disk.

      This method can be safely called from any thread, deferring any operations that need to happen on a specific world-thread appropriately.

      Parameters:
      warpName - The name of the warp to be removed. Must not be null. The name is case-insensitive and will be processed in lowercase.
      Returns:
      true if the warp was successfully removed, false if no warp with the specified name could be found.