Class TeleportLoader

java.lang.Object
net.storm.sdk.movement.pathfinder.TeleportLoader

public class TeleportLoader extends Object
Manages custom teleport definitions for the pathfinding system.

This class allows registering and managing custom teleports that the pathfinder can use when calculating routes. Custom teleports supplement the built-in teleport definitions and are useful for adding support for new teleport methods or custom teleport items.

Teleports are used by the pathfinding system to find faster routes to destinations by considering teleportation as a movement option. Each teleport defines a destination, requirements, and the action to perform the teleport.

Example Usage:


 // Create a custom teleport
 Teleport customTeleport = Teleport.builder()
     .destination(new WorldPoint(3200, 3200, 0))
     .action(() -> {
         // Perform the teleport action
         Item teleTab = Inventory.getFirst("Custom teleport tab");
         if (teleTab != null) {
             teleTab.interact("Break");
         }
     })
     .requirement(() -> Inventory.contains("Custom teleport tab"))
     .build();

 // Add the custom teleport
 TeleportLoader.addCustomTeleport(customTeleport);

 // Get all registered custom teleports
 List<Teleport> teleports = TeleportLoader.getCustomTeleports();

 // Remove a custom teleport when no longer needed
 TeleportLoader.removeCustomTeleport(customTeleport);
 
See Also:
  • Constructor Details

    • TeleportLoader

      public TeleportLoader()
  • Method Details

    • getCustomTeleports

      public static List<Teleport> getCustomTeleports()
      Retrieves the list of all registered custom teleports.

      This returns a mutable list that can be modified directly, though using addCustomTeleport(Teleport) and removeCustomTeleport(Teleport) is preferred.

      Returns:
      the list of custom teleports
    • addCustomTeleport

      public static void addCustomTeleport(Teleport teleport)
      Registers a new custom teleport with the pathfinding system.

      Once added, this teleport will be considered by the pathfinder when calculating routes to destinations.

      Parameters:
      teleport - the teleport to register
    • removeCustomTeleport

      public static void removeCustomTeleport(Teleport teleport)
      Removes a custom teleport from the pathfinding system.

      After removal, this teleport will no longer be considered by the pathfinder.

      Parameters:
      teleport - the teleport to unregister