3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 04:50:05 +01:00

SPIGOT-759: Add FireworkExplodeEvent.

Dieser Commit ist enthalten in:
DemonWav 2015-09-30 09:02:11 +10:00 committet von md_5
Ursprung 8cc1683e83
Commit d4e32cef0c
2 geänderte Dateien mit 18 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -1 +1,11 @@
--- a/net/minecraft/server/EntityFireworks.java
+++ b/net/minecraft/server/EntityFireworks.java
@@ -78,7 +78,7 @@
}
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
- this.world.broadcastEntityEffect(this, (byte) 17);
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) this.world.broadcastEntityEffect(this, (byte) 17);
this.die();
}

Datei anzeigen

@ -34,6 +34,7 @@ import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creeper; import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
import org.bukkit.entity.LightningStrike; import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -946,4 +947,10 @@ public class CraftEventFactory {
entityHuman.world.getServer().getPluginManager().callEvent(event); entityHuman.world.getServer().getPluginManager().callEvent(event);
return (Cancellable) event; return (Cancellable) event;
} }
public static FireworkExplodeEvent callFireworkExplodeEvent(EntityFireworks firework) {
FireworkExplodeEvent event = new FireworkExplodeEvent((Firework) firework.getBukkitEntity());
firework.world.getServer().getPluginManager().callEvent(event);
return event;
}
} }