Guest User

SCOREBOARD MANAGER

a guest
Jul 7th, 2021
22
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package tk.challangesmp.toxicmine;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.event.player.PlayerJoinEvent;
  9. import org.bukkit.scoreboard.DisplaySlot;
  10. import org.bukkit.scoreboard.Objective;
  11. import org.bukkit.scoreboard.Score;
  12. import org.bukkit.scoreboard.Scoreboard;
  13.  
  14. public class ScoreboardManager implements Listener {
  15.  
  16.     @EventHandler
  17.     public void onJoin(PlayerJoinEvent event) {
  18.  
  19.     }
  20.  
  21.     public void createBoard(Player player){
  22.         org.bukkit.scoreboard.ScoreboardManager manager = Bukkit.getScoreboardManager();
  23.         Scoreboard board = manager.getNewScoreboard();
  24.         Objective obj = board.registerNewObjective("ChallengeSMP", "dummy",
  25.                 ChatColor.translateAlternateColorCodes('&', "&a&l<< &2&lChallengeSMP &a&l>>"));
  26.         obj.setDisplaySlot(DisplaySlot.SIDEBAR);
  27.         Score score = obj.getScore(ChatColor.BLUE + "=-=-=-=-=-=-=-=-=-=");
  28.         score.setScore(3);
  29.         Score score2 = obj.getScore(ChatColor.GREEN + "Online Players: " + ChatColor.DARK_GREEN + Bukkit.getOnlinePlayers().size());
  30.         score2.setScore(2);
  31.         Score score3 = obj.getScore(ChatColor.GREEN + "Event Time: " + ChatColor.DARK_GREEN + "DONT KNOW HOW TO DO THIS PART :/");
  32.         score3.setScore(1);
  33.  
  34.     }
  35. }
  36.  
RAW Paste Data