Cancel annoying weather in edit worlds

This commit is contained in:
Daniel Saukel 2016-05-20 13:30:40 +02:00
parent b3003ac3ed
commit e74b1bbb2e

View File

@ -16,10 +16,13 @@
*/
package io.github.dre2n.dungeonsxl.listener;
import io.github.dre2n.dungeonsxl.world.EditWorld;
import io.github.dre2n.dungeonsxl.world.GameWorld;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
/**
@ -37,4 +40,17 @@ public class WorldListener implements Listener {
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onWeatherChange(WeatherChangeEvent event) {
World world = event.getWorld();
if (EditWorld.getByWorld(event.getWorld()) != null) {
world.setStorm(false);
world.setThundering(false);
if (event.toWeatherState()) {
event.setCancelled(true);
}
}
}
}