How can I get world in ChangeWeatherEvent?

In sponge 7.0 I can get world by this code.

ChangeWorldWeatherEvent e;

World world = e.getTargetWorld();
Weather weather = e.getWeather();

In sponge 8.0 I couldn’t find the method to get the world.

Please help me.

Because weather no longer effects just a world anymore, the event can target more then just worlds

These targets are put into the interface of WeatherUniverse that can be cast to a world or world property (probably biomes in later versions too)

https://jd.spongepowered.org/spongeapi/8.1.0/org/spongepowered/api/event/world/ChangeWeatherEvent.html#universe()

1 Like

Thank you so much!