package raffilisteners; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.scoreboard.Scoreboard; public class Tablist implements Listener { private static Scoreboard sb; public static void setScoreboard() { sb = Bukkit.getScoreboardManager().getNewScoreboard(); sb.registerNewTeam("000Owner"); sb.registerNewTeam("001Moderator"); sb.registerNewTeam("002Developer"); sb.registerNewTeam("003Builder"); sb.registerNewTeam("004Rapper"); sb.registerNewTeam("005YouTuber"); sb.registerNewTeam("006Raffi"); sb.registerNewTeam("007Supreme"); sb.registerNewTeam("008Premium"); sb.registerNewTeam("009Spieler"); sb.getTeam("000Owner").setPrefix("§c§lOwner §7x §c§l"); sb.getTeam("001Moderator").setPrefix("§2Moderator §7x §2"); sb.getTeam("002Developer").setPrefix("§bDeveloper §7x §b"); sb.getTeam("003Builder").setPrefix("§aBuilder §7x §a"); sb.getTeam("004Rapper").setPrefix("§e§lRapper §7x §e§l"); sb.getTeam("005YouTuber").setPrefix("§lYouTuber §7x §l"); sb.getTeam("006Raffi").setPrefix("§6§lRaffi §7x §6§l"); sb.getTeam("007Supreme").setPrefix("§7§lSupreme §7x §7§l"); sb.getTeam("008Premium").setPrefix("§6Premium §7x §6"); sb.getTeam("009Spieler").setPrefix("§7Spieler §7x §7"); } @SuppressWarnings("deprecation") public void setPrefix(Player p) { String Team = ""; if(p.hasPermission("rank.owner")) { Team = "000Owner"; }else if(p.hasPermission("rank.mod")) { Team = "001Moderator"; }else if(p.hasPermission("rank.dev")) { Team = "002Developer"; }else if(p.hasPermission("rank.builder")){ Team = "003Builder"; }else if(p.hasPermission("rank.rapper")) { Team = "004Rapper"; }else if(p.hasPermission("rank.youtuber")) { Team = "005YouTuber"; }else if(p.hasPermission("rank.raffi")) { Team = "006Raffi"; }else if(p.hasPermission("rank.supreme")) { Team = "007Supreme"; }else if(p.hasPermission("rank.premium")) { Team = "008Premium"; }else { Team = "009Spieler"; } sb.getTeam(Team).addPlayer(p); p.setDisplayName(sb.getTeam(Team).getPrefix() + p.getName()); for(Player all : Bukkit.getOnlinePlayers()) { all.setScoreboard(sb); } } @EventHandler public void onJoin(PlayerJoinEvent e) { setPrefix(e.getPlayer()); } }