Revert "Don't handle PortalTeleportEvent when target world is disabled in config"

This reverts commit b2b3b3d976.

That event handler didn't affect players
This commit is contained in:
Christian Koop 2023-08-21 18:18:22 +02:00
parent b2b3b3d976
commit 1a2124fb2f
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
2 changed files with 17 additions and 38 deletions

View File

@ -20,6 +20,23 @@ public enum IslandWorld {
return this.friendlyName;
}
public static List<IslandWorld> getIslandWorlds() {
List<IslandWorld> islandWorlds = new ArrayList<>(3);
WorldManager worldManager = SkyBlock.getPlugin(SkyBlock.class).getWorldManager();
if (worldManager.getWorld(NORMAL) != null) {
islandWorlds.add(NORMAL);
}
if (worldManager.getWorld(NETHER) != null) {
islandWorlds.add(NETHER);
}
if (worldManager.getWorld(END) != null) {
islandWorlds.add(END);
}
return islandWorlds;
}
public Environment getUncheckedEnvironment() {
switch (this) {
case NORMAL:
@ -47,34 +64,4 @@ public enum IslandWorld {
return null;
}
public static List<IslandWorld> getIslandWorlds() {
List<IslandWorld> islandWorlds = new ArrayList<>(3);
WorldManager worldManager = SkyBlock.getPlugin(SkyBlock.class).getWorldManager();
if (worldManager.getWorld(NORMAL) != null) {
islandWorlds.add(NORMAL);
}
if (worldManager.getWorld(NETHER) != null) {
islandWorlds.add(NETHER);
}
if (worldManager.getWorld(END) != null) {
islandWorlds.add(END);
}
return islandWorlds;
}
public static IslandWorld getByEnvironment(Environment environment) {
switch (environment) {
case NORMAL:
return IslandWorld.NORMAL;
case NETHER:
return IslandWorld.NETHER;
case THE_END:
return IslandWorld.END;
default:
return null;
}
}
}

View File

@ -194,14 +194,6 @@ public class TeleportListeners implements Listener {
return;
}
IslandWorld toIslandWorld = IslandWorld.getByEnvironment(to.getWorld().getEnvironment());
FileConfiguration configLoad = this.plugin.getConfiguration();
if (toIslandWorld == null || !configLoad.getBoolean("Island.World." + toIslandWorld.getFriendlyName() + ".Enable")) {
// Skip any of our behavior if the target world is disabled (vanilla or third-party plugin might want to handle it)
return;
}
if (worldManager.getIslandWorld(e.getFrom().getWorld()) != null) {
e.setCancelled(true);
}