Solved scoreboard using config (simple)

Discussion in 'Plugin Development' started by HenkDeKipGaming, Jun 18, 2015.

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

    HenkDeKipGaming

    hey, i have been searching around for making a simple scoreboard, but they all make it too hard!
    i just want a scoreboard that appears when the player joins, and it has a name. and it has some text in it. i just want to know the absolute basics and just make it work with just text.
    can someone help me with some example code maybe?

    please? anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  2. Offline

    ShadowLAX

  3. Offline

    HenkDeKipGaming

    hey, i saw that, but that is in little pieces, i'm not english, so it's hard to understand.
    isn't there an example code somewhere you know? so i can copy that into my coe and it just works straight away?
    because then i can study how it works and really learn how to modify everything of it.
     
  4. Offline

    WingedMLGPro

    Code:
    public static void updateScoreboard(Player player){
    ScoreboardManager manager = Bukkit.getScoreboardManager();
          Scoreboard scoreboard = manager.getNewScoreboard();
    
          Objective obj = scoreboard.registerNewObjective("Board", "dummy");
          obj.setDisplaySlot(DisplaySlot.SIDEBAR);
          obj.setDisplayName("NameOfScoreboard");
    
          Score score = obj.getScore("WHat you want in the scoreboard");
          score.setScore(SetAnIntForWhatYouWantInTheScoreboard);
    
          player.setScoreboard(scoreboard);
    }
    Then when u want to update the scoreboard u just use (classwithscoreboardvoid).updateScoreboard(Player);
    NOTE: this will make it so when u update it, the scoreboard wont blink, DONT PUT IT INTO A SCHEDULER OR IT WILL BLINK!
     
  5. Offline

    HenkDeKipGaming

    thank you! i'll try that :)
     
  6. Offline

    WingedMLGPro

  7. Offline

    HenkDeKipGaming

    i'm at school right now, i test it later, then i'll tell if it works :)
    thanks for your reply btw :D
     
  8. Offline

    WingedMLGPro

  9. Offline

    HenkDeKipGaming

    Haha sorry, really busy :p i will check it haha
     
  10. Offline

    WingedMLGPro

  11. Offline

    HenkDeKipGaming

    well, i was just looking at it, but it doesn't work....
    what i want, is a scoreboard that shows something from the config
     
  12. Offline

    WingedMLGPro

  13. Offline

    HenkDeKipGaming

    @WingedMLGPro i can't use a config that simple i gues..
    Code:
    public static void updateScoreboard(Player player){
                ScoreboardManager manager = Bukkit.getScoreboardManager();
                     Scoreboard scoreboard = manager.getNewScoreboard();
            
                     Objective obj = scoreboard.registerNewObjective("Board", "dummy");
                     obj.setDisplaySlot(DisplaySlot.SIDEBAR);
                     obj.setDisplayName("Kingdom points:");
            
                     Score score = obj.getScore("kingdom:");
                     score.setScore(getConfig().getString("groups.kingdom.vystaraPoints")); //error on getconfig() and on setscore
            
                     player.setScoreboard(scoreboard);
                }
    
    there is an error on error on getconfig() and on setscore
    @timtower do you know how to do this? it sees the getconfig stuff as an object. do you know how to do this? i just want to show something from the config in there

    SOLVED - google is my best friend
    Code:
    ScoreboardManager manager = Bukkit.getScoreboardManager();
                 Scoreboard scoreboard = manager.getNewScoreboard();
             
                 Objective obj = scoreboard.registerNewObjective("Board", "dummy");
                 obj.setDisplaySlot(DisplaySlot.SIDEBAR);
                 obj.setDisplayName("Kingdom points:");
                 
                 Score score = obj.getScore("Vystara: ");
                 score.setScore(getConfig().getInt("groups.kingdom.vystaraPoints"));
                 e.getPlayer().setScoreboard(scoreboard);
            }
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  14. Offline

    BlueMustache

    @ShadowLAX
    It has been a while since I have been on these here forums.
    I am wanting to develop plugins again.
    I do however not remember how to create a thread like this.
    Where do I go, and what do I click to start a thread?


    @HenkDeKipGaming
    Sorry for mooching on your thread. Hope you understand. :D
     
  15. Offline

    HenkDeKipGaming

Thread Status:
Not open for further replies.

Share This Page