mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
[Bleeding] Implement EntityShootBowEvent. Thanks Zeerix.
By: Zeerix <zeerix@draig.de>
This commit is contained in:
parent
c2bf4d0844
commit
6429a4663c
1 changed files with 21 additions and 0 deletions
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.server.ChunkCoordinates;
|
||||
import net.minecraft.server.Entity;
|
||||
import net.minecraft.server.EntityArrow;
|
||||
import net.minecraft.server.EntityBlaze;
|
||||
import net.minecraft.server.EntityCaveSpider;
|
||||
import net.minecraft.server.EntityChicken;
|
||||
|
@ -51,7 +52,9 @@ import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
|||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.block.*;
|
||||
|
@ -182,6 +185,24 @@ public class CraftEventFactory {
|
|||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* EntityShootBowEvent
|
||||
*/
|
||||
public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, EntityArrow entityArrow, float force) {
|
||||
LivingEntity shooter = (LivingEntity) who.getBukkitEntity();
|
||||
CraftItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
Arrow arrow = (Arrow) entityArrow.getBukkitEntity();
|
||||
|
||||
if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) {
|
||||
itemInHand = null;
|
||||
}
|
||||
|
||||
EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* BlockDamageEvent
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue