geforkt von Mirrors/Paper
added some API for entities
By: Tahg <tahgtahv@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
1a1d4e95f4
Commit
97fd93727d
@ -156,4 +156,17 @@ public interface Entity {
|
||||
* @return
|
||||
*/
|
||||
public abstract boolean eject();
|
||||
|
||||
/**
|
||||
* Returns the distance this entity has fallen
|
||||
* @return
|
||||
*/
|
||||
public float getFallDistance();
|
||||
|
||||
/**
|
||||
* Sets the fall distance for this entity
|
||||
* @param distance
|
||||
*/
|
||||
public void setFallDistance(float distance);
|
||||
|
||||
}
|
||||
|
@ -533,6 +533,14 @@ public abstract class Event implements Serializable {
|
||||
*/
|
||||
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) {
|
||||
}
|
||||
}
|
||||
|
@ -468,6 +468,12 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
((EntityListener) listener).onEntityTarget((EntityTargetEvent) event);
|
||||
}
|
||||
};
|
||||
case ENTITY_INTERACT:
|
||||
return new EventExecutor() {
|
||||
public void execute(Listener listener, Event event) {
|
||||
((EntityListener) listener).onEntityInteract((EntityInteractEvent) event);
|
||||
}
|
||||
};
|
||||
case CREATURE_SPAWN:
|
||||
return new EventExecutor() {
|
||||
public void execute(Listener listener, Event event) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren