/** * Plays the sound to the given player at the given location. * * @param player Player to which to play the sound * @param location Location at which to play the sound */ public void playTo(Player player, Location location) { player.playSound(location, sound, volume, pitch); } }
@Override public void pulse() { super.pulse(); if (getInvulnerableTicks() > 0) { setInvulnerableTicks(getInvulnerableTicks() - 1); if (ticksLived % 10 == 0) { setHealth(getHealth() + 10); } if (getInvulnerableTicks() == 1) { getWorld().createExplosion(getLocation(), Explosion.POWER_WITHER_CREATION); for (Player player : getServer().getOnlinePlayers()) { player.playSound(player.getLocation(), Sound.ENTITY_WITHER_SPAWN, 1.0f, 1.0f); } } } else if (ticksLived % 20 == 0) { setHealth(getHealth() + 1); } }
@Override public void onOpen(Player p) { p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_HAT, 0.7F, 0.7F); } });
@Override public void onOpen(Player p) { p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 0.7F); } });
@Override public void onOpen(Player p) { p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F); } });
@Override public void onOpen(Player p) { p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 0.7F); } });
public void broadcastSound(Sound sound, float volume, float pitch, List<Player> players) { for (Player p : players) { if (p.isOnline()) { p.playSound(p.getLocation(), sound, volume, pitch); } } }
@Override public void execute(Player player) { if (errorMessage != null) { player.sendMessage(errorMessage); return; } player.playSound(player.getLocation(), sound, volume, pitch); }
private void changeToOldShop(Game game, Player player) { game.getPlayerSettings(player).setUseOldShop(true); player.playSound(player.getLocation(), SoundMachine.get("CLICK", "UI_BUTTON_CLICK"), Float.valueOf("1.0"), Float.valueOf("1.0")); // open old shop MerchantCategory.openCategorySelection(player, game); }
private void changeToOldShop(Game game, Player player) { game.getPlayerSettings(player).setUseOldShop(true); player.playSound(player.getLocation(), SoundMachine.get("CLICK", "UI_BUTTON_CLICK"), Float.valueOf("1.0"), Float.valueOf("1.0")); // open old shop MerchantCategory.openCategorySelection(player, game); }
@Override public void playSound(MCLocation l, String sound, MCSoundCategory category, float volume, float pitch) { p.playSound((Location) l.getHandle(), sound, BukkitMCSoundCategory.getConvertor().getConcreteEnum(category), volume, pitch); }
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier) { float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier)); if(SoundConfig.getInstance().getIsEnabled(soundType)) player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch); }
public static void play(Player player, int octave, Tone tone) { Sound s = null; try { s = Sound.valueOf("NOTE_PIANO"); } catch (Exception e) { s = Sound.valueOf("BLOCK_NOTE_HARP"); } player.playSound(player.getEyeLocation(), s, 1, NotePitch.getPitch(octave, tone)); }
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory) { if(SoundConfig.getInstance().getIsEnabled(soundType)) player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType)); }
/** * Sends a sound to the player * @param soundType the type of sound */ public static void sendSound(Player player, Location location, SoundType soundType) { if(SoundConfig.getInstance().getIsEnabled(soundType)) player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType)); }
@Override public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) { if (SlimefunManager.isItemSimiliar(item, SlimefunItems.PORTABLE_DUSTBIN, true)) { e.setCancelled(true); p.openInventory(Bukkit.createInventory(null, 9 * 3, ChatColor.DARK_RED + "Delete Items")); p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 1, 1); return true; } else return false; } });
@Override public void play (Note note) { if (p == null || !p.isOnline()) p = Bukkit.getPlayerExact(player); if (p == null || !p.isOnline() || note == null) return; p.playSound(p.getLocation(), toSound(note.getInstrument()), note.getVelocity(), note.getNote()); }
@Override @SuppressWarnings("deprecation") 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(); player.playSound(player.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f); Events.registerRPGProjectile(this.getItem(), stack, player); SmallFireball entity = player.launchProjectile(SmallFireball.class); entity.setPersistent(false); return PowerResult.ok(); }
@Override public PowerResult<Void> rightClick(Player player, ItemStack stack, PlayerInteractEvent event) { if (!checkCooldown(this, player, cooldown, true, true)) return PowerResult.cd(); if (!getItem().consumeDurability(stack, cost)) return PowerResult.cost(); player.playSound(player.getLocation(), Sound.ENTITY_ARROW_SHOOT, 1.0f, 1.0f); Events.registerRPGProjectile(this.getItem(), stack, player); TippedArrow arrow = player.launchProjectile(TippedArrow.class); arrow.addCustomEffect(new PotionEffect(type, duration, amplifier), true); Events.autoRemoveProjectile(arrow.getEntityId()); return PowerResult.ok(); }