@Override protected void pulsePhysics() { if (boundingBox != null) { Vector size = boundingBox.getSize(); for (Entity entity : world.getNearbyEntities( location, size.getX(), size.getY(), size.getZ())) { if (entity != this && !(entity.equals(shooter))) { if (entity instanceof LivingEntity) { EventFactory.getInstance().callEvent(new ProjectileHitEvent(this, entity)); collide((LivingEntity) entity); break; } } } } super.pulsePhysics(); }
@EventHandler(priority = EventPriority.HIGHEST) public void onRodLand(ProjectileHitEvent e){ Entity hookEntity = e.getEntity(); World world = hookEntity.getWorld(); if(e.getEntityType() != EntityType.FISHING_HOOK) return; hitEntity = e.getHitEntity(); } catch(NoSuchMethodError e1){ //For older version that don't have such method hitEntity = world.getNearbyEntities(hookEntity.getLocation(), 0.25, 0.25, 0.25).stream()
@EventHandler(priority = EventPriority.HIGH) public void onProjectileHit(ProjectileHitEvent event) { if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) { Projectile entity = event.getEntity(); if (event.getEntityType() == EntityType.ARROW) { entity.getWorld().createExplosion(entity.getLocation(), 2F); } } }
@Override public MCEntityType getEntityType() { return BukkitMCEntityType.valueOfConcrete(phe.getEntityType()); }
@Override public MCEntity getHitEntity() { return BukkitConvertor.BukkitGetCorrectEntity(phe.getHitEntity()); }
@Override public MCBlock getHitBlock() { Block blk = phe.getHitBlock(); if(blk == null) { return null; } return new BukkitMCBlock(blk); }
@Override public MCProjectile getEntity() { return new BukkitMCProjectile(phe.getEntity()); }
@EventHandler public void onArrowHit(final ProjectileHitEvent e) { Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> { if (!e.getEntity().isValid()) return; if (Variables.arrows.containsKey(e.getEntity().getUniqueId())) Variables.arrows.remove(e.getEntity().getUniqueId()); if (e.getEntity() instanceof Arrow) handleGrapplingHook((Arrow) e.getEntity()); }, 4L); }
.callEvent(new ProjectileHitEvent((Projectile) this, pendingBlock));
@Override public PowerResult<Void> projectileHit(Player player, ItemStack stack, ProjectileHitEvent event) { Projectile hit = event.getEntity(); Location location = hit.getLocation(); return fire(player, stack, location); }
public static BukkitMCProjectileHitEvent _instantiate(MCProjectile p) { return new BukkitMCProjectileHitEvent( new ProjectileHitEvent(((BukkitMCProjectile) p).asProjectile())); }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onProjectileHit(final ProjectileHitEvent event) { final Integer id = event.getEntity().getEntityId(); final Smokescreen smokescreen = Smokescreen.getSnowballs().get(id); if (smokescreen != null) { final Location loc = event.getEntity().getLocation(); Smokescreen.playEffect(loc); for (final Entity en : GeneralMethods.getEntitiesAroundPoint(loc, smokescreen.getRadius())) { smokescreen.applyBlindness(en); } Smokescreen.getSnowballs().remove(id); } }
@EventHandler public void onProjectileHit(ProjectileHitEvent event) { final Projectile projectile = event.getEntity(); // This happens before EntityDamageEvent, so the hit target will // be assigned before the tracked projectile is checked. // This is here to register misses, mainly. // TODO: use event.getBlock in newer API. Targeting.checkTracking(controller.getPlugin(), projectile, null, CompatibilityUtils.getHitBlock(event)); }
@Override public PowerResult<Void> projectileHit(Player player, ItemStack stack, ProjectileHitEvent event) { Projectile hit = event.getEntity(); Location location = hit.getLocation(); Location start = player.getLocation(); if (start.distanceSquared(location) >= distance * distance) { player.sendMessage(I18n.format("message.too.far")); return PowerResult.noop(); } return fire(player, stack, location); }
@EventHandler public void onProjectileHit(ProjectileHitEvent e) { final Projectile entity = e.getEntity(); if (removeProjectiles.contains(entity.getEntityId())) { Bukkit.getScheduler().runTask(plugin, () -> { double distance = player.getLocation().distance(e.getEntity().getLocation()); if (ranged.get(0).rm > distance || distance > ranged.get(0).r) { return;
@EventHandler public void onArrowHit(ProjectileHitEvent event) { final Projectile arrow = event.getEntity(); if (arrow.getType() != EntityType.ARROW) { return;
@Override public PowerResult<Void> projectileHit(Player player, ItemStack stack, ProjectileHitEvent event) { if (!checkCooldown(this, player, cooldown, true, true)) return PowerResult.cd(); if (!getItem().consumeDurability(stack, cost)) return PowerResult.cost(); World world = player.getWorld(); Location start = player.getLocation(); Location newLoc = event.getEntity().getLocation(); if (start.distanceSquared(newLoc) >= distance * distance) { player.sendMessage(I18n.format("message.too.far")); return PowerResult.noop(); } newLoc.setPitch(start.getPitch()); newLoc.setYaw(start.getYaw()); player.teleport(newLoc); world.playEffect(newLoc, Effect.ENDER_SIGNAL, 0); world.playSound(newLoc, Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 0.3f); return PowerResult.ok(); }