[Bleeding] Changed event system into a new, much faster design. Huge thanks to @zml2008 & @lahwran.
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
@@ -3,12 +3,14 @@ package org.bukkit.event.weather;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores data for lightning striking
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean canceled;
|
||||
private LightningStrike bolt;
|
||||
@@ -34,4 +36,13 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
||||
public LightningStrike getLightning() {
|
||||
return bolt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.bukkit.event.weather;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores data for thunder state changing in a world
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean canceled;
|
||||
private boolean to;
|
||||
@@ -33,4 +35,13 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||
public boolean toThunderState() {
|
||||
return to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.bukkit.event.weather;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores data for weather changing in a world
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean canceled;
|
||||
private boolean to;
|
||||
@@ -33,4 +35,13 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||
public boolean toWeatherState() {
|
||||
return to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.event.Event;
|
||||
* Represents a Weather-related event
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class WeatherEvent extends Event {
|
||||
public abstract class WeatherEvent extends Event {
|
||||
protected World world;
|
||||
|
||||
public WeatherEvent(final Event.Type type, final World where) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
|
||||
/**
|
||||
* Handles all events fired in relation to weather
|
||||
*/
|
||||
@Deprecated
|
||||
public class WeatherListener implements Listener {
|
||||
public WeatherListener() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user