org.bukkit.event.entity.EntityCombustEvent Java Examples
The following examples show how to use
org.bukkit.event.entity.EntityCombustEvent.
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: EffIgnite.java From Skript with GNU General Public License v3.0 | 6 votes |
@Override protected void execute(final Event e) { final int d; if (duration != null) { final Timespan t = duration.getSingle(e); if (t == null) return; d = (int) (t.getTicks_i() >= Integer.MAX_VALUE ? Integer.MAX_VALUE : t.getTicks_i()); } else { d = ignite ? DEFAULT_DURATION : 0; } for (final Entity en : entities.getArray(e)) { if (e instanceof EntityDamageEvent && ((EntityDamageEvent) e).getEntity() == en && !Delay.isDelayed(e)) { Bukkit.getScheduler().scheduleSyncDelayedTask(Skript.getInstance(), new Runnable() { @Override public void run() { en.setFireTicks(d); } }); } else { if (e instanceof EntityCombustEvent && ((EntityCombustEvent) e).getEntity() == en && !Delay.isDelayed(e)) ((EntityCombustEvent) e).setCancelled(true);// can't change the duration, thus simply cancel the event (and create a new one) en.setFireTicks(d); } } }
Example #2
Source File: EventFilterMatchModule.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onCombust(final EntityCombustEvent event) { cancelUnlessInteracting(event, event.getEntity()); if (event instanceof EntityCombustByEntityEvent) { cancelUnlessInteracting(event, ((EntityCombustByEntityEvent) event).getCombuster()); } }
Example #3
Source File: EventFilterMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onCombust(final EntityCombustEvent event) { cancelUnlessInteracting(event, event.getEntity()); if(event instanceof EntityCombustByEntityEvent) { cancelUnlessInteracting(event, ((EntityCombustByEntityEvent) event).getCombuster()); } }
Example #4
Source File: MobLibListener.java From civcraft with GNU General Public License v2.0 | 5 votes |
@EventHandler(priority = EventPriority.LOWEST) public void onEntityCombust(EntityCombustEvent event) { if (event.getEntity() instanceof LivingEntity) { if (MobLib.isMobLibEntity((LivingEntity) event.getEntity())) { event.setCancelled(true); } } }
Example #5
Source File: BonusGoodieManager.java From civcraft with GNU General Public License v2.0 | 5 votes |
@EventHandler(priority = EventPriority.MONITOR) public void OnEntityCombustEvent(EntityCombustEvent event) { if (!(event.getEntity() instanceof Item)) { return; } BonusGoodie goodie = CivGlobal.getBonusGoodie(((Item)event.getEntity()).getItemStack()); if (goodie == null) { return; } goodie.replenish(((Item)event.getEntity()).getItemStack(), (Item)event.getEntity(), null, null); }
Example #6
Source File: PvPLogger.java From civcraft with GNU General Public License v2.0 | 5 votes |
@EventHandler(priority = EventPriority.LOWEST) public void onEntityCombust(EntityCombustEvent event) { /* Stop our player NPCs from combusting in the sunlight. */ /* XXX Handled inside the mob lib now... */ // if (event.getEntity() instanceof LivingEntity) { // if (CivGlobal.entityManager.isRemoteEntity((LivingEntity) event.getEntity())) { // event.setCancelled(true); // } // } }
Example #7
Source File: ItemNewBow.java From Carbon-2 with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void a(ItemStack itemstack, World world, EntityHuman player, int usedFor) { final boolean flag = player.abilities.canInstantlyBuild || EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_INFINITE.id, itemstack) > 0; int arrowSlot = this.findArrowSlot(player.inventory); if (flag || arrowSlot != -1) { ItemStack arrowItemStack = arrowSlot != -1 ? player.inventory.getItem(arrowSlot) : new ItemStack(Items.ARROW); final int j = this.d(itemstack) - usedFor; float ready = j / 20.0f; ready = (ready * ready + ready * 2.0f) / 3.0f; if (ready < 0.1) { return; } if (ready > 1.0f) { ready = 1.0f; } EntityArrow entityarrow = null; if (arrowItemStack.getItem() instanceof ItemNewArrow) { entityarrow = ((ItemNewArrow) arrowItemStack.getItem()).createArrowEntity(world, arrowItemStack, player, ready); } else { entityarrow = new EntityArrow(world, player, ready * 2.0f); } if (ready == 1.0f) { entityarrow.setCritical(true); } final int k = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, itemstack); if (k > 0) { entityarrow.b(entityarrow.j() + k * 0.5 + 0.5); } final int l = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, itemstack); if (l > 0) { entityarrow.setKnockbackStrength(l); } if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, itemstack) > 0) { final EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100); entityarrow.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { entityarrow.setOnFire(event.getDuration()); } } final EntityShootBowEvent event2 = CraftEventFactory.callEntityShootBowEvent(player, itemstack, entityarrow, ready); if (event2.isCancelled()) { event2.getProjectile().remove(); return; } if (event2.getProjectile() == entityarrow.getBukkitEntity()) { world.addEntity(entityarrow); } itemstack.damage(1, player); world.makeSound(player, "random.bow", 1.0f, 1.0f / (ItemNewBow.g.nextFloat() * 0.4f + 1.2f) + ready * 0.5f); if (flag) { entityarrow.fromPlayer = 2; } else { player.inventory.a(Items.ARROW); } player.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]); } }
Example #8
Source File: DMobListener.java From DungeonsXL with GNU General Public License v3.0 | 4 votes |
@EventHandler public void onEntityCombust(EntityCombustEvent event) { if (plugin.getGameWorld(event.getEntity().getWorld()) != null) { event.setCancelled(true); } }
Example #9
Source File: ItemNewBow.java From Carbon-2 with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void a(ItemStack itemstack, World world, EntityHuman player, int usedFor) { final boolean flag = player.abilities.canInstantlyBuild || EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_INFINITE.id, itemstack) > 0; int arrowSlot = this.findArrowSlot(player.inventory); if (flag || arrowSlot != -1) { ItemStack arrowItemStack = arrowSlot != -1 ? player.inventory.getItem(arrowSlot) : new ItemStack(Items.ARROW); final int j = this.d(itemstack) - usedFor; float ready = j / 20.0f; ready = (ready * ready + ready * 2.0f) / 3.0f; if (ready < 0.1) { return; } if (ready > 1.0f) { ready = 1.0f; } EntityArrow entityarrow = null; if (arrowItemStack.getItem() instanceof ItemNewArrow) { entityarrow = ((ItemNewArrow) arrowItemStack.getItem()).createArrowEntity(world, arrowItemStack, player, ready); } else { entityarrow = new EntityArrow(world, player, ready * 2.0f); } if (ready == 1.0f) { entityarrow.setCritical(true); } final int k = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, itemstack); if (k > 0) { entityarrow.b(entityarrow.j() + k * 0.5 + 0.5); } final int l = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, itemstack); if (l > 0) { entityarrow.setKnockbackStrength(l); } if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, itemstack) > 0) { final EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100); entityarrow.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { entityarrow.setOnFire(event.getDuration()); } } final EntityShootBowEvent event2 = CraftEventFactory.callEntityShootBowEvent(player, itemstack, entityarrow, ready); if (event2.isCancelled()) { event2.getProjectile().remove(); return; } if (event2.getProjectile() == entityarrow.getBukkitEntity()) { world.addEntity(entityarrow); } itemstack.damage(1, player); world.makeSound(player, "random.bow", 1.0f, 1.0f / (ItemNewBow.g.nextFloat() * 0.4f + 1.2f) + ready * 0.5f); if (flag) { entityarrow.fromPlayer = 2; } else { player.inventory.a(Items.ARROW); } player.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]); } }