Class TeleportsService
- java.lang.Object
-
- net.openosrs.api.service.movement.teleports.TeleportsService
-
@Singleton public class TeleportsService extends java.lang.ObjectRegistry and fail-closed invoker for built-inTeleportDefinitions.Dispatch always goes through the owning service (Inventory / Equipment / Magic), which validate actions against live widget state. This service adds only availability + magic-level gates; it never invents component tuples.
Semantics:
canInvoke(TeleportDefinition)is a pure readback check.invoke(TeleportDefinition)submits a command. A returned true means "dispatch accepted by the owning service", NOT that the player arrived anywhere.- "Rub"-style items open a destination dialog on a later tick. After
invoking such a definition, call
resolveDialogueChoice()from subsequent ticks until it returns true. It never blocks or sleeps. arrivedAt(TeleportDefinition)compares the live player position with the definition's verified landing area; definitions with dynamic destinations (POH/home) always report false.
-
-
Constructor Summary
Constructors Constructor Description TeleportsService(InventoryService inventory, EquipmentService equipment, MagicService magic, DialogueService dialogue, SkillService skills, MovementService movement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<TeleportDefinition>all()All built-in verified definitions (spells, tablets, jewellery both modes).booleanarrivedAt(TeleportDefinition def)Observed-state arrival check against the definition's verified landing area (Chebyshev distance withinarrivalRadius).booleancanInvoke(TeleportDefinition def)Availability readback: item present in inventory / worn in slot / spell widget visible, plus magic-level gate when the definition has one.voidclearPendingChoice()Drop a pending dialog choice without clicking (e.g.java.util.List<TeleportDefinition>find(java.lang.String namePart)Definitions whose name contains the given text, case-insensitive.voidinvoke(TeleportDefinition def)Submit the teleport command through the owning service.TeleportDefinitionpendingChoice()The definition whose destination dialog has not been resolved yet, if any.booleanresolveDialogueChoice()Attempt the pending destination-dialog choice.
-
-
-
Constructor Detail
-
TeleportsService
@Inject public TeleportsService(InventoryService inventory, EquipmentService equipment, MagicService magic, DialogueService dialogue, SkillService skills, MovementService movement)
-
-
Method Detail
-
all
public java.util.List<TeleportDefinition> all()
All built-in verified definitions (spells, tablets, jewellery both modes).
-
find
public java.util.List<TeleportDefinition> find(java.lang.String namePart)
Definitions whose name contains the given text, case-insensitive.
-
canInvoke
public boolean canInvoke(TeleportDefinition def)
Availability readback: item present in inventory / worn in slot / spell widget visible, plus magic-level gate when the definition has one.
-
invoke
public void invoke(TeleportDefinition def)
Submit the teleport command through the owning service.- Throws:
java.lang.IllegalArgumentException- when the definition is unknown/invalidjava.lang.IllegalStateException- when the teleport is not currently available (canInvoke(net.openosrs.api.service.movement.teleports.TeleportDefinition)false), or when a previous destination-dialog choice is still pending
-
resolveDialogueChoice
public boolean resolveDialogueChoice()
Attempt the pending destination-dialog choice. Non-blocking: returns immediately when no choice is pending or the dialog is not visible yet.- Returns:
- true when a choice was clicked this tick; false while still waiting; never throws for "not visible yet"
-
pendingChoice
public TeleportDefinition pendingChoice()
The definition whose destination dialog has not been resolved yet, if any.
-
clearPendingChoice
public void clearPendingChoice()
Drop a pending dialog choice without clicking (e.g. after a cancel).
-
arrivedAt
public boolean arrivedAt(TeleportDefinition def)
Observed-state arrival check against the definition's verified landing area (Chebyshev distance withinarrivalRadius). Always false for dynamic destinations — we do not pretend to know where a POH is.
-
-