Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. //Name: PlayerScoreboard
  2.  
  3.  
  4. package net.ventymc.lobbysystem.scoreboard;
  5.  
  6. import java.util.HashMap;
  7.  
  8. import org.bukkit.entity.Player;
  9.  
  10. public class PlayerScoreboard
  11. {
  12. private HashMap<Integer, String> lines;
  13. private PacketScoreboard packetScoreboard;
  14. private String title;
  15.  
  16. public PlayerScoreboard(final Player player) {
  17. this.lines = new HashMap<Integer, String>();
  18. this.packetScoreboard = new PacketScoreboard(player);
  19. }
  20.  
  21. public void sendTitle() {
  22. this.packetScoreboard.sendSidebar(this.title);
  23. }
  24.  
  25. public void setup() {
  26. this.packetScoreboard.remove();
  27. this.sendTitle();
  28. for (final int score : this.lines.keySet()) {
  29. final String line = this.lines.get(score);
  30. this.packetScoreboard.setLine(score, line);
  31. }
  32. }
  33.  
  34. public void remove() {
  35. this.packetScoreboard.remove();
  36. }
  37.  
  38. public void setLine(final int line, final String text) {
  39. if (this.lines.containsKey(line)) {
  40. this.packetScoreboard.removeLine(line);
  41. }
  42. this.lines.put(line, text);
  43. this.packetScoreboard.setLine(line, text);
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement