/** * Plays the sound to all players at the given location. * * @param location Location at which to play the sound */ public void play(Location location) { location.getWorld().playSound(location, sound, volume, pitch); }
/** * Convert a TNT block into a primed TNT entity with the player who ignited the TNT. * * @param tntBlock The block to ignite. * @param ignitedByExplosion True if another explosion caused this ignition. * @param player The player who ignited the TNT. */ public static void igniteBlock( Block tntBlock, boolean ignitedByExplosion, GlowPlayer player) { tntBlock.setType(Material.AIR); World world = tntBlock.getWorld(); GlowTntPrimed tnt = (GlowTntPrimed) world .spawnEntity(tntBlock.getLocation().add(0.5, 0, 0.5), EntityType.PRIMED_TNT); tnt.setSource(player); tnt.setIgnitedByExplosion(ignitedByExplosion); world.playSound(tntBlock.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1); }
/** * Plays a TARDIS sound for the player and surrounding players at the current location. * * @param l The location * @param s The sound to play * @param volume The volume to play the sound at */ public static void playTARDISSound(Location l, String s, float volume) { l.getWorld().playSound(l, s, VOLUME * volume, 1.0f); }
/** * Plays a TARDIS sound for the player and surrounding players at the current location. * * @param l The location * @param s The sound to play */ public static void playTARDISSound(Location l, String s) { l.getWorld().playSound(l, s, VOLUME, 1.0f); }
private void abort() { running = false; pedestals.forEach((pblock)->{ Variables.altarinuse.remove(pblock.getLocation()); }); Variables.altarinuse.remove(altar.getLocation()); // should re-enable altar blocks on craft failure. l.getWorld().playSound(l, Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 5F, 1F); altars.remove(altar); }
public void breakParticles(final int amount) { for (int x = 0; x < amount; x++) { ParticleEffect.ITEM_CRACK.display(new ParticleEffect.ItemData(Material.ICE, (byte) 0), new Vector(((Math.random() - 0.5) * .5), ((Math.random() - 0.5) * .5), ((Math.random() - 0.5) * .5)), 2f, this.location, 255.0); ParticleEffect.SNOW_SHOVEL.display(this.location, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 2); } this.location.getWorld().playSound(this.location, Sound.BLOCK_GLASS_BREAK, 5, 1.3f); }
@Override public void playSound(MCLocation l, MCSound sound, float volume, float pitch) { w.playSound(((BukkitMCLocation) l).asLocation(), ((BukkitMCSound) sound).getConcrete(), volume, pitch); }
@Override public void onRun() { Location location = getLocation(); location.getWorld().playSound(location, sound, 4.0F, (1.0F + (RandomUtils.random.nextFloat() - RandomUtils.random.nextFloat()) * 0.2F) * 0.7F); display(particle1, location); display(particle2, location); }
@Override public void playSound(MCLocation l, String sound, MCSoundCategory category, float volume, float pitch) { w.playSound((Location) l.getHandle(), sound, BukkitMCSoundCategory.getConvertor().getConcreteEnum(category), volume, pitch); }
@Override public void playSound(MCLocation l, MCSound sound, MCSoundCategory category, float volume, float pitch) { w.playSound((Location) l.getHandle(), ((BukkitMCSound) sound).getConcrete(), BukkitMCSoundCategory.getConvertor().getConcreteEnum(category), volume, pitch); }
public static void worldSendSound(World world, Location location, SoundType soundType) { if(SoundConfig.getInstance().getIsEnabled(soundType)) world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType)); }
@Override public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) { if (SlimefunManager.isItemSimiliar(item, SlimefunItems.PORTABLE_CRAFTER, true)) { p.openWorkbench(p.getLocation(), true); p.getWorld().playSound(p.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1); return true; } else return false; } });
@Override public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) { if (SlimefunManager.isItemSimiliar(item, SlimefunItems.SPLINT, true)) { PlayerInventory.consumeItemInHand(p); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_SKELETON_HURT, 1, 1); p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 0)); return true; } else return false; } });
@Override public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) { if (SlimefunManager.isItemSimiliar(item, SlimefunItems.ENDER_BACKPACK, true)) { e.setCancelled(true); p.openInventory(p.getEnderChest()); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1, 1); return true; } else return false; } });
@Override public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) { if (SlimefunManager.isItemSimiliar(item, SlimefunItems.MAGIC_SUGAR, true)) { PlayerInventory.consumeItemInHand(p); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_GENERIC_EAT, 1, 1); p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 600, (Integer) Slimefun.getItemValue("MAGIC_SUGAR", "effects.SPEED"))); return true; } else return false; } });
public void click() { if (!this.player.isSneaking()) { return; } this.player.getLocation().getWorld().playSound(this.player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1); this.player.getLocation().getWorld().playSound(this.player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1); this.player.getLocation().getWorld().playSound(this.player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1); ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(this.headData.getItemType(), this.headData.getData()), 0.1F, 0.1F, 0.1F, 1, 32, this.player.getEyeLocation(), 128); ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(this.legsData.getItemType(), this.legsData.getData()), 0.1F, 0.1F, 0.1F, 1, 32, this.player.getLocation(), 128); this.bPlayer.addCooldown(this); this.remove(); }
@Override public void run() { if (livingEntity.isValid()) { Location location = livingEntity.getLocation(); location.getWorld().playSound(location, Sound.BLOCK_FIRE_EXTINGUISH, 0.8F, 0.8F); ParticleEffectUtils.playCallOfTheWildEffect(livingEntity); CombatUtils.dealDamage(livingEntity, livingEntity.getMaxHealth(), DamageCause.SUICIDE, livingEntity); } TamingManager.removeFromTracker(this); this.cancel(); }
@Override public void run() { if (tempBlock != null) { ParticleEffect.SMOKE.display(tempBlock.getBlock().getLocation().clone().add(0.5, 1, 0.5), 0.1F, 0.1F, 0.1F, 0.01F, 3); if (HeatControl.this.randy.nextInt(3) == 0) { tempBlock.getBlock().getWorld().playSound(tempBlock.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 0.5F, 1); } LavaFlow.removeBlock(tempBlock.getBlock()); } } }.runTaskLater(ProjectKorra.plugin, 20);
@Override public PowerResult<Void> fire(Player player, ItemStack stack) { if (!checkCooldown(this, player, cooldown, true, true)) return PowerResult.cd(); if (!getItem().consumeDurability(stack, cost)) return PowerResult.cost(); Location location = player.getLocation(); location.getWorld().playSound(location, sound, volume, pitch); return PowerResult.ok(); } }
@Override public void setItemStack(MCItemStack stack) { ItemStack is = (ItemStack) stack.getHandle(); e.setCancelled(true); e.getItem().remove(); if(is != null && !is.getType().equals(Material.AIR)) { ((Player) e.getEntity()).getInventory().addItem(is); //and for added realism :) e.getEntity().getWorld().playSound(e.getItem().getLocation(), Sound.ENTITY_ITEM_PICKUP, 1, 2); } }