mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
@@ -12,10 +12,17 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
|||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean canceled;
|
private boolean canceled;
|
||||||
private final LightningStrike bolt;
|
private final LightningStrike bolt;
|
||||||
|
private final Cause cause;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public LightningStrikeEvent(final World world, final LightningStrike bolt) {
|
public LightningStrikeEvent(final World world, final LightningStrike bolt) {
|
||||||
|
this(world, bolt, Cause.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LightningStrikeEvent(final World world, final LightningStrike bolt, final Cause cause) {
|
||||||
super(world);
|
super(world);
|
||||||
this.bolt = bolt;
|
this.bolt = bolt;
|
||||||
|
this.cause = cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
@@ -35,6 +42,15 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
|||||||
return bolt;
|
return bolt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cause of this lightning strike.
|
||||||
|
*
|
||||||
|
* @return strike cause
|
||||||
|
*/
|
||||||
|
public Cause getCause() {
|
||||||
|
return cause;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
@@ -43,4 +59,27 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
|||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Cause {
|
||||||
|
/**
|
||||||
|
* Triggered by the /summon command.
|
||||||
|
*/
|
||||||
|
COMMAND,
|
||||||
|
/**
|
||||||
|
* Triggered by an enchanted trident.
|
||||||
|
*/
|
||||||
|
TRIDENT,
|
||||||
|
/**
|
||||||
|
* Triggered by a skeleton horse trap.
|
||||||
|
*/
|
||||||
|
TRAP,
|
||||||
|
/**
|
||||||
|
* Triggered by weather.
|
||||||
|
*/
|
||||||
|
WEATHER,
|
||||||
|
/**
|
||||||
|
* Unknown trigger.
|
||||||
|
*/
|
||||||
|
UNKNOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user