Solved Play Sounds

Discussion in 'Spigot Plugin Development' started by BabyxSparklez., Nov 11, 2018.

  1. I am wondering why I would get EXPERIENCE_PICKUP cannot be resolved or is not a field.
    Version 1.9-1.13

    p.playSound(p.getLocation(), Sound.EXPERIENCE_PICKUP, 2.0F, 1.0F);
  2. Code (Java):
    import org.bukkit.Sound;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;

    import me.dyn4micuniverse.JEP;

    public class JoinSound implements Listener {
          private JEP plugin;
          public JoinSound(JEP plugin)
            this.plugin = plugin;
          public void JoinSounds(PlayerJoinEvent e)
            FileConfiguration config = this.plugin.getConfig();
            Player p = e.getPlayer();
                if (!config.getString("JoinSound").contains("NONE")) {
                    if (config.getString("JoinSound").contains("ANVIL")) {
                    p.playSound(p.getLocation(), Sound.ANVIL_BREAK, 2.0F, 1.0F);
                    } else if (config.getString("JoinSound").contains("ORB")) {
                     p.playSound(p.getLocation(), Sound.ORB_PICKUP, 2.0F, 1.0F);
                    } else if (config.getString("JoinSound").contains("DOOR")) {
                    p.playSound(p.getLocation(), Sound.TRAPDOOR_OPEN, 2.0F, 1.0F);
    Unfortunately it still did not fix the error.
    Also, where could I get sounds because I found it here
  3. Hello,
    You see all sounds list when you do Sounds.[ctrl+space]
  4. Finally, I have been wondering how to do that. It has happened multiple times on accident but I need it. Thanks.

    Also, that fixed the errors, I just have to use the sounds from that list.

Share This Page