[1.8.8] Scoreboard using AsyncRepeatingTask

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

  1. Hi, uhmmm I am getting this problem on Scoreboard with the AsyncRepeatingTask.

    What I am trying to do is to change the title of the Scoreboard when there is more then 1 people online and it's not working. I check 3 times and it is going to be easy to found what the problem is. I am not great at finding stuff.

    Scoreboard.class: https://pastebin.com/vZbV6TZx

    Can you give me examples to fix the problem please? Please!:eek:... idk
     
  2. @Dies
    Just Saying,

    I have ...
    Code (Text):
     static int PlayerNumberList;
    and it changes from null to the
    Code (Text):
     PlayerNumberList = Bukkit.getOnlinePlayers().size();
    and if that was not works how to this working
    Code (Text):
    if(PlayerNumberList != Bukkit.getOnlinePlayers().size()) {
                                scoreboardlobby.resetScores(ChatColor.AQUA + "" + ChatColor.BOLD + PlayerNumberList + "/" + "20");
                                Score PlayerNumber = lobbyobjective.getScore(ChatColor.AQUA + "" + ChatColor.BOLD + Bukkit.getOnlinePlayers().size() + "/" + "20");
                                PlayerNumber.setScore(13);
                                PlayerNumberList = Bukkit.getOnlinePlayers().size();
                                }
    If that is working then the number variable Number will work
     
  3. Everything is static and you should not be using non thread safe code, in a separate thread.
     
  4. Abusing static.... Do you even know what it means and does?
    Also your scoreboard is going to flicker and cause some lagg if you have alot of people on. I suggest to use teams instead of wiping the whole scoreboard and set it(Hint: take a look at my signature) ^^.
     
  5. What? I meant don't do this:
    Code (Text):
    int Variable
    instead use
    Code (Text):
    int variable
     
  6. @Dies Oh... lol


    but... The Problem is about the number variable

    the number variable is in lower case

    @TheBlackTeddy I know what static is. Eclipse wanted me to use it

    @EvanTheSurfer Eclipse wanted me to use static on numbers

    The Problem is on the number variable
     
    #7 TheDaChicken, Jun 8, 2017
    Last edited: Jun 8, 2017