Updating Scoreboard

Discussion in 'Spigot Plugin Development' started by DidactCraft, Jun 7, 2015.

  1. Ok I have been trying to create a scoreboard for kills/deaths/players online ext. and I want it to update every 5 seconds so that if a player kills a player it updates that players amount of kills! :) I have tried a bukkit scheduler (repeating task) and still has not worked!

    Heres a extract >>
    Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    public void run() {
    }, 20L, 20L);
  2. Can we please have more information like the full class? Where is score being set? Also, what isn't working exactly?
  3. Can you please past your code inside the
    tags? No one wants to read a class like that.
  4. you scheduler is set to 20L, 20L which means that the scheduler start after 1 second and reloads every second (20L = 1 second) just do 5*20L or just use 100L, if thats what's the problem
  5. Instead updating the whole scoreboard synchronized, update the objectives asynchronous.
    • Agree Agree x 1
  6. For the simple thingy, why making a scheduler? Just set a make a method which contains a scoreboard with kills/deaths and call it when a player dies / kills (playerdeathevent). And call it when a player joins.
  7. try make a bukkit scheduler and then do:
    Code (Text):
    (i dont know if that will work but try it out)
  8. [​IMG]
    • Winner Winner x 5
    • Funny Funny x 1