Package dev.deepcore.challenge.portal
Class PortalRoutingService
java.lang.Object
dev.deepcore.challenge.portal.PortalRoutingService
Resolves linked portal destinations and guards end-portal transit cooldowns.
-
Constructor Summary
ConstructorsConstructorDescriptionPortalRoutingService(Supplier<WorldResetManager> worldResetManagerSupplier) Creates a portal router bound to the current world reset manager provider. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.LocationbuildLinkedPortalTarget(org.bukkit.Location source, org.bukkit.World targetWorld, double horizontalScale) Builds a portal destination using horizontal coordinate scaling between dimensions.voidClears all tracked end-portal cooldown timestamps.org.bukkit.LocationresolveEndPortalTarget(org.bukkit.World fromWorld, org.bukkit.World targetWorld) Resolves a safe destination for End portal travel between linked worlds.org.bukkit.WorldresolveLinkedEndWorld(org.bukkit.World fromWorld) Resolves the End/Overworld counterpart world for a portal transition.org.bukkit.WorldresolveLinkedPortalWorld(org.bukkit.World fromWorld) Resolves the Nether/Overworld counterpart world for a portal transition.booleantryHandleEndPortalTransit(org.bukkit.entity.Player player, boolean runningPhase, Predicate<org.bukkit.World> limboWorldPredicate) Applies End portal transit if the player is eligible and cooldown permits.
-
Constructor Details
-
PortalRoutingService
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 mappingtargetWorld- destination worldhorizontalScale- 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 startedtargetWorld- 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 transitrunningPhase- whether the challenge is actively runninglimboWorldPredicate- predicate identifying worlds where transit is blocked- Returns:
- true when transit was applied
-