Advertisement
Guest User

Untitled

a guest
Mar 31st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. // id make this an instance variable, as youd want every player on the
  2. // same scoreboard to see the teams.
  3. Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
  4. // use the dummy criteria
  5. Objective objective = scoreboard.registerNewObjective("Name", "dummy");
  6. // set the the sidebar, you dont need this if you dotn want to display
  7. // scores on the right of their screen.
  8. objective.setDisplaySlot(DisplaySlot.SIDEBAR);
  9.  
  10. // time to add scores
  11. // Use the scores to position your entries, makes stuff nicer, you also
  12. // have a 40 char limit if you go this route
  13. // otherwise you can use Teams, and use 16 * 3 (prefix, name, suffix) to
  14. // get a total of 48 chars.
  15. objective.getScore("Team A Kills: 10").setScore(7);
  16. // This here, will create a blank line. Scores must be unique so i use
  17. // different chat colors.
  18. objective.getScore(ChatColor.GREEN.toString()).setScore(6);
  19. objective.getScore("Team B Kills: 5").setScore(5);
  20. objective.getScore(ChatColor.BLUE.toString()).setScore(4);
  21. objective.getScore("Team C Kills: 3").setScore(3);
  22. objective.getScore(ChatColor.RED.toString()).setScore(2);
  23. objective.getScore("Team D Kills: 1").setScore(1);
  24.  
  25. // Create a team
  26. Team teamA = scoreboard.registerNewTeam("Team_A");
  27. // here is where we can set the tags, you dont need text an empty
  28. // chatcolor will work.
  29. teamA.setPrefix(ChatColor.RED + "[Sweg]" + ChatColor.RESET);
  30.  
  31. // add the player to the team, make sure to remove upon leave and re-add
  32. // upon join to eliminate problems with name changes.
  33. teamA.addEntry(player.getName());
  34.  
  35. // lastly set them to the board.
  36. player.setScoreboard(scoreboard);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement