Added a lot of events relating to weather, including those for entities. Thanks wizjany!
By: EvilSeph <evilseph@unaligned.org>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package org.bukkit.event.weather;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Stores data for lightning striking
|
||||
*/
|
||||
public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
||||
|
||||
private boolean canceled;
|
||||
private Entity bolt;
|
||||
private World world;
|
||||
|
||||
public LightningStrikeEvent(World world, Entity bolt) {
|
||||
super(Type.LIGHTNING_STRIKE, world);
|
||||
this.bolt = bolt;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. A canceled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @return true if this event is canceled
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A canceled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
canceled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bolt which is striking the earth.
|
||||
*
|
||||
* @return lightning entity
|
||||
*/
|
||||
public Entity getLightning() {
|
||||
return bolt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.bukkit.event.weather;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Stores data for thudner state changing in a world
|
||||
*/
|
||||
public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||
|
||||
private boolean canceled;
|
||||
private boolean to;
|
||||
private World world;
|
||||
|
||||
public ThunderChangeEvent(World world, boolean to) {
|
||||
super(Type.THUNDER_CHANGE, world);
|
||||
this.world = world;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. A canceled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @return true if this event is canceled
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A canceled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
canceled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of thunder that the world is being set to
|
||||
*
|
||||
* @return true if the weather is being set to thundering, false otherwise
|
||||
*/
|
||||
public boolean toThunderState() {
|
||||
return to;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.bukkit.event.weather;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Stores data for weather changing in a world
|
||||
*/
|
||||
public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||
|
||||
private boolean canceled;
|
||||
private boolean to;
|
||||
private World world;
|
||||
|
||||
public WeatherChangeEvent(World world, boolean to) {
|
||||
super(Type.WEATHER_CHANGE, world);
|
||||
this.world = world;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. A canceled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @return true if this event is canceled
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
return canceled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A canceled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
canceled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of weather that the world is being set to
|
||||
*
|
||||
* @return true if the weather is being set to raining, false otherwise
|
||||
*/
|
||||
public boolean toWeatherState() {
|
||||
return to;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.bukkit.event.weather;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* Represents an Weather-related event
|
||||
*/
|
||||
public class WeatherEvent extends Event {
|
||||
protected World world;
|
||||
|
||||
public WeatherEvent(final Event.Type type, final World where) {
|
||||
super(type);
|
||||
world = where;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the World where this event is occuring
|
||||
* @return World this event is occuring in
|
||||
*/
|
||||
public final World getWorld() {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.bukkit.event.weather;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
/**
|
||||
* Handles all events fired in relation to weather
|
||||
*/
|
||||
public class WeatherListener implements Listener {
|
||||
public WeatherListener() {
|
||||
}
|
||||
|
||||
public void onWeatherChange(WeatherChangeEvent event) {
|
||||
}
|
||||
|
||||
public void onThunderChange(ThunderChangeEvent event) {
|
||||
}
|
||||
|
||||
public void onLightningStrike(LightningStrikeEvent event) {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user