Minecraft Spigot queries whether Nether / End?

ki
- in Worlds
6

I wanted to ask if you know how to query if a world is a nether or an end?

(Spigot 1.8.8)

hy

Usually with the world name if you use the standard worlds, since the normal world is called world, the nether world_nether and the ending world_end.

ki

But if you create a new world with Multiverse-Core, for example, with a different name

Ka

World world;
if (world.getEnvironment () == World.Environment.NETHER)
if (world.getEnvironment () == World.Environment.THE_END)

ki

Thanks that worked.

hy

Yes, Ludwig's answer should have done it.

an

If (world.getEnvironment () == Environment.NETHER) {…}
if (world.getEnvironment () == Environment.END) {…}

Instead of "world" you can also use "event.getTo (). GetWorld ()" or "player.getWorld ()" if you want to check the world in which the command was executed / the player is.