geforkt von Mirrors/Paper
Added EntityTame event. Thanks halvors!
By: EvilSeph <evilseph@unaligned.org>
Dieser Commit ist enthalten in:
Ursprung
6e1fca7350
Commit
10d7e607c8
@ -592,6 +592,12 @@ public abstract class Event implements Serializable {
|
||||
* @see org.bukkit.event.entity.PigZapEvent
|
||||
*/
|
||||
PIG_ZAP (Category.LIVING_ENTITY),
|
||||
/**
|
||||
* Called when a LivingEntity is tamed
|
||||
*
|
||||
* @see org.bukkit.event.entity.EntityTameEvent
|
||||
*/
|
||||
ENTITY_TAME (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* WEATHER EVENTS
|
||||
|
@ -35,4 +35,6 @@ public class EntityListener implements Listener {
|
||||
public void onPigZap(PigZapEvent event) {}
|
||||
|
||||
public void onCreeperPower(CreeperPowerEvent event) {}
|
||||
|
||||
public void onEntityTame(EntityTameEvent event) {}
|
||||
}
|
||||
|
49
paper-api/src/main/java/org/bukkit/event/entity/EntityTameEvent.java
Normale Datei
49
paper-api/src/main/java/org/bukkit/event/entity/EntityTameEvent.java
Normale Datei
@ -0,0 +1,49 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Thrown when a LivingEntity is tamed
|
||||
*/
|
||||
public class EntityTameEvent extends EntityEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private AnimalTamer owner;
|
||||
|
||||
public EntityTameEvent(Entity entity, AnimalTamer owner) {
|
||||
super(Type.ENTITY_TAME, entity);
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. Set to true if you
|
||||
* want to prevent the entity from being tamed
|
||||
*
|
||||
* @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 the entity from being tamed
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the owning AnimalTamer
|
||||
*
|
||||
* @return the owning AnimalTamer
|
||||
*/
|
||||
public AnimalTamer getOwner() {
|
||||
return owner;
|
||||
}
|
||||
}
|
@ -669,6 +669,13 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
};
|
||||
|
||||
case ENTITY_TAME:
|
||||
return new EventExecutor() {
|
||||
public void execute(Listener listener, Event event) {
|
||||
((EntityListener) listener).onEntityTame((EntityTameEvent) event);
|
||||
}
|
||||
};
|
||||
|
||||
// Vehicle Events
|
||||
case VEHICLE_CREATE:
|
||||
return new EventExecutor() {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren