geforkt von Mirrors/Paper
Added SlimeSplit event. Thanks garbagemule!
The SlimeSplit event is fired when a Slime attempts to split upon death. The event may be cancelled, and the amount of smaller slimes may be customized. By: EvilSeph <evilseph@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
d0f0db958d
Commit
5db08677a3
@ -689,6 +689,12 @@ public abstract class Event implements Serializable {
|
|||||||
* @see org.bukkit.event.entity.ProjectileHitEvent
|
* @see org.bukkit.event.entity.ProjectileHitEvent
|
||||||
*/
|
*/
|
||||||
PROJECTILE_HIT (Category.ENTITY),
|
PROJECTILE_HIT (Category.ENTITY),
|
||||||
|
/**
|
||||||
|
* Called when a Slime splits into smaller Slimes upon death
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.entity.SlimeSplitEvent
|
||||||
|
*/
|
||||||
|
SLIME_SPLIT (Category.LIVING_ENTITY),
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity is regains health
|
* Called when a LivingEntity is regains health
|
||||||
*
|
*
|
||||||
|
@ -155,4 +155,11 @@ public class EntityListener implements Listener {
|
|||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {}
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a Slime splits into smaller Slimes upon death
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onSlimeSplit(SlimeSplitEvent event) {}
|
||||||
}
|
}
|
||||||
|
44
paper-api/src/main/java/org/bukkit/event/entity/SlimeSplitEvent.java
Normale Datei
44
paper-api/src/main/java/org/bukkit/event/entity/SlimeSplitEvent.java
Normale Datei
@ -0,0 +1,44 @@
|
|||||||
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a Slime splits into smaller Slimes upon death
|
||||||
|
*/
|
||||||
|
public class SlimeSplitEvent extends EntityEvent implements Cancellable {
|
||||||
|
private boolean cancel;
|
||||||
|
private int count;
|
||||||
|
|
||||||
|
public SlimeSplitEvent(Entity what, int count) {
|
||||||
|
super(Type.SLIME_SPLIT, what);
|
||||||
|
this.cancel = false;
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the amount of smaller slimes to spawn
|
||||||
|
*
|
||||||
|
* @return the amount of slimes to spawn
|
||||||
|
*/
|
||||||
|
public int getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets how many smaller slimes will spawn on the split
|
||||||
|
*
|
||||||
|
* @param count the amount of slimes to spawn
|
||||||
|
*/
|
||||||
|
public void setCount(int count) {
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
}
|
@ -797,6 +797,13 @@ public class JavaPluginLoader implements PluginLoader {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
case SLIME_SPLIT:
|
||||||
|
return new EventExecutor() {
|
||||||
|
public void execute(Listener listener, Event event) {
|
||||||
|
((EntityListener) listener).onSlimeSplit((SlimeSplitEvent) event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Vehicle Events
|
// Vehicle Events
|
||||||
case VEHICLE_CREATE:
|
case VEHICLE_CREATE:
|
||||||
return new EventExecutor() {
|
return new EventExecutor() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren