public static boolean unrankedSidebarDisplay(Player p, String[] elements) {
    elements = cutUnranked(elements);

    try {
      if (p.getScoreboard() == null
          || p.getScoreboard() == Bukkit.getScoreboardManager().getMainScoreboard()
          || p.getScoreboard().getObjectives().size() != 1) {
        p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
      }

      if (p.getScoreboard().getObjective(p.getUniqueId().toString().substring(0, 16)) == null) {
        p.getScoreboard()
            .registerNewObjective(p.getUniqueId().toString().substring(0, 16), "dummy");
        p.getScoreboard()
            .getObjective(p.getUniqueId().toString().substring(0, 16))
            .setDisplaySlot(DisplaySlot.SIDEBAR);
      }

      p.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(elements[0]);

      for (int i = 1; i < elements.length; i++)
        if (elements[i] != null)
          if (p.getScoreboard().getObjective(DisplaySlot.SIDEBAR).getScore(elements[i]).getScore()
              != 16 - i) {
            p.getScoreboard()
                .getObjective(DisplaySlot.SIDEBAR)
                .getScore(elements[i])
                .setScore(16 - i);
            for (String string : p.getScoreboard().getEntries())
              if (p.getScoreboard()
                      .getObjective(p.getUniqueId().toString().substring(0, 16))
                      .getScore(string)
                      .getScore()
                  == 16 - i) if (!string.equals(elements[i])) p.getScoreboard().resetScores(string);
          }

      for (String entry : p.getScoreboard().getEntries()) {
        boolean toErase = true;
        for (String element : elements) {
          if (element != null
              && element.equals(entry)
              && p.getScoreboard()
                      .getObjective(p.getUniqueId().toString().substring(0, 16))
                      .getScore(entry)
                      .getScore()
                  == 16 - Arrays.asList(elements).indexOf(element)) {
            toErase = false;
            break;
          }
        }

        if (toErase) p.getScoreboard().resetScores(entry);
      }

      return true;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }
Example #2
0
 public void clean() {
   if (!isEmpty()) {
     for (UUID id : this.players.keySet()) {
       Utils.getPlayer(id).setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
     }
   }
 }
Example #3
0
 public Scoreboard Initialize(Player p) throws IllegalStateException, IllegalArgumentException {
   ScoreboardManager manager = Bukkit.getScoreboardManager();
   Scoreboard board = manager.getNewScoreboard();
   Objective objective = board.registerNewObjective("test", "dummy");
   objective.setDisplaySlot(DisplaySlot.SIDEBAR);
   objective.setDisplayName(
       ChatColor.GOLD
           + ""
           + ChatColor.BOLD
           + "     _Esti"
           + ChatColor.DARK_AQUA
           + ""
           + ChatColor.BOLD
           + "Net_     ");
   Score score2 = objective.getScore(ChatColor.DARK_BLUE + "Online:"); // Get a fake offline player
   score2.setScore(4);
   Score score3 =
       objective.getScore(
           ChatColor.BOLD
               + ""
               + Integer.toString(
                   Bukkit.getServer().getOnlinePlayers().size())); // Get a fake offline player
   score3.setScore(3);
   Score score =
       objective.getScore(
           ChatColor.AQUA + "Time before game starts:"); // Get a fake offline player
   score.setScore(2);
   Score score5 =
       objective.getScore(
           ChatColor.BOLD + "" + Basic.countdown + " "); // Get a fake offline player
   score5.setScore(1);
   return board;
 }
Example #4
0
 public XScoreboard(String title, boolean filt) {
   this.title = title;
   this.scores = new HashMap<>();
   this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
   this.scoreboard.registerNewObjective(filterTitle(), "dummy");
   this.scoreboard.getObjective(filterTitle()).setDisplaySlot(DisplaySlot.SIDEBAR);
   this.scoreboard.getObjective(filterTitle()).setDisplayName(title);
 }
Example #5
0
 public boolean removeMember(UUID member) {
   if (!this.players.containsKey(member)) {
     return false;
   }
   this.players.remove(member);
   Utils.getPlayer(member).setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
   updateScoreboard();
   return true;
 }
Example #6
0
  @EventHandler
  public void onJoin(PlayerJoinEvent e) {
    Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();

    Objective objective = scoreboard.registerNewObjective("timers", "dummy");
    objective.setDisplayName("§6Timers");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    e.getPlayer().setScoreboard(scoreboard);
  }
  public static boolean rankedSidebarDisplay(
      Player p, String title, HashMap<String, Integer> elements) {
    try {
      title = cutRankedTitle(title);
      elements = cutRanked(elements);

      if (p.getScoreboard() == null
          || p.getScoreboard() == Bukkit.getScoreboardManager().getMainScoreboard()
          || p.getScoreboard().getObjectives().size() != 1) {
        p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
      }

      if (p.getScoreboard().getObjective(p.getUniqueId().toString().substring(0, 16)) == null) {
        p.getScoreboard()
            .registerNewObjective(p.getUniqueId().toString().substring(0, 16), "dummy");
        p.getScoreboard()
            .getObjective(p.getUniqueId().toString().substring(0, 16))
            .setDisplaySlot(DisplaySlot.SIDEBAR);
      }
      p.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(title);

      for (String string : elements.keySet())
        if (p.getScoreboard().getObjective(DisplaySlot.SIDEBAR).getScore(string).getScore()
            != elements.get(string))
          p.getScoreboard()
              .getObjective(DisplaySlot.SIDEBAR)
              .getScore(string)
              .setScore(elements.get(string));

      for (String string : new ArrayList<>(p.getScoreboard().getEntries()))
        if (!elements.keySet().contains(string)) p.getScoreboard().resetScores(string);

      return true;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }
Example #8
0
 @Override
 public void display0() {
   Scoreboard board = getPlayer().getEntity().getScoreboard();
   if (board == null) {
     board = Bukkit.getScoreboardManager().getNewScoreboard();
     getPlayer().getEntity().setScoreboard(board);
   }
   if (o == null) {
     this.o = board.registerNewObjective(getPlayer().getPlugin().getName() + "-primary", "dummy");
     this.buffer =
         board.registerNewObjective(getPlayer().getPlugin().getName() + "-buffer", "dummy");
   }
   this.o.setDisplaySlot(DisplaySlot.SIDEBAR);
 }
  public static boolean unrankedSidebarDisplay(
      Collection<Player> players, String[] elements, Scoreboard board) {
    try {
      String objName = "COLLAB-SB-WINTER";

      if (board == null) board = Bukkit.getScoreboardManager().getNewScoreboard();

      elements = cutUnranked(elements);

      for (Player player : players)
        if (player.getScoreboard() != board) player.setScoreboard(board);

      if (board.getObjective(objName) == null) {
        board.registerNewObjective(objName, "dummy");
        board.getObjective(objName).setDisplaySlot(DisplaySlot.SIDEBAR);
      }

      board.getObjective(DisplaySlot.SIDEBAR).setDisplayName(elements[0]);

      for (int i = 1; i < elements.length; i++)
        if (elements[i] != null
            && board.getObjective(DisplaySlot.SIDEBAR).getScore(elements[i]).getScore() != 16 - i) {
          board.getObjective(DisplaySlot.SIDEBAR).getScore(elements[i]).setScore(16 - i);
          for (String string : board.getEntries())
            if (board.getObjective(objName).getScore(string).getScore() == 16 - i)
              if (!string.equals(elements[i])) board.resetScores(string);
        }

      for (String entry : board.getEntries()) {
        boolean toErase = true;
        for (String element : elements) {
          if (element != null
              && element.equals(entry)
              && board.getObjective(objName).getScore(entry).getScore()
                  == 16 - Arrays.asList(elements).indexOf(element)) {
            toErase = false;
            break;
          }
        }

        if (toErase) board.resetScores(entry);
      }

      return true;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }
Example #10
0
  @Override
  public void onEnable() {
    Main.instance = this;

    // register classes
    this.registerConfigurationClasses();

    // save default config
    this.saveDefaultConfig();
    this.loadConfigInUTF();

    this.getConfig().options().copyDefaults(true);
    this.getConfig().options().copyHeader(true);

    ConfigUpdater configUpdater = new ConfigUpdater();
    configUpdater.addConfigs();
    this.saveConfiguration();
    this.loadConfigInUTF();
    this.loadShop();

    this.isSpigot = this.getIsSpigot();
    this.loadDatabase();

    this.craftbukkit = this.getCraftBukkit();
    this.minecraft = this.getMinecraftPackage();
    this.version = this.loadVersion();

    this.registerCommands();
    this.registerListener();

    this.gameManager = new GameManager();

    // bungeecord
    if (Main.getInstance().isBungee()) {
      this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
    }

    this.loadStatistics();
    this.localization = this.loadLocalization();

    this.checkUpdates();

    // Loading
    this.scoreboardManager = Bukkit.getScoreboardManager();
    this.gameManager.loadGames();
    this.startTimeListener();
    this.startMetricsIfEnabled();
  }
Example #11
0
  public void initConfig() {

    List<String> bw = getConfig().getStringList("blacklist");
    for (String s : bw) {
      bw.add(s.toLowerCase());
    }

    scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
    this.saveDefaultConfig();
    List<String> ls = getConfig().getStringList("ranks");
    for (String s : ls) {
      assignedTeams.put(getConfig().getString("rank." + s + ".permission"), s);
      Team t = scoreboard.registerNewTeam("player" + getConfig().getString("rank." + s + ".order"));
      if (getConfig().getString("rank." + s + ".prefix") != null) {
        t.setPrefix(
            ChatColor.translateAlternateColorCodes(
                '&', getConfig().getString("rank." + s + ".prefix")));
      }
      if (getConfig().getString("rank." + s + ".suffix") != null) {
        t.setSuffix(
            ChatColor.translateAlternateColorCodes(
                '&', getConfig().getString("rank." + s + ".suffix")));
      }
    }

    Bukkit.getScheduler()
        .runTaskAsynchronously(
            this,
            new Runnable() {
              public void run() {
                while (whileloop == true) {
                  for (Player p : Bukkit.getOnlinePlayers()) {
                    if (!blacklistedworlds.contains(p.getWorld().getName().toLowerCase())) {
                      p.setScoreboard(scoreboard);
                    }
                  }

                  try {
                    Thread.sleep(5000);
                  } catch (InterruptedException e) {
                    e.printStackTrace();
                  }
                }
              }
            });
  }
Example #12
0
  @Override
  public void onEnable() {
    setup = new ConfigAccessor(this, "setup");
    toggles = new ConfigAccessor(this, "toggles");

    setup.saveDefaultConfig();
    toggles.saveDefaultConfig();

    compass = toggles.getConfig().getBoolean("compass", true);
    clock = toggles.getConfig().getBoolean("arenaclock", true);
    specchat = toggles.getConfig().getBoolean("specchat", true);
    scoreboard = toggles.getConfig().getBoolean("colouredtablist", true);
    output = toggles.getConfig().getBoolean("outputmessages", true);
    death = toggles.getConfig().getBoolean("deathspec", false);

    console = getServer().getConsoleSender();
    if (scoreboard) {
      manager = Bukkit.getScoreboardManager();
      board = manager.getNewScoreboard();
      team = board.registerNewTeam("spec");
      team.setPrefix(
          ChatColor.DARK_GRAY
              + "["
              + ChatColor.GRAY
              + "Spec"
              + ChatColor.DARK_GRAY
              + "] "
              + ChatColor.GRAY);
    }

    for (Player player : getServer().getOnlinePlayers()) {
      user.put(player.getName(), new PlayerObject());
    }
    getServer().getPluginManager().registerEvents(new SpectateListener(this), this);
    if (output) {
      console.sendMessage(
          prefix + "Version " + ChatColor.RED + "1.8" + ChatColor.GOLD + " is enabled!");
    }
    this.getCommand("spectate").setExecutor(commands);
    this.getCommand("spec").setExecutor(commands);
  }
 @Override
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (sender instanceof Player) {
     Player player = (Player) sender;
     if (args.length > 0) {
       switch (args[0]) {
         case "join":
           player.teleport(plugin.getActiveArena().getTeleportLocation());
           break;
         case "start":
           if (player.hasPermission("hexigames.admin")) {
             if (Objects.equals(plugin.getActiveArena(), plugin.getLobby())) {
               plugin.getLobby().startNextGame();
             }
           }
           break;
         case "stop":
           if (player.hasPermission("hexigames.admin")) {
             plugin.returnToLobby();
           }
           break;
         case "reload":
           if (player.hasPermission("hexigames.admin")) {
             plugin.reload();
           }
           break;
         case "poo":
           Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
           Objective objective = scoreboard.registerNewObjective("tester", "dummy");
           objective.setDisplaySlot(DisplaySlot.SIDEBAR);
           objective.setDisplayName("narnar");
           player.setScoreboard(scoreboard);
           break;
         default:
           break;
       }
     }
   }
   return true;
 }
Example #14
0
  @EventHandler
  public void onPlayerJoin(PlayerJoinEvent e) {
    FileConfiguration locationsFile =
        YamlConfiguration.loadConfiguration(Main.getInstance().locations);

    Player p = e.getPlayer();
    SPlayer player = new SPlayer(p);

    int blue = Team.BLUE.getPlayers().size();
    int red = Team.RED.getPlayers().size();

    p.teleport(locationUtil.deserializeLoc(locationsFile.getString("arena.lobby")));
    gameManager.setCarrying(p, 0);

    Scoreboard sb = Bukkit.getScoreboardManager().getNewScoreboard();
    org.bukkit.scoreboard.Team r = sb.registerNewTeam("red");
    r.setPrefix(Color.np("&c"));
    org.bukkit.scoreboard.Team b = sb.registerNewTeam("blue");
    b.setPrefix(Color.np("&b"));
    for (Player online : Bukkit.getOnlinePlayers()) {
      Team team = teamManager.getTeam(online);
      if (team == Team.BLUE) {
        b.addEntry(online.getName());
      } else {
        r.addEntry(online.getName());
      }
    }

    p.setScoreboard(sb);

    e.setJoinMessage(null);

    if (blue <= red) {
      player.setTeam(Team.BLUE);
    } else {
      player.setTeam(Team.RED);
    }
  }
  public static boolean rankedSidebarDisplay(
      Collection<Player> players,
      String title,
      HashMap<String, Integer> elements,
      Scoreboard board) {
    try {
      title = cutRankedTitle(title);
      elements = cutRanked(elements);

      String objName = "COLLAB-SB-WINTER";

      if (board == null) board = Bukkit.getScoreboardManager().getNewScoreboard();

      for (Player player : players)
        if (player.getScoreboard() != board) player.setScoreboard(board);

      if (board.getObjective(objName) == null) {
        board.registerNewObjective(objName, "dummy");
        board.getObjective(objName).setDisplaySlot(DisplaySlot.SIDEBAR);
      }

      board.getObjective(DisplaySlot.SIDEBAR).setDisplayName(title);

      for (String string : elements.keySet())
        if (board.getObjective(DisplaySlot.SIDEBAR).getScore(string).getScore()
            != elements.get(string))
          board.getObjective(DisplaySlot.SIDEBAR).getScore(string).setScore(elements.get(string));

      for (String string : new ArrayList<>(board.getEntries()))
        if (!elements.keySet().contains(string)) board.resetScores(string);

      return true;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }
Example #16
0
public class User {

  private UserSkillClass userSkillClass;
  private Player player;
  private UUID id;
  private Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
  private Objective boardClass;

  public User(UUID id) {
    this.player = Bukkit.getPlayer(id);
    this.id = id;
    loadData();
    boardClass =
        board.registerNewObjective(
            ChatColor.AQUA + userSkillClass.getSkillClass().getName(), "dummy");
  }

  public Player getPlayer() {
    return player;
  }

  public void setPlayer(Player player) {
    this.player = player;
  }

  public UUID getID() {
    return id;
  }

  public UserSkillClass getUserSkillClass() {
    return userSkillClass;
  }

  public void setUserSkillClass(UserSkillClass userSkillClass) {
    this.userSkillClass = userSkillClass;
  }

  private void loadData() {
    setUserSkillClass(DatabaseUtil.loadUser(id));
  }

  public void switchClass(SkillClass skillClass) {
    DatabaseUtil.saveClass(id, getUserSkillClass());
    setUserSkillClass(DatabaseUtil.loadUserClass(id, skillClass));
    if (board.getObjective(ChatColor.AQUA + userSkillClass.getSkillClass().getName()) != null) {
      boardClass = board.getObjective(ChatColor.AQUA + userSkillClass.getSkillClass().getName());
    } else {
      boardClass =
          board.registerNewObjective(
              ChatColor.AQUA + userSkillClass.getSkillClass().getName(), "dummy");
    }
    scoreboard();
  }

  public void saveClass() {
    DatabaseUtil.saveClass(id, userSkillClass);
  }

  public void scoreboard() {
    boardClass.setDisplaySlot(DisplaySlot.SIDEBAR);
    Score rank = boardClass.getScore(ChatColor.GREEN + "Rank:");
    Score power = boardClass.getScore(ChatColor.GOLD + "Power:");
    rank.setScore(userSkillClass.getRank());
    power.setScore(userSkillClass.getPower());
    Score[] score = new Score[userSkillClass.getSkillClass().getSkills().size()];
    for (int i = 0; i < userSkillClass.getSkillClass().getSkills().size(); i++) {
      Skill skill = userSkillClass.getSkillClass().getSkills().get(i);
      score[i] = boardClass.getScore(ChatColor.GREEN + skill.getScoreboardName() + ":");
      score[i].setScore(userSkillClass.getLevel(skill));
    }
    player.setScoreboard(board);
  }
}
/** Created by Robo on 2/13/2016. */
public class SimpleClansListener implements Listener {
  private Scoreboard sb = Bukkit.getScoreboardManager().getMainScoreboard();
  ClanManager clanManager;
  BukkitScheduler scheduler = Bukkit.getScheduler();
  public Main instance;

  public SimpleClansListener(Main main) {
    SimpleClans sc = (SimpleClans) Bukkit.getPluginManager().getPlugin("SimpleClans");
    clanManager = sc.getClanManager();
    instance = main;
  }

  @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
  public void onPlayerJoin(PlayerJoinEvent event) {
    final Player player = event.getPlayer();
    ClanPlayer clanPlayer = clanManager.getClanPlayer(player);
    if (clanPlayer == null) return;
    System.out.println(player.getName() + " is in SimpleClans db.");
    Clan clan = clanPlayer.getClan();
    if (clan == null) // If not part of a clan, do no more
    return;

    final String tag = clan.getColorTag();
    System.out.println(player.getName() + " has a clan: " + tag);

    // Feature: set prefix in tablist
    // compatible with other prefix/suffix plugins since we just set PlayerListName
    scheduler.scheduleSyncDelayedTask(
        instance,
        new Runnable() {
          public void run() {
            player.setPlayerListName(tag + " " + player.getDisplayName());
          }
        },
        30L); // Long delay to ensure this has priority & no need to instantly set

    scheduler.scheduleSyncDelayedTask(
        instance,
        new Runnable() {
          public void run() {
            Team team = sb.getTeam(player.getName());
            if (team == null) return;
            team.setPrefix(tag + " "); // TODO: Check if a colored tag colors name
          }
        },
        40L); // Ensure healthbar made the team
  }

  // Not really a SimpleClans feature but too lazy to make it a separate plugin right now
  @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
  public void onPlayerChat(AsyncPlayerChatEvent event) {
    if (event.getRecipients().size() < 2) return; // ignore if they're the only one on or softmuted

    final Player player = event.getPlayer();
    String mess = event.getMessage();
    if (mess.length() > 30) mess = mess.substring(mess.indexOf(0, 27)) + "...";
    final String message = mess;
    scheduler.scheduleSyncDelayedTask(
        instance,
        new Runnable() {
          public void run() {
            // TODO: are the 3 lines below thread-safe?
            Team team = sb.getTeam(player.getName());
            if (team == null) return;
            team.setSuffix(": " + message);
          }
        });

    scheduler.scheduleSyncDelayedTask(
        instance,
        new Runnable() {
          public void run() {
            Team team = sb.getTeam(player.getName());
            if (team == null) return;
            if (team.getSuffix().equals(": " + message))
              Bukkit.dispatchCommand(
                  Bukkit.getConsoleSender(), "healthbar reloadplayer " + player.getName());
          }
        },
        70L);
  }
}
Example #18
0
 public BukkitTechBoard(TechPlayer player) {
   this.player = player;
   if (player.getEntity().getScoreboard() == null)
     player.getEntity().setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
 }
Example #19
0
public class Arena {

  public static ArrayList<Arena> arenaObjects = new ArrayList<Arena>();
  private TNTTag plugin;
  private CountdownManager countdownManager;
  private Location lobbyLocation;
  private Location arenaLocation;
  private Location spectatorLocation;
  private String name;
  private ArrayList<Player> players = new ArrayList<Player>();
  private ArrayList<Player> TNTPlayers = new ArrayList<Player>();
  private ArrayList<Player> AlivePlayers = new ArrayList<Player>();
  private int maxPlayers;
  private int minPlayers;
  private int taskID;
  private int seconds;
  private boolean inGame = false;
  private boolean runningCountdown = false;

  public Arena(
      TNTTag plugin,
      String arenaName,
      Location joinLocation,
      Location startLocation,
      Location endLocation,
      int maxPlayers,
      int minPlayers) {
    this.plugin = plugin;
    this.name = arenaName;
    this.lobbyLocation = joinLocation;
    this.arenaLocation = startLocation;
    this.spectatorLocation = endLocation;
    this.maxPlayers = maxPlayers;
    this.minPlayers = minPlayers;
    this.countdownManager = new CountdownManager(plugin, this);

    arenaObjects.add(this);
  }

  public Location getLobbyLocation() {
    return this.lobbyLocation;
  }

  public void setLobbyLocation(Location joinLocation) {
    this.lobbyLocation = joinLocation;
  }

  public Location getArenaLocation() {
    return this.arenaLocation;
  }

  public void setArenaLocation(Location startLocation) {
    this.arenaLocation = startLocation;
  }

  public Location getSpectatorLocation() {
    return this.spectatorLocation;
  }

  public void setSpectatorLocation(Location endLocation) {
    this.spectatorLocation = endLocation;
  }

  public String getName() {
    return this.name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getMaxPlayers() {
    return this.maxPlayers;
  }

  public void setMaxPlayers(int maxPlayers) {
    this.maxPlayers = maxPlayers;
  }

  public int getMinPlayers() {
    return this.minPlayers;
  }

  public void setMinPlayers(int minPlayers) {
    this.minPlayers = minPlayers;
  }

  public ArrayList<Player> getPlayers() {
    return this.players;
  }

  public ArrayList<Player> getTNTPlayers() {
    return this.TNTPlayers;
  }

  public ArrayList<Player> getAlivePlayers() {
    return this.AlivePlayers;
  }

  public boolean isFull() {
    if (this.players.size() >= this.maxPlayers) {
      return true;
    }
    return false;
  }

  public boolean isInGame() {
    return this.inGame;
  }

  public boolean runningCountdown() {
    return this.runningCountdown;
  }

  public void setRunningCountdown(Boolean b) {
    this.runningCountdown = b.booleanValue();
  }

  public void setInGame(boolean inGame) {
    this.inGame = inGame;
  }

  public void sendMessage(String message) {
    for (Player player : this.players) {
      plugin.getMessageManager().sendMessage(player, message);
    }
  }

  public void endArena() {
    setInGame(false);
    for (Player player : this.players) {
      InventoryManager.restoreInventory(player);

      getPlayers().remove(player.getName());
      if (getTNTPlayers().contains(player.getName())) {
        getTNTPlayers().remove(player.getName());
      }
      if (getAlivePlayers().contains(player.getName())) {
        getAlivePlayers().remove(player.getName());
      }
      removeBoard(player);
      if (this.players.size() == 0) {
        this.players.clear();
        return;
      }
    }
  }

  public int getTaskID() {
    return this.taskID;
  }

  public void setTaskID(int taskID) {
    this.taskID = taskID;
  }

  public int getSeconds() {
    return this.seconds;
  }

  public void setSeconds(int seconds) {
    this.seconds = seconds;
  }

  public CountdownManager getCountdownManager() {
    return countdownManager;
  }

  ScoreboardManager manager = Bukkit.getScoreboardManager();
  Scoreboard board = this.manager.getNewScoreboard();
  Objective objective = this.board.registerNewObjective("lives", "dummy");

  public void setBoard(Player player, int time) {
    this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    this.objective.setDisplayName("TNT Tag");

    Score money = this.objective.getScore("Players:");
    money.setScore(this.players.size());

    Score Tags = this.objective.getScore("Time:");
    Tags.setScore(time);
    player.setScoreboard(this.board);
  }

  public void removeBoard(Player player) {
    player.setScoreboard(this.manager.getNewScoreboard());
  }

  public void updateBoard(Player player, int time) {
    setBoard(player, time);
  }
}
 public void removePlayer(Player player) {
   player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
 }
 public QueueScoreboard() {
   this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
   this.prepareScoreboard();
 }