[Resource] Simple Scoreboard Manager (Supports 1.7 Objecives)

Discussion in 'Resources' started by Goblom, Nov 22, 2013.

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

    Goblom

    Hey guys. Scoreboards are hard to learn and create correctly the first time, so i created this nifty little (not really) class that can make creating scoreboards and setting a players scoreboard extremely easy and simple. This resource is fairly new so if you have any problems with it or encounter any bugs don't hesitate to say something :)

    Class: https://github.com/Goblom/Bukkit-Li.../java/org/goblom/bukkitlibs/BoardManager.java

    The cool thing about this ScoreBoard manager that sets it apart for other ones like this is that this has support for the new criterias that were introduced in 1.7 :D But since Bukkit/CraftBukkit has not yet updated they don't yet work :(

    Here is how you use this
    Since i want to show you how easy this is, I will be doing the same thing that this post is doing in its example, but making it 100 times easier to do.
    Code:java
    1. /**
    2.  * Display a players Health under their name
    3.  */
    4. BoardManager showHealth = new BoardManager("showHealth", "/ 20", DisplaySlot.BELOW_NAME);
    5.  
    6. for (Player player : Bukkit.getOnlinePlayers() {
    7. showHealth.changeCriteria(BoardManager.ObjectiveCriteria.HEALTH);
    8. showHealth.setScorboard(player);
    9. }

    Code:java
    1. /**
    2.  * Display a Score under a players Name
    3.  */
    4. BoardManager showLives = new BoardManager("showLives", "lives", DisplaySlot.BELOW_NAME);
    5.  
    6. for (Player online : Bukkit.getOnlinePlayers()) {
    7. showLives.setObjectiveScore(online.getName(), 5);
    8. showLives.setScoreboard(online);
    9. }
     
  2. Offline

    Waffletastic

    Why doesn't this have any replies? You just saved me a lot of work! ..I love you.
     
    Goblom likes this.
  3. Offline

    ccrama

    Awesome :D

    Edit: is there any easy way to change the title of the scoreboard with your manager, as I would be using it in a runnable to change the title every second.?
     
  4. Offline

    Goblom

    ccrama At the moment, no. But, i can add support for that in a few days.

    Edit: I added Support BoardManager.setScoreboardName(String name);
     
    ccrama likes this.
  5. Offline

    Ultimate_n00b

    It's not bad, I like it.
     
    Goblom likes this.
  6. Offline

    SoThatsIt

    Goblom when i remove a players scoreboard and then set it again the scoreboard does not show up. i am thinking it is because of the method i added to the board manager class to remove a player from the scoreboard. if you could take a look and see whats wrong that would be great!

    Code:
    //on player joining arena
    scoreboard.addObjectiveScore(player.getName() , 0);
    scoreboard.setScoreboard(player.getPlayer());
     
    //on player leaving arena
    scoreboard.removeScores(player.getName());
    scoreboard.removeScoreboard(player.getPlayer() , true);
     
    //remove scores method
    public void removeScores(String scoreName)
    {
        this.scoreBoard.resetScores(Bukkit.getOfflinePlayer(scoreName));
    }
     
  7. Offline

    Goblom

    SoThatsIt It might be, but it also might be the fact that i never remove players from the Player List when using removeScoreboard(Player player, boolean blank);

    If you wouldn't mind posting more code i might be able to help fix the problem (and also to test BoardManager with your code) (You can also send the code in a pm if you would prefer that more)
     
  8. Offline

    SoThatsIt

    i know the set and remove scoreboard methods are being called, i might add that it removes players from the list in removescoreboard see if that changes anything

    Edit: added that they are removed from the list, still doesnt show the scoreboard the second time
     
Thread Status:
Not open for further replies.

Share This Page