Added a lot of events relating to weather, including those for entities. Thanks wizjany!
This commit is contained in:
89
src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
Normal file
89
src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Stores data for creepers being (un)powered
|
||||
*/
|
||||
public class CreeperPowerEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private boolean canceled;
|
||||
private Entity creeper;
|
||||
private PowerCause cause;
|
||||
private Entity bolt;
|
||||
|
||||
public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
|
||||
super(Type.CREEPER_POWER, creeper);
|
||||
this.creeper = creeper;
|
||||
this.bolt = bolt;
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
public CreeperPowerEvent(Entity creeper, PowerCause cause) {
|
||||
super(Type.CREEPER_POWER, creeper);
|
||||
this.creeper = creeper;
|
||||
this.cause = cause;
|
||||
this.bolt = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 creeper.
|
||||
*
|
||||
* @return lightning entity
|
||||
*/
|
||||
public Entity getLightning() {
|
||||
return bolt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cause of the creeper being (un)powered.
|
||||
* @return A PowerCause value detailing the cause of change in power.
|
||||
*/
|
||||
public PowerCause getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum to specify the cause of the change in power
|
||||
*/
|
||||
public enum PowerCause {
|
||||
/**
|
||||
* Power change caused by a lightning bolt
|
||||
* Powered state: true
|
||||
*/
|
||||
LIGHTNING,
|
||||
|
||||
/**
|
||||
* Power change caused by something else (probably a plugin)
|
||||
* Powered state: true
|
||||
*/
|
||||
SET_ON,
|
||||
|
||||
/**
|
||||
* Power change caused by something else (probably a plugin)
|
||||
* Powered state: false
|
||||
*/
|
||||
SET_OFF
|
||||
}
|
||||
}
|
||||
@@ -40,4 +40,10 @@ public class EntityListener implements Listener {
|
||||
|
||||
public void onPaintingBreak(PaintingBreakEvent event){
|
||||
}
|
||||
|
||||
public void onPigZap(PigZapEvent event) {
|
||||
}
|
||||
|
||||
public void onCreeperPower(CreeperPowerEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
61
src/main/java/org/bukkit/event/entity/PigZapEvent.java
Normal file
61
src/main/java/org/bukkit/event/entity/PigZapEvent.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Stores data for pigs being zapped
|
||||
*/
|
||||
public class PigZapEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private boolean canceled;
|
||||
private Entity pig;
|
||||
private Entity pigzombie;
|
||||
private Entity bolt;
|
||||
|
||||
public PigZapEvent(Entity pig, Entity bolt, Entity pigzombie) {
|
||||
super(Type.PIG_ZAP, pig);
|
||||
this.pig = pig;
|
||||
this.bolt = bolt;
|
||||
this.pigzombie = pigzombie;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 pig.
|
||||
*
|
||||
* @return lightning entity
|
||||
*/
|
||||
public Entity getLightning() {
|
||||
return bolt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the zombie pig that will replace the pig,
|
||||
* provided the event is not cancelled first.
|
||||
*
|
||||
* @return resulting entity
|
||||
*/
|
||||
public Entity getPigZombie() {
|
||||
return pigzombie;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user