Help With Showing Online Staff (Scoreboard)

Discussion in 'Plugin Development' started by THESABERSLAYER, Jan 28, 2014.

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

    THESABERSLAYER

    Hey everyone so I am trying to make a plugin that shows the online staff for a server and I am not doing it right since nothing is happening. Here is my code: http://pastebin.com/uwJY8YW9
    Any help would be great thanks! :)
     
  2. Offline

    STORM2354

    Any help would be great! Having the same issue!
     
  3. Offline

    beastman3226

    The only problem is that you don't add the staff members to the scoreboard.
     
  4. Offline

    THESABERSLAYER

    beastman3226 okay then is it possible to add the staff members that are OP?
     
  5. Offline

    GaaTavares

    if (p.isOp()){
    // do stuff
     
  6. Offline

    THESABERSLAYER

    GaaTavares ok but where would I put in my code?
     
  7. Offline

    GaaTavares

    Lol do you know what you are doing?
     
  8. Offline

    THESABERSLAYER

  9. Offline

    Desle

    THESABERSLAYER
    Here's how i did my scoreboard

    Code:
            ScoreboardManager manager = Bukkit.getScoreboardManager();
            Scoreboard board = manager.getNewScoreboard();
            Objective objective = board.registerNewObjective("Bounty", "dummy");
            objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
            objective.setDisplayName("Bounty");
            Team bounted = board.registerNewTeam("red");
            bounted.setPrefix(ChatColor.DARK_RED + "");
            for(Player online : Bukkit.getOnlinePlayers()){
                objective.getScore(online).getScoreboard().resetScores(online);
                Score score = objective.getScore(online);
                score.setScore(getbounties().getInt(online.getName() + ".bounty"));
                online.setScoreboard(board);
            }
     
  10. Offline

    THESABERSLAYER

    Desle thanks so in that where would I put my if p.isOp?
     
  11. Offline

    Desle

    THESABERSLAYER
    If you do it like this, ops will get a red name:

    Code:
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard board = manager.getNewScoreboard();
        Objective objective = board.registerNewObjective("Bounty", "dummy");
        objective.setDisplaySlot(DisplaySlot.PLAYER_LIST);
        objective.setDisplayName("Bounty");
        Team bounted = board.registerNewTeam("red");
        bounted.setPrefix(ChatColor.DARK_RED + "");
        for(Player online : Bukkit.getOnlinePlayers()){
            if (online.isOp()) {
                bounted.addPlayer(online);
            }
            online.setScoreboard(board);
        }
    I have to go now, i'm sure you can figure it out man, good luck ;)
     
  12. Offline

    Ad237

    1. You are creating a new scoreboard per player. You need to create one scoreboard, loop through ops and add them, then loop through all players and set the scoreboard.
    2. Your setting the scoreboard before you add people to the scoreboard.
    3. Why are you using board.getObjective() when you already have an objective object to work with?
     
  13. Offline

    THESABERSLAYER

Thread Status:
Not open for further replies.

Share This Page