Class TeleportsService


  • @Singleton
    public class TeleportsService
    extends java.lang.Object
    Registry and fail-closed invoker for built-in TeleportDefinitions.

    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.
    • 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.
      • 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 within arrivalRadius). Always false for dynamic destinations — we do not pretend to know where a POH is.