diff options
author | md_5 <git@md-5.net> | 2018-09-15 19:16:33 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-09-15 19:16:33 +1000 |
commit | 47b9cf30ac5f6e61c84c126075932c4b9d123d95 (patch) | |
tree | f5c4ca72d9ad4d912c5ea21892555b527b6f942a /src/main | |
parent | a9ceda756670000e445674573e9914e9994c0f4c (diff) | |
download | bukkit-47b9cf30ac5f6e61c84c126075932c4b9d123d95.tar bukkit-47b9cf30ac5f6e61c84c126075932c4b9d123d95.tar.gz bukkit-47b9cf30ac5f6e61c84c126075932c4b9d123d95.tar.lz bukkit-47b9cf30ac5f6e61c84c126075932c4b9d123d95.tar.xz bukkit-47b9cf30ac5f6e61c84c126075932c4b9d123d95.zip |
SPIGOT-4372: LightningStrikeEvent cause API
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java b/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java index 66fd7636..47642af6 100644 --- a/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java +++ b/src/main/java/org/bukkit/event/weather/LightningStrikeEvent.java @@ -12,10 +12,17 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); private boolean canceled; private final LightningStrike bolt; + private final Cause cause; + @Deprecated 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); this.bolt = bolt; + this.cause = cause; } public boolean isCancelled() { @@ -35,6 +42,15 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable { return bolt; } + /** + * Gets the cause of this lightning strike. + * + * @return strike cause + */ + public Cause getCause() { + return cause; + } + @Override public HandlerList getHandlers() { return handlers; @@ -43,4 +59,27 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable { public static HandlerList getHandlerList() { 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; + } } |