Java Code Examples for org.bukkit.event.entity.EntityShootBowEvent#getBow()
The following examples show how to use
org.bukkit.event.entity.EntityShootBowEvent#getBow() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityShootCustomBow.java From AdditionsAPI with MIT License | 6 votes |
@EventHandler(priority = EventPriority.MONITOR) public void onEntityShootCustomBow(EntityShootCustomBowEvent customEvent) { if (customEvent.isCancelled()) return; CustomBow cBow = customEvent.getCustomBow(); EntityShootBowEvent event = customEvent.getEntityShootBowEvent(); ItemStack item = event.getBow(); ItemDurability mechanics = cBow.getDurabilityMechanics(); if (event.getEntityType() == EntityType.PLAYER && mechanics instanceof BowDurability) { Player player = (Player) event.getEntity(); BowDurability bowMechanics = (BowDurability) mechanics; Bukkit.getServer().getPluginManager() .callEvent(new PlayerCustomItemDamageEvent(player, item, bowMechanics.getFireArrow(), cBow)); } ArrowFromCustomBowHit.addArrow(event.getProjectile(), new CustomItemStack(item), event.getEntity()); }
Example 2
Source File: EntityShootBow.java From AdditionsAPI with MIT License | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onEntityShootBow(EntityShootBowEvent event) { ItemStack item = event.getBow(); if (AdditionsAPI.isCustomItem(item)) { CustomItemStack cStack = new CustomItemStack(item); CustomItem cItem = cStack.getCustomItem(); if (cItem.getItemType() == ItemType.BOW) { Bukkit.getServer().getPluginManager().callEvent(new EntityShootCustomBowEvent(event, cStack)); } } }
Example 3
Source File: CustomItemListener.java From NBTEditor with GNU General Public License v3.0 | 5 votes |
@EventHandler private void entityShootBow(EntityShootBowEvent event) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); CustomItem customItem = CustomItemManager.getCustomItem(event.getBow()); if (verifyCustomItem(customItem, player, false)) { DelayedPlayerDetails details = new DelayedPlayerDetails(event.getBow(), player); ((CustomBow) customItem).onShootBow(event, details); if (!event.isCancelled() && event.getProjectile() instanceof Projectile) { details.lock(); event.getProjectile().setMetadata("CustomItem-bow", new FixedMetadataValue(CustomItemManager._plugin, new Object[] { customItem, details })); } } } }
Example 4
Source File: Rage.java From CardinalPGM with MIT License | 4 votes |
@EventHandler(priority = EventPriority.MONITOR) public void onEntityBowShoot(EntityShootBowEvent event) { if (event.getBow() != null && event.getBow().containsEnchantment(Enchantment.ARROW_DAMAGE) && event.getBow().getEnchantmentLevel(Enchantment.ARROW_DAMAGE) > 1) { event.getProjectile().setMetadata("rage", new FixedMetadataValue(GameHandler.getGameHandler().getPlugin(), true)); } }