Allow paid home returns from local Nether and End dimensions
This commit is contained in:
parent
2c6aedaf8a
commit
1309c4d338
1 changed files with 198 additions and 2 deletions
|
|
@ -0,0 +1,21 @@
|
|||
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<String> 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");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue

Staff