[1.8.8] Scoreboard using AsyncRepeatingTask

Discussion in 'Spigot Plugin Development' started by TheDaChicken, Jun 6, 2017.

  1. Hello, I am making a custom game, Sorry but... I am getting this error. I am trying to make a Repeating Task with Scoreboard.

    Scoreboard Class: Scoreboard.class

    ERROR: ERROR

    I tried and tried fixing this error
    Can someone help me fix this error. Please Give me a Example with the code to fix.
     
  2. I think you didn't update the variable (lobbyobjective)
    [​IMG]
     
    • Useful Useful x 1
    • Funny Funny x 1
  3. Oh... Also, uhmmm I check 3 times but... Also, I am trying to Check if there is more then 1 people online it would change the Display Name It is not working can you check if there a problem. Sorry I check like 3 times

    UPDATED Scoreboard.class: https://pastebin.com/TdW2LUpU
     
  4. Did you set the scoreboard for the player when there is more than 1 people online?
    [​IMG]
    Sorry I edit it in Notepad++

    Code (Text):
    Objective lobbyobjective = scoreboardlobby.getObjective("Lobby");
                                if(Config.getDataYaml.getInt("scoreboardtimer") == 0) {
                                    if(timer < 31) {      
                                        player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
                                        Config.getDataYaml.set("scoreboardtimer", timer);
                                        try {
                                            Config.getDataYaml.save(Config.getDataConfig);
                                        } catch (IOException e) {
                                            e.printStackTrace();
                                        }
                                        if(timer > 4) {
                                            lobbyobjective.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + timer + " Seconds untill game starts!");
                                        } else {
                                            lobbyobjective.setDisplayName(ChatColor.GREEN + "" + ChatColor.BOLD + timer + " Seconds untill game starts!");
                                        }
                                        timer--;
                                        lobbyobjective.setDisplaySlot(DisplaySlot.SIDEBAR);
                                        player.setScoreboard(scoreboardlobby);
                                    }
                                }
     
    • Agree Agree x 1
  5. @AnhCraft I did.... but.... With your code The Title of the scoreboard is still not changing. Sorry :eek:
     
    #6 TheDaChicken, Jun 6, 2017
    Last edited: Jun 7, 2017