Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.chicken.war;
- import java.io.IOException;
- import org.bukkit.Bukkit;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.scoreboard.DisplaySlot;
- import org.bukkit.scoreboard.Objective;
- import org.bukkit.scoreboard.Score;
- import net.md_5.bungee.api.ChatColor;
- public class Scoreboard {
- int LobbyScoreboard;
- static int number = 50;
- static int timer = 30;
- static int PlayerNumberList;
- public static org.bukkit.scoreboard.Scoreboard scoreboardlobby = Bukkit.getScoreboardManager().getNewScoreboard();
- @SuppressWarnings("deprecation")
- public static void SetLobby(Player player) {
- Bukkit.getScheduler().scheduleAsyncRepeatingTask(JavaPlugin.getPlugin(Main.class), new Runnable() {
- @Override
- public void run() {
- if(number == 50) {
- if(scoreboardlobby.getObjective("Lobby") == null) {
- scoreboardlobby.registerNewObjective("Lobby","dummy");
- }
- Objective lobbyobjective = scoreboardlobby.getObjective("Lobby");
- if(!lobbyobjective.getDisplayName().contains("Waiting")) {
- Score NothingD = lobbyobjective.getScore("§4");
- NothingD.setScore(15);
- lobbyobjective.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "Waiting for Players");
- Score PlayerTag = lobbyobjective.getScore(ChatColor.GREEN + "" + ChatColor.BOLD + "Players:");
- PlayerTag.setScore(14);
- Score PlayerNumber = lobbyobjective.getScore(ChatColor.AQUA + "" + ChatColor.BOLD + Bukkit.getOnlinePlayers().size() + "/" + "20");
- PlayerNumber.setScore(13);
- PlayerNumberList = Bukkit.getOnlinePlayers().size();
- Score NothingA = lobbyobjective.getScore("§1");
- NothingA.setScore(12);
- Score ServerTag = lobbyobjective.getScore(ChatColor.GREEN + "" + ChatColor.BOLD + "Server:");
- ServerTag.setScore(11);
- Score ServerName = lobbyobjective.getScore(ChatColor.GOLD + "" + ChatColor.BOLD + Messages.ServerName(player));
- ServerName.setScore(10);
- Score NothingB = lobbyobjective.getScore("§2");
- NothingB.setScore(9);
- Score TeamTag = lobbyobjective.getScore(ChatColor.GREEN + "" + ChatColor.BOLD + "Team:");
- TeamTag.setScore(8);
- Score TeamName = lobbyobjective.getScore(ChatColor.GOLD + "" + ChatColor.BOLD + Bukkit.getScoreboardManager().getMainScoreboard().getPlayerTeam(player.getPlayer()).getPrefix());
- TeamName.setScore(7);
- Score NothingC = lobbyobjective.getScore("§3");
- NothingC.setScore(6);
- Score KitTag = lobbyobjective.getScore(ChatColor.GREEN + "" + ChatColor.BOLD + "Kit:");
- KitTag.setScore(5);
- Score KitName = lobbyobjective.getScore(ChatColor.BLUE + "" + ChatColor.BOLD + Kits.getKit(player));
- KitName.setScore(4);
- lobbyobjective.setDisplaySlot(DisplaySlot.SIDEBAR);
- player.setScoreboard(scoreboardlobby);
- if(PlayerNumberList > 1) {
- number--;
- }
- } else {
- if(PlayerNumberList != Bukkit.getOnlinePlayers().size()) {
- scoreboardlobby.resetScores(ChatColor.AQUA + "" + ChatColor.BOLD + PlayerNumberList + "/" + "20");
- Score PlayerNumber = lobbyobjective.getScore(ChatColor.AQUA + "" + ChatColor.BOLD + Bukkit.getOnlinePlayers().size() + "/" + "20");
- PlayerNumber.setScore(13);
- PlayerNumberList = Bukkit.getOnlinePlayers().size();
- }
- }
- } else {
- if(number == 49) {
- Objective lobbyobjective = scoreboardlobby.getObjective("Lobby");
- if(Config.getDataYaml.getInt("scoreboardtimer") == 0) {
- if(timer < 31) {
- Config.getDataYaml.set("scoreboardtimer", timer);
- try {
- Config.getDataYaml.save(Config.getDataConfig);
- } catch (IOException e) {
- e.printStackTrace();
- }
- if(timer > 4) {
- lobbyobjective.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + timer + " Seconds untill game starts!");
- } else {
- lobbyobjective.setDisplayName(ChatColor.GREEN + "" + ChatColor.BOLD + timer + " Seconds untill game starts!");
- }
- timer--;
- }
- }
- }
- }
- }
- }, 0L, 20L);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement