Search in sources :

Example 1 with ThunderChangeEvent

use of org.bukkit.event.weather.ThunderChangeEvent in project Glowstone by GlowstoneMC.

the class GlowWorld method setThundering.

@Override
public void setThundering(boolean thundering) {
    // call event
    ThunderChangeEvent event = new ThunderChangeEvent(this, thundering);
    if (EventFactory.callEvent(event).isCancelled()) {
        return;
    }
    // change weather
    currentlyThundering = thundering;
    // Numbers borrowed from CraftBukkit.
    if (currentlyThundering) {
        setThunderDuration(random.nextInt(HALF_DAY_IN_TICKS) + 180 * TICKS_PER_SECOND);
    } else {
        setThunderDuration(random.nextInt(WEEK_IN_TICKS) + HALF_DAY_IN_TICKS);
    }
}
Also used : ThunderChangeEvent(org.bukkit.event.weather.ThunderChangeEvent)

Aggregations

ThunderChangeEvent (org.bukkit.event.weather.ThunderChangeEvent)1