package com.example.duneess; import java.util.Set; import org.bukkit.World; /** Dimension returns on one backend, preserving the Guild boundary between planets. */ final class HomeDimensionRoutes { private static final Set MAIN_WORLDS = Set.of( "arrakis", "caladan", "giedi_prime", "kaitain", "sigma_draconis_iv", "lobby_base"); private HomeDimensionRoutes() {} static boolean canReturn(World source, Object destination) { if (source == null || !(destination instanceof World target)) return false; if (source.equals(target)) return true; String main = target.getName(); if (target.getEnvironment() != World.Environment.NORMAL || !MAIN_WORLDS.contains(main)) return false; return source.getEnvironment() == World.Environment.NETHER && source.getName().equals(main + "_nether") || source.getEnvironment() == World.Environment.THE_END && source.getName().equals(main + "_the_end"); } }