Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
45 Zeilen
2.0 KiB
Diff
45 Zeilen
2.0 KiB
Diff
--- a/net/minecraft/server/ItemBow.java
|
|
+++ b/net/minecraft/server/ItemBow.java
|
|
@@ -1,5 +1,7 @@
|
|
package net.minecraft.server;
|
|
|
|
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
|
|
+
|
|
public class ItemBow extends Item {
|
|
|
|
public ItemBow() {
|
|
@@ -73,7 +75,20 @@
|
|
}
|
|
|
|
if (EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_FIRE, itemstack) > 0) {
|
|
- entityarrow.setOnFire(100);
|
|
+ // CraftBukkit start - call EntityCombustEvent
|
|
+ EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
|
|
+ entityarrow.world.getServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (!event.isCancelled()) {
|
|
+ entityarrow.setOnFire(event.getDuration());
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+ }
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f);
|
|
+ if (event.isCancelled()) {
|
|
+ event.getProjectile().remove();
|
|
+ return;
|
|
}
|
|
|
|
itemstack.damage(1, entityhuman);
|
|
@@ -81,7 +96,10 @@
|
|
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
|
}
|
|
|
|
- world.addEntity(entityarrow);
|
|
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
|
+ world.addEntity(entityarrow);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.v, SoundCategory.NEUTRAL, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|