mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-22 10:15:54 +01:00
Don't handle PortalTeleportEvent when target world is disabled in config
Related to 5711389549
This commit is contained in:
parent
5711389549
commit
b2b3b3d976
@ -20,23 +20,6 @@ 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:
|
||||
@ -64,4 +47,34 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,6 +194,14 @@ 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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user