@@ -532,6 +532,14 @@ public abstract class Event implements Serializable {
|
||||
* @see org.bukkit.event.entity.EntityTargetEvent
|
||||
*/
|
||||
ENTITY_TARGET (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* Called when an entity interacts with a block
|
||||
* This event specifically excludes player entities
|
||||
*
|
||||
* @see org.bukkit.event.entity.EntityInteractEvent
|
||||
*/
|
||||
ENTITY_INTERACT (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* VEHICLE EVENTS
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author durron597
|
||||
*
|
||||
*/
|
||||
public class EntityInteractEvent extends EntityEvent implements Cancellable {
|
||||
protected Block block;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
public EntityInteractEvent(Entity entity, Block block) {
|
||||
super(Type.ENTITY_INTERACT, entity);
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. Set to true if you
|
||||
* want to prevent buckets from placing water and so forth
|
||||
*
|
||||
* @return boolean cancellation state
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A canceled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* Canceling this event will prevent use of food (player won't lose the
|
||||
* food item), prevent bows/snowballs/eggs from firing, etc. (player won't
|
||||
* lose the ammo)
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the involved block
|
||||
*
|
||||
* @return Block returns the block clicked with this item.
|
||||
*/
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
}
|
||||
@@ -29,4 +29,7 @@ public class EntityListener implements Listener {
|
||||
|
||||
public void onEntityTarget(EntityTargetEvent event) {
|
||||
}
|
||||
|
||||
public void onEntityInteract(EntityInteractEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user