Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Name: PlayerScoreboard
- package net.ventymc.lobbysystem.scoreboard;
- import java.util.HashMap;
- import org.bukkit.entity.Player;
- public class PlayerScoreboard
- {
- private HashMap<Integer, String> lines;
- private PacketScoreboard packetScoreboard;
- private String title;
- public PlayerScoreboard(final Player player) {
- this.lines = new HashMap<Integer, String>();
- this.packetScoreboard = new PacketScoreboard(player);
- }
- public void sendTitle() {
- this.packetScoreboard.sendSidebar(this.title);
- }
- public void setup() {
- this.packetScoreboard.remove();
- this.sendTitle();
- for (final int score : this.lines.keySet()) {
- final String line = this.lines.get(score);
- this.packetScoreboard.setLine(score, line);
- }
- }
- public void remove() {
- this.packetScoreboard.remove();
- }
- public void setLine(final int line, final String text) {
- if (this.lines.containsKey(line)) {
- this.packetScoreboard.removeLine(line);
- }
- this.lines.put(line, text);
- this.packetScoreboard.setLine(line, text);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement