geforkt von Mirrors/Paper
[Bleeding] Implement ExpBottleEvent; Addresses BUKKIT-888
Dieser Commit ist enthalten in:
Ursprung
9055a20d71
Commit
68b98d4c8f
@ -28,9 +28,18 @@ public class EntityThrownExpBottle extends EntityProjectile {
|
|||||||
|
|
||||||
protected void a(MovingObjectPosition movingobjectposition) {
|
protected void a(MovingObjectPosition movingobjectposition) {
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
this.world.triggerEffect(2002, (int) Math.round(this.locX), (int) Math.round(this.locY), (int) Math.round(this.locZ), 0);
|
// CraftBukkit moved after event
|
||||||
|
//this.world.triggerEffect(2002, (int) Math.round(this.locX), (int) Math.round(this.locY), (int) Math.round(this.locZ), 0);
|
||||||
int i = 3 + this.world.random.nextInt(5) + this.world.random.nextInt(5);
|
int i = 3 + this.world.random.nextInt(5) + this.world.random.nextInt(5);
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, i);
|
||||||
|
i = event.getExperience();
|
||||||
|
if (event.getShowEffect()) {
|
||||||
|
this.world.triggerEffect(2002, (int) Math.round(this.locX), (int) Math.round(this.locY), (int) Math.round(this.locZ), 0);
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
while (i > 0) {
|
while (i > 0) {
|
||||||
int j = EntityExperienceOrb.getOrbValue(i);
|
int j = EntityExperienceOrb.getOrbValue(i);
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ import org.bukkit.entity.Pig;
|
|||||||
import org.bukkit.entity.PigZombie;
|
import org.bukkit.entity.PigZombie;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
|
import org.bukkit.entity.ThrownExpBottle;
|
||||||
import org.bukkit.entity.ThrownPotion;
|
import org.bukkit.entity.ThrownPotion;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
@ -498,4 +499,11 @@ public class CraftEventFactory {
|
|||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ExpBottleEvent callExpBottleEvent(Entity entity, int exp) {
|
||||||
|
ThrownExpBottle bottle = (ThrownExpBottle) entity.getBukkitEntity();
|
||||||
|
ExpBottleEvent event = new ExpBottleEvent(bottle, exp);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
return event;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren