Class PortalRoutingService

java.lang.Object
dev.deepcore.challenge.portal.PortalRoutingService

public final class PortalRoutingService extends Object
Resolves linked portal destinations and guards end-portal transit cooldowns.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PortalRoutingService(Supplier<WorldResetManager> worldResetManagerSupplier)
    Creates a portal router bound to the current world reset manager provider.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.Location
    buildLinkedPortalTarget(org.bukkit.Location source, org.bukkit.World targetWorld, double horizontalScale)
    Builds a portal destination using horizontal coordinate scaling between dimensions.
    void
    Clears all tracked end-portal cooldown timestamps.
    org.bukkit.Location
    resolveEndPortalTarget(org.bukkit.World fromWorld, org.bukkit.World targetWorld)
    Resolves a safe destination for End portal travel between linked worlds.
    org.bukkit.World
    resolveLinkedEndWorld(org.bukkit.World fromWorld)
    Resolves the End/Overworld counterpart world for a portal transition.
    org.bukkit.World
    resolveLinkedPortalWorld(org.bukkit.World fromWorld)
    Resolves the Nether/Overworld counterpart world for a portal transition.
    boolean
    tryHandleEndPortalTransit(org.bukkit.entity.Player player, boolean runningPhase, Predicate<org.bukkit.World> limboWorldPredicate)
    Applies End portal transit if the player is eligible and cooldown permits.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PortalRoutingService

      public PortalRoutingService(Supplier<WorldResetManager> worldResetManagerSupplier)
      Creates a portal router bound to the current world reset manager provider.
      Parameters:
      worldResetManagerSupplier - supplier for the active world reset manager
  • Method Details

    • clearTransitCooldowns

      public void clearTransitCooldowns()
      Clears all tracked end-portal cooldown timestamps.
    • resolveLinkedPortalWorld

      public org.bukkit.World resolveLinkedPortalWorld(org.bukkit.World fromWorld)
      Resolves the Nether/Overworld counterpart world for a portal transition.
      Parameters:
      fromWorld - world from which portal travel is originating
      Returns:
      linked counterpart world, or null when not resolvable
    • resolveLinkedEndWorld

      public org.bukkit.World resolveLinkedEndWorld(org.bukkit.World fromWorld)
      Resolves the End/Overworld counterpart world for a portal transition.
      Parameters:
      fromWorld - world from which portal travel is originating
      Returns:
      linked counterpart world, or null when not resolvable
    • buildLinkedPortalTarget

      public org.bukkit.Location buildLinkedPortalTarget(org.bukkit.Location source, org.bukkit.World targetWorld, double horizontalScale)
      Builds a portal destination using horizontal coordinate scaling between dimensions.
      Parameters:
      source - source location used for coordinate mapping
      targetWorld - destination world
      horizontalScale - scaling factor to apply to X/Z coordinates
      Returns:
      calculated portal target location, or null when inputs are invalid
    • resolveEndPortalTarget

      public org.bukkit.Location resolveEndPortalTarget(org.bukkit.World fromWorld, org.bukkit.World targetWorld)
      Resolves a safe destination for End portal travel between linked worlds.
      Parameters:
      fromWorld - source world where portal travel started
      targetWorld - destination world to enter
      Returns:
      safe destination location in the target world, or null when unavailable
    • tryHandleEndPortalTransit

      public boolean tryHandleEndPortalTransit(org.bukkit.entity.Player player, boolean runningPhase, Predicate<org.bukkit.World> limboWorldPredicate)
      Applies End portal transit if the player is eligible and cooldown permits.
      Parameters:
      player - player attempting End portal transit
      runningPhase - whether the challenge is actively running
      limboWorldPredicate - predicate identifying worlds where transit is blocked
      Returns:
      true when transit was applied