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