Solved playsound error at Listener

Discussion in 'Spigot Plugin Development' started by PistoFrancoPuumm, Jun 30, 2016.

  1. Hello i have a problem in my code... the playsound give me an error:

    Code (Text):
        public void onPlayerJoin(PlayerJoinEvent e){
            Player p = e.getPlayer();
            Location loc = p.getLocation();
            p.sendTitle(ChatColor.DARK_PURPLE+""+ChatColor.BOLD+"<<"+ChatColor.GOLD+" War of ZI"+ChatColor.YELLOW+" >>",ChatColor.YELLOW+"Welcome: "+ChatColor.AQUA+""+ChatColor.BOLD+p.getName());
            p.playSound(loc, Sound.LEVEL_UP, 1, 1);
    But when i remove:

    Code (Text):

    p.playSound(loc, Sound.LEVEL_UP, 1, 1);
    the console don't give me any errors...

    Here comes the error....


    Can you help me?
    Thank you :D
    #1 PistoFrancoPuumm, Jun 30, 2016
    Last edited: Jun 30, 2016
  2. Wait, you're saying you get that error when you remove that line, but you don't get an error when you leave that line in?
  3. I would guess you are using a different spigot API version to the version of your server. Make sure you are using the most recent spigot API and server.
    • Agree Agree x 1
    • Useful Useful x 1
  4. no, when i leave the line i get the error but when i remove the line, i don't get it...
  5. Ohhhh, sorry I misread. My best guess is that the Spigot version you are using as a dependancy in your IDE and the version you are running for your server are different.
    • Useful Useful x 1
  6. fairly certain 1.9 removed the LEVEL_UP constant. You're compiling against 1.8
    • Useful Useful x 1
  7. oh crap... you guess right!... i writed this in the 1.8.8 and the server is the 1.9.2
  8. It's because you are using a different spigot version.