Added events for endermen pickup/placement blocks and methods to get/set the block that an enderman is holding. Thanks Wizjany
By: Wizjany <wizjany@gmail.com>
This commit is contained in:
@@ -679,13 +679,24 @@ public abstract class Event implements Serializable {
|
||||
* @see org.bukkit.event.entity.ProjectileHitEvent
|
||||
*/
|
||||
PROJECTILE_HIT (Category.ENTITY),
|
||||
|
||||
/**
|
||||
* Called when a LivingEntity is regains health
|
||||
*
|
||||
* @see org.bukkit.event.entity.EntityRegainHealthEvent
|
||||
*/
|
||||
ENTITY_REGAIN_HEALTH (Category.LIVING_ENTITY),
|
||||
/**
|
||||
* Called when an Enderman picks a block up
|
||||
*
|
||||
* @see org.bukkit.event.entity.EndermanPickupEvent
|
||||
*/
|
||||
ENDERMAN_PICKUP (Category.LIVING_ENTITY),
|
||||
/**
|
||||
* Called when an Enderman places a block
|
||||
*
|
||||
* @see org.bukkit.event.entity.EndermanPlaceEvent
|
||||
*/
|
||||
ENDERMAN_PLACE (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* WEATHER EVENTS
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class EndermanPickupEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private boolean cancel;
|
||||
private Block block;
|
||||
|
||||
public EndermanPickupEvent(Entity what, Block block) {
|
||||
super(Type.ENDERMAN_PICKUP, what);
|
||||
this.block = block;
|
||||
this.cancel = false;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block that the enderman is going to pick up.
|
||||
*
|
||||
* @return block the enderman is about to pick up
|
||||
*/
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class EndermanPlaceEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private boolean cancel;
|
||||
private Location location;
|
||||
|
||||
public EndermanPlaceEvent(Entity what, Location location) {
|
||||
super(Type.ENDERMAN_PLACE, what);
|
||||
this.location = location;
|
||||
this.cancel = false;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the location that is target of the enderman's placement.
|
||||
*
|
||||
* @return location where the enderman will place its block
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
@@ -134,4 +134,18 @@ public class EntityListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onProjectileHit(ProjectileHitEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when an Enderman picks a block up
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onEndermanPickup(EndermanPickupEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when an Enderman places a block
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onEndermanPlace(EndermanPlaceEvent event) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user