SHARE
TWEET

Untitled

a guest Aug 17th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public void setAllDisplayNames() {
  2.         Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  3.             public void run() {
  4.                 for(Player ps : Bukkit.getOnlinePlayers()) {
  5.                     if(!MixoPerms.getAPI().user_get_highestGroup(ps.getUniqueId(), false).equalsIgnoreCase(Ranks.SPIELER)) {
  6.                         ps.setPlayerListName(ps.getDisplayName());
  7.                     }
  8.                 }
  9.             }
  10.         }, 10L);
  11.     }
  12.     public void sendTablist(Player p, int playersize){
  13.         CraftPlayer craftplayer = (CraftPlayer) p;
  14.         PlayerConnection connection = craftplayer.getHandle().playerConnection;
  15.        
  16.         String Motd = getServer().getMotd();
  17.        
  18. //      ChatComponentText header = new ChatComponentText("§6§lMixoVerse.net §a" + Motd.replace("\"", ""));
  19.         ChatComponentText header = new ChatComponentText("§8» ------------------------------- «"
  20.                 + "\n\n"
  21.                 + "§8» §6§lM§e§li§6§lx§e§lo§6§lV§e§le§6§lr§e§ls§6§le§e§l.§6§ln§e§le§6§lt §8«"
  22.                 + "\n§8» §6Server §e" + Motd + " §8«"
  23.                 + "\n§8» §6Spieler Online §e" + playersize + "§6/§e" + Bukkit.getMaxPlayers() + " §8«"
  24.                 + "\n");
  25.        
  26.         //Spieler Liste
  27.        
  28.         ChatComponentText footer = new ChatComponentText("\n"
  29.                 + "§6Website §8» §eMixoVerse.net"
  30.                 + "\n§6TeamSpeak §8» §eMixoVerse.net"
  31.                 + "\n§6Discord §8» §eMixoVerse.net/discord.html"
  32.                 + "\n"
  33.                 + "\n§8» ------------------------------- «");
  34.        
  35.         PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
  36.        
  37.  
  38.         try {
  39.             Field headerField = packet.getClass().getDeclaredField("a");
  40.             headerField.setAccessible(true);
  41.             headerField.set(packet, header);
  42.             headerField.setAccessible(!headerField.isAccessible());
  43.          
  44.             Field footerField = packet.getClass().getDeclaredField("b");
  45.             footerField.setAccessible(true);
  46.             footerField.set(packet, footer);
  47.             footerField.setAccessible(!footerField.isAccessible());
  48.         } catch (Exception exc) {
  49.             exc.printStackTrace();
  50.         }
  51.         connection.sendPacket(packet);
  52.     }
  53.  
  54.     @EventHandler
  55.     public void onChat(AsyncPlayerChatEvent e){
  56.         String newDisplayName = ChatColor.translateAlternateColorCodes('&', MixoPerms.getAPI().user_get_prefix(e.getPlayer().getUniqueId()) + e.getPlayer().getName());
  57.         e.setFormat(newDisplayName + "§f: " + "%2$s");
  58.         if(MixoPerms.getAPI().user_tools_isDonator(e.getPlayer().getUniqueId())){
  59.             e.setMessage(ChatColor.translateAlternateColorCodes('&', e.getMessage()));
  60.         }
  61.     }
  62.    
  63.     @EventHandler
  64.     public void onJoin(PlayerJoinEvent e){
  65.         e.getPlayer().setDisplayName(MixoPerms.getAPI().user_get_prefix(e.getPlayer().getUniqueId()).replace("&", "§") + e.getPlayer().getName());
  66.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top