Bugg with scoreboard!?

Discussion in 'Plugin Development' started by jusjus112, Feb 7, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    jusjus112

    Hey guys, i dont know if you guys have a bugg too. But i maybe have.
    Im using MC1.8 #23

    But, it happend with my scoreboard. I use this code:
    Code:
    board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + Integer.toString(CountDown.gameSBTimerMinuts+1) + ":" + Integer.toString(CountDown.gameSBTimerSeconds+1)));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + Integer.toString(CountDown.gameSBTimerMinuts-1) + ":" + Integer.toString(CountDown.gameSBTimerSeconds-1)));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + Integer.toString(CountDown.gameSBTimerMinuts) + ":" + Integer.toString(CountDown.gameSBTimerSeconds)));
                createScore(ChatColor.AQUA + "Ends over:", 8);
                createScore(ChatColor.GRAY + Integer.toString(CountDown.gameSBTimerMinuts) + ":" + Integer.toString(CountDown.gameSBTimerSeconds), 7);
    And it dont reset my scores. It is like this:
    [​IMG]

    I hope you guys can help me :D
     
  2. Offline

    pie_flavor

    @jusjus112 In the Bukkit API, it is almost never a bug and usually user error. Could you please post your whole code.
     
  3. Offline

    jusjus112

    @pie_flavor

    Oke, right. ........ Here ya go.
    Code:
        public void createScoreBoard() {
            board = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
           
            red = board.registerNewTeam("red");
            blue = board.registerNewTeam("blue");
           
            red.setPrefix(ChatColor.RED + "[R]");
            blue.setPrefix(ChatColor.BLUE + "[B]");
           
            red.setAllowFriendlyFire(false);
            blue.setAllowFriendlyFire(false);
           
            red.setCanSeeFriendlyInvisibles(true);
            blue.setCanSeeFriendlyInvisibles(true);
           
            o = board.registerNewObjective("test", "dummy");
           
            o.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Your Stats");
            o.setDisplaySlot(DisplaySlot.SIDEBAR);
           
            updateScoreboard();
        }
    
        @SuppressWarnings("deprecation")
        public static void updateScoreboardTimerGame() {
            if (Main.isIngame == true) {
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + "00:-1"));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + "00:0"));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.LIGHT_PURPLE + "Starts in:"));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.AQUA + "Ends over:"));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + Integer.toString(CountDown.gameSBTimerMinuts+1) + ":" + Integer.toString(CountDown.gameSBTimerSeconds+1)));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + Integer.toString(CountDown.gameSBTimerMinuts-1) + ":" + Integer.toString(CountDown.gameSBTimerSeconds-1)));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + Integer.toString(CountDown.gameSBTimerMinuts) + ":" + Integer.toString(CountDown.gameSBTimerSeconds)));
                createScore(ChatColor.AQUA + "Ends over:", 8);
                createScore(ChatColor.GRAY + Integer.toString(CountDown.gameSBTimerMinuts) + ":" + Integer.toString(CountDown.gameSBTimerSeconds), 7);
            }else if (Main.isInLobby == true) {
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GOLD + "LobbyTimer"));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + "00:" + Integer.toString(CountDown.lobbyTimer+1)));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + "00:" + Integer.toString(CountDown.lobbySBTimer-1)));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + "00:" + Integer.toString(CountDown.lobbySBTimer+1)));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + "00:" + Integer.toString(CountDown.lobbySBTimer)));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + "00:0"));
                board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY + "00:-1"));
                createScore(ChatColor.LIGHT_PURPLE + "Starts in:", 8);
                createScore(ChatColor.GRAY + "00:" + Integer.toString(CountDown.lobbyTimer), 7);
            }
        }
    The code under Main.isIngame == true is bugged. But with the false statement is it all good.
     
  4. Offline

    pie_flavor

    @jusjus112 FYI: Booleans don't need an ==.
    Code:
    if (Main.isIngame)
    Other than that, why don't you try logging a list of the players on the scoreboard, along with the current time, and make sure that the player it's trying to remove is actually on the scoreboard.
     
  5. Offline

    jusjus112

    @pie_flavor
    Im sorry. but i dont know what you are meaning. Can you give me a example?
     
  6. Offline

    q8minecraft

    @jusjus112 Simply, remove and readd the score over time. Should work.
     
  7. Offline

    nuno1212sss

    board.resetScores(Bukkit.getOfflinePlayer(ChatColor.GRAY+Integer.toString(CountDown.gameSBTimerMinuts+1)+":"+Integer.toString(CountDown.gameSBTimerSeconds+1)));

    The first integer isn't always decreased only when a minute passes so it isn't going to reset that
     
Thread Status:
Not open for further replies.

Share This Page