@EventHandler public void onBowShot(EntityShootBowEvent e) { if (e.getEntity() instanceof Player && e.getProjectile() instanceof Arrow) { Bukkit.getScheduler().runTaskLater(this, () -> { if (!e.getProjectile().isDead()) { EntityTrail t = new EntityTrail(this, e.getProjectile(), new ScatteringSupplier(particles, new Vector3(2.0f, 1.0f, 2.0f), Vector3.ORIGIN, 5, 20, 1) , 1); trails.put(e.getProjectile(), t); t.begin(); } }, 5L); } }
@EventHandler public void onBowShot(EntityShootBowEvent e) { if (e.getEntity() instanceof Player && e.getProjectile() instanceof Arrow) { Bukkit.getScheduler().runTaskLater(this, () -> { if (!e.getProjectile().isDead()) { EntityTrail t = new EntityTrail(this, e.getProjectile(), new CircumferenceSupplier(particle, 1.2f, 0.9f, 0.0f, 1) .rotateY(tick -> tick * (2.0f * (float) Math.PI / 20)) , 1); trails.put(e.getProjectile(), t); t.begin(); } }, 5L); } }
@EventHandler public void onShotArrow(EntityShootBowEvent event) { if(event.getEntity() instanceof Player){ Player p = (Player)event.getEntity(); if(event.getProjectile() instanceof Arrow){ Arena a = am.getArena(p); if(a!=null){ if(a.isGame()){ SPlayer player = SPlayer.getDPlayer(p); player.addShots(1); } } } } }
@EventHandler public void onEntityShootBow(EntityShootBowEvent event) { LivingEntity eShooter = event.getEntity(); if(!(eShooter instanceof Player)) return; Player shooter = (Player) eShooter; BPPlayer bpShooter = BPPlayer.get(shooter); Game game = bpShooter.getGame(); if(game == null) return; game.getListener().onPlayerShootBow(event, bpShooter); }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onShootArrow(final EntityShootBowEvent event) { final PlayerStat stat = PlayerStat.ARROWS_SHOT; if (!(event.getEntity() instanceof Player)) { return; // It was not a player that shoot a bow } // Get player final Player player = (Player) event.getEntity(); // Do general check if (!plugin.doGeneralCheck(player, stat)) return; // Update value to new stat. plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid", player.getUniqueId(), "value", 1, "world", player.getWorld().getName(), "forceShot", event.getForce())); }
@EventHandler(priority = EventPriority.HIGHEST) public void onEntityShootBowEvent(EntityShootBowEvent event) { if ((event.getBow().hasItemMeta() && event.getBow().getItemMeta().getDisplayName().equals("Ender bow")) || event .getBow() instanceof EnderBowPlugin.EnderBow) { // Create custom event EntityShootEnderBowEvent entityShootEnderBowEvent = new EntityShootEnderBowEvent(event); // Call the custom event EnderBowPlugin.getInstance().getServer().getPluginManager().callEvent(entityShootEnderBowEvent); // Do the following, if it wasn't cancelled if (!entityShootEnderBowEvent.isCancelled()) { // Fire an ender pearl event.getEntity().launchProjectile(EnderPearl.class).setVelocity(event.getProjectile().getVelocity()); // Play the 'ENDERMAN_TELEPORT' sound event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1); } // Cancel the original Event, so no arrows are fired event.setCancelled(true); } }
@EventHandler public void onShootBow(EntityShootBowEvent e){ if (e.isCancelled() || !(e.getEntity() instanceof Player)){ return; } Player p = (Player) e.getEntity(); Entity proj = e.getProjectile(); List<String> Pots = RPConfig.getStringList("server-protection.deny-potions"); if (proj != null && (proj instanceof TippedArrow)){ TippedArrow arr = (TippedArrow) proj; if (Pots.contains(arr.getBasePotionData().getType().name())){ RPLang.sendMessage(p, "playerlistener.denypotion"); e.setCancelled(true); } } }
@SuppressWarnings("deprecation") @EventHandler public void onArrowFire(EntityShootBowEvent e) { if (e.getEntityType().equals(EntityType.PLAYER) && e.getBow().hasItemMeta()) { ItemMeta meta = e.getBow().getItemMeta(); if (meta.hasDisplayName() && Util.containsIgnoreCase(meta.getDisplayName(), "dick") && e.getEntity().hasPermission("bow.dick")) { arrows.add(e.getProjectile()); String name = meta.getDisplayName(); if (name.contains(":")) { String[] splitName = name.split(":"); if (splitName[0].equalsIgnoreCase("dick")) { splitName[1] = splitName[1].replace(" ", ""); try { int id = Integer.parseInt(splitName[1]); arrowMaterials.put(e.getProjectile(), Material.getMaterial(id)); } catch (NumberFormatException exc) { } } } } } }
@EventHandler public void onSkeletonShoot(EntityShootBowEvent event){ if(event.getEntity() instanceof Skeleton){ Skeleton s = (Skeleton) event.getEntity(); if(DroneShocktroop.isPossiblyShocktroop(s)){ DroneShocktroop troop = getShocktroop(s); if(troop == null){ s.remove(); //System.out.println("troop for named skeleton is null, removing!"); event.setCancelled(true); } else { //System.out.println("Allowed fire!"); } } } }
@SuppressWarnings("deprecation") public void onShoot(EntityShootBowEvent event) { if ((event.getEntity() instanceof Player)) { Player archer = (Player)event.getEntity(); if (archer.getAllowFlight()) { if ((archer.isFlying()) && (!archer.hasPermission("Fly.damage")) && (archer.getGameMode() != GameMode.CREATIVE)) { event.setCancelled(true); archer.updateInventory(); } if (!archer.isFlying() && archer.getGameMode() != GameMode.CREATIVE) { archer.setFlying(false); archer.setAllowFlight(false); archer.sendMessage(ChatColor.GOLD + "You were put out of fly mode."); } } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onEntityShootBow(EntityShootBowEvent event) { Entity projectile = event.getProjectile(); if (!(projectile instanceof Arrow)) { return; } ItemStack bow = event.getBow(); if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) { projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue); } projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0))); projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation())); }
@EventHandler public void onArrowShoot(EntityShootBowEvent event){ if(Minigame.getCurrentMinigame()!=null){ switch(Minigame.getCurrentMinigame().getMap().getType()){ case CIRCLE_OF_BOOM: if(Team.getTeam((Player)event.getEntity()).equals(Minigame.getObservers())){ event.setCancelled(true); } break; case KEY_QUEST: break; case WATER_THE_MONUMENT: break; default: break; } } }
@EventHandler public void onEntityShootBow(EntityShootBowEvent event) { if (event.getEntity() instanceof Player) { if (plugin.getMaterial("Harp").isMaterial(event.getBow())) { event.setCancelled(true); for (Player player : event.getEntity().getWorld().getPlayers()) { if (player.getLocation().distanceSquared(event.getEntity().getLocation()) <= 64) { try { File musicDirectory = new File(plugin.getDataFolder(), "music"); plugin.getJingleNoteManager().play(plugin, player.getName(), new MidiJingleSequencer(new File(musicDirectory, "canon.mid"), false)); } catch (MidiUnavailableException | InvalidMidiDataException | IOException exception) { exception.printStackTrace(); } } } } } }
@EventHandler(priority = EventPriority.MONITOR) public void onEntityShootBow (EntityShootBowEvent event) { if ( ! (event.getEntity() instanceof Player)) return; if (plugin.getConfig().getBoolean("general.particle-trail") && event.getProjectile() instanceof Arrow) { plugin.addArrow((Arrow) event.getProjectile()); plugin.updateEffectMaker(); } Player player = (Player) event.getEntity(); if ( !player.hasPermission("headshot.bypass.reload-time")) { long cooldown = plugin.getConfig().getLong("general.reload-time", 0) * 50; if (cooldown == 0) return; plugin.setCooldown(player, System.currentTimeMillis() + cooldown); } }
@EventHandler(priority = EventPriority.HIGH) private void onEntityShootBow(EntityShootBowEvent event) { // Return for disabled world if (Zones.inNoDemigodsZone(event.getEntity().getLocation())) return; // If they right clicked a block with the ITEM in hand, do stuff if (Items.areEqual(event.getBow(), ITEM)) { PlayerInventory inventory = null; Arrow startArrow = (Arrow) event.getProjectile(); startArrow.setVelocity(startArrow.getVelocity().multiply(.8)); if (event.getEntity() instanceof Player) inventory = ((Player) event.getEntity()).getInventory(); for (int i = 1; i < 3; i++) { if (inventory != null) { if (!inventory.contains(Material.ARROW, 1)) break; inventory.remove(new ItemStack(Material.ARROW, 1)); } Arrow spawnedArrow = (Arrow) event.getEntity().getWorld().spawnEntity(startArrow.getLocation(), EntityType.ARROW); spawnedArrow.setShooter(event.getEntity()); spawnedArrow.setVelocity(startArrow.getVelocity().multiply(.9 / i)); } } }
@EventHandler public void onBowShoot(EntityShootBowEvent event) { FireworkMeta fireworkMeta = (FireworkMeta) (new ItemStack( Material.FIREWORK)).getItemMeta(); Firework firework = (Firework) event .getProjectile() .getLocation() .getWorld() .spawnEntity(event.getProjectile().getLocation(), EntityType.FIREWORK); fireworkMeta.addEffect(FireworkEffect.builder().with(Type.BURST) .withColor(Color.RED).withColor(Color.WHITE) .withColor(Color.BLUE).withTrail().build()); firework.setFireworkMeta(fireworkMeta); event.getProjectile().setPassenger(firework); }
@Override public void call(Event event) { if (event instanceof EntityShootBowEvent) { if (lastTime != -1) { if (System.currentTimeMillis() - lastTime < ALLOWED_MINIMUM_DIFFERENCE) { callback(true); } } lastTime = System.currentTimeMillis(); } }
@EventHandler public void onPlayerInteract(EntityShootBowEvent event) { if (!(event.getEntity() instanceof Player)) { return; } final Player player = (Player) event.getEntity(); getCheckVersion(player, CheckType.FASTBOW, "A").call(event); }
@SuppressWarnings("deprecation") @EventHandler public void onShootWithoutArrows(EntityShootBowEvent event) { if(event.getEntity() instanceof Player) { Player player = (Player)event.getEntity(); if(player.getInventory().getItemInMainHand().getType() == event.getBow().getType()) { if ( player.getInventory().getItemInOffHand().getType() == Material.ARROW || player.getInventory().getItemInOffHand().getType() == Material.SPECTRAL_ARROW || player.getInventory().getItemInOffHand().getType() == Material.TIPPED_ARROW ) { event.setCancelled(false); } else { event.setCancelled(true); player.sendMessage(ChatColor.RED + Survival.Words.get("Must load Arrows on off hand")); player.updateInventory(); } } else { event.setCancelled(true); player.sendMessage(ChatColor.RED + Survival.Words.get("Must use a Bow with main hand")); player.updateInventory(); } } }
@EventHandler @SuppressWarnings("unused") public void onBowShoot(EntityShootBowEvent e) { if(e.getEntity() instanceof Player) { Player player = (Player) e.getEntity(); DynamicAC.getManager().getBackend().checkFastBow(player, e.getForce()); } }
@EventHandler public void onShoot(EntityShootBowEvent e) { if (e.getEntity() instanceof Player) { Item es = Item.get(e.getBow()); if (es.hasEnchantment(INFINITY)) { Player p = (Player) e; int r = (int) Math.random() * 100; switch (es.getEnchantmentLevel(UNBREAKING)) { case 1: if (r <= 20) { p.getInventory().addItem(new ItemStack(Material.ARROW)); } break; case 2: if (r <= 40) { p.getInventory().addItem(new ItemStack(Material.ARROW)); } break; case 3: if (r <= 60) { p.getInventory().addItem(new ItemStack(Material.ARROW)); } break; case 4: if (r <= 80) { p.getInventory().addItem(new ItemStack(Material.ARROW)); } break; case 5: break; } } } }
@EventHandler public void onShoot(EntityShootBowEvent e) { if ((e.getEntity() instanceof Player)) { Player p = (Player)e.getEntity(); if(Habilidad.getPercentAbility(p, HabilidadType.TRIPLE_ARROW)==0){ return; } if (new Random().nextInt(100)+1 <= Habilidad.getPercentAbility(p, HabilidadType.TRIPLE_ARROW)) { Arrow a1 = (Arrow)p.launchProjectile(Arrow.class); Arrow a2 = (Arrow)p.launchProjectile(Arrow.class); if ((getDirection(Float.valueOf(p.getLocation().getYaw())) == "EAST") || (getDirection(Float.valueOf(p.getLocation().getYaw())) == "WEST")) { a1.setVelocity(new Vector(a1.getVelocity().getX(), a1.getVelocity().getY(), a1.getVelocity().getZ() - 0.1D)); a2.setVelocity(new Vector(a2.getVelocity().getX(), a2.getVelocity().getY(), a2.getVelocity().getZ() + 0.1D)); } else { a1.setVelocity(new Vector(a1.getVelocity().getX() - 0.1D, a1.getVelocity().getY(), a1.getVelocity().getZ())); a2.setVelocity(new Vector(a2.getVelocity().getX() + 0.1D, a2.getVelocity().getY(), a2.getVelocity().getZ())); } } } }
@EventHandler public void trail(EntityShootBowEvent paramEntityShootBowEvent) { LivingEntity localLivingEntity = paramEntityShootBowEvent.getEntity(); Entity localEntity = paramEntityShootBowEvent.getProjectile(); if ((localEntity instanceof Projectile)) { final Projectile localProjectile = (Projectile)localEntity; if (((localProjectile instanceof Arrow)) && ((localLivingEntity instanceof Player))) { Player localPlayer = (Player)localLivingEntity; Arena a = new ArenaManager().getArena(localPlayer); if(a==null){ return; } if(!retornar(localPlayer)){ return; } ParticleEffect localParticleEffect = effect(localPlayer); final float f1 = 0.3F; final float f2 = 0.3F; final float f3 = 0.3F; final float f4 = 0.3F; final int i = 20; final double d = 20.0D; ArrowTrailSender(f1, f2, f3, f4, i, i, localParticleEffect, localProjectile, d); } } }
/** * Stop frozen players from firing bows */ @EventHandler public void onEntityShootBow(EntityShootBowEvent event) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); if (shouldFreeze(player)) { event.setCancelled(true); } } }
@EventHandler public void onArrowShoot(EntityShootBowEvent event){ if(event.getEntity() instanceof Player){ Player player = (Player) event.getEntity(); Effect item; if(arrows.containsKey(player.getUniqueId())){ item = arrows.get(player.getUniqueId()); shot.put(player.getUniqueId(), item); arrows.remove(player.getUniqueId()); return; } return; } }
@EventHandler(priority = EventPriority.HIGHEST) public void checkBowRestriction(EntityShootBowEvent event) { if (!(event.getEntity() instanceof Player)) { return; } if (!LoreAttributes.loreManager.canUse((Player) event.getEntity(), event.getBow())) event.setCancelled(true); }
@EventHandler public void onEntityShootBow (EntityShootBowEvent event) { if (event.getEntity() instanceof Player && event.getProjectile() instanceof Arrow) { if(hitPlayers.containsKey(event.getEntity())){ hitPlayers.put((Player) event.getEntity(), hitPlayers.get(event.getEntity()) + 1); } else{ hitPlayers.put((Player) event.getEntity(), 1); } ((Player) event.getEntity()).getInventory().getItemInMainHand().setDurability((short) -1); } }
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) { if (!ScriptLoader.isCurrentEvent(EntityShootBowEvent.class)) { Skript.error("You can not use Get Arrow expression in any event but 'on entity shoot:' event!"); return false; } return true; }
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) { if (!ScriptLoader.isCurrentEvent(EntityShootBowEvent.class)) { Skript.error("You can not use Arrow speed expression in any event but 'on entity shoot:' event!"); return false; } return true; }
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) { if (!ScriptLoader.isCurrentEvent(EntityShootBowEvent.class)) { Skript.error("You can not use Get Bow expression in any event but 'on entity shoot:' event!"); return false; } return true; }
@EventHandler public void onShootBow(EntityShootBowEvent event) { if ((event.getEntity() instanceof Player)) { Player player = (Player) event.getEntity(); if ((event.getBow().getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 2) || (event.getBow().getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 3)) { if (player.hasPermission(PermLib.USE_ENDERBOW)) { if (player.getInventory().contains(Material.ENDER_PEARL)) { if (event.getBow().getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 2) { event.setCancelled(true); player.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.ENDER_PEARL, 1)}); ((EnderPearl) player.launchProjectile(EnderPearl.class)).setVelocity(event.getProjectile().getVelocity().multiply(1.1D)); player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1.0F, 1.0F); } else if (event.getBow().getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 3) { event.setCancelled(true); ((EnderPearl) player.launchProjectile(EnderPearl.class)).setVelocity(event.getProjectile().getVelocity().multiply(1.1D)); player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1.0F, 1.0F); event.getBow().setDurability((short) 384); } } else { event.setCancelled(true); } } else { player.sendMessage(ChatLib.NO_PERMS_ENDERBOW); } } else {} } }
@EventHandler public void onEntityShootBowEvent(EntityShootBowEvent event) { if (!projectile.equals(EntityType.ARROW) || velocityMod != 1.0) { Vector vector = event.getProjectile().getVelocity(); event.setProjectile(GameHandler.getGameHandler().getMatchWorld().spawnEntity(event.getProjectile().getLocation(), projectile)); ((Projectile) event.getProjectile()).setShooter(event.getEntity()); event.getProjectile().setVelocity(vector.multiply(velocityMod)); event.getProjectile().setMetadata("custom", new FixedMetadataValue(GameHandler.getGameHandler().getPlugin(), true)); } }
public void a(EntityLiving entityliving, float f) { // EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4)); EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0); int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bz()); int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bz()); entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F)); if(i > 0) { entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D); } if(j > 0) { entityarrow.setKnockbackStrength(j); } if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bz()) > 0 || this.getSkeletonType() == 1) { EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100); this.world.getServer().getPluginManager().callEvent(event); if(!event.isCancelled()) { entityarrow.setOnFire(event.getDuration()); } } EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bz(), entityarrow, 0.8F); if(event1.isCancelled()) { event1.getProjectile().remove(); } else { if(event1.getProjectile() == entityarrow.getBukkitEntity()) { this.world.addEntity(entityarrow); } this.makeSound("random.bow", 1.0F, 1.0F / (this.bb().nextFloat() * 0.4F + 0.8F)); } }
public void a(EntityLiving entityliving, float f) { // EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4)); EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0); int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bA()); int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bA()); entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F)); if(i > 0) { entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D); } if(j > 0) { entityarrow.setKnockbackStrength(j); } if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) { EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100); this.world.getServer().getPluginManager().callEvent(event); if(!event.isCancelled()) { entityarrow.setOnFire(event.getDuration()); } } EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bA(), entityarrow, 0.8F); if(event1.isCancelled()) { event1.getProjectile().remove(); } else { if(event1.getProjectile() == entityarrow.getBukkitEntity()) { this.world.addEntity(entityarrow); } this.makeSound("random.bow", 1.0F, 1.0F / (this.bc().nextFloat() * 0.4F + 0.8F)); } }