Solved Server keeps crashing upon player join!

Discussion in 'Spigot Plugin Help' started by WaffleCake, Jun 1, 2017.

Thread Status:
Not open for further replies.
  1. Right so I have been making a plugin using eclipse and it shows no errors what so ever within eclipse. I'm new to Java and don't quite know whats wrong with it. When I load it on the server it appears fine but as soon as a player logs in it crashes.

    The purpose of the plugin is simply to display an action bar message using ActionBarAPI which displays a players level. Here is the code in my EventsClass class:

    Here are the console logs:
  2. Do not use while loops, make a new class extending BukkitRunnable and do this in your main class:
    Bukkit.getScheduler().runTaskTimerAsynchronously(this, new LevelNotifierTask(), 20l, 20l);
    • Agree Agree x 1
  3. Mh... the error comes from the ActionBareAPI line 69.

    Can you give a link to the API that you are using? There a many ActionBarsAPI's :D
  4. The while loop is your problem. Its infinitely looping through it in one tick, the tick that the player logs in.
    Look into the bukkit scheduler, set up a repeating task, like @Bence990707 just suggested. Dont have to create your own class extending runnable though, you can do it all in the same class simply using "new Runnable(){ code }", theres plenty of examples online.
  5. You can use new BukkitRunnables as you want, it was my example and personally i dont really like to use anonymous classes
    • Like Like x 1
  6. Oh... yeah.. they are right.. you are using a 'infinit' loop if the playerlevel is greater than or euqal 1... Lel :D Haven't seen that. XD
  7. Thanks ill try that now :)
  8. Thanks for the help it works fine now :D
  9. ;)
    Be sure to mark as solved
Thread Status:
Not open for further replies.