SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class ActionbarManager implements Listener {
  2.    
  3.     private static void sendActionbar(final Player player, final String message) {
  4.         final IChatBaseComponent iChatBaseComponent = IChatBaseComponent.ChatSerializer
  5.                 .a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}");
  6.         final PacketPlayOutChat packet = new PacketPlayOutChat(iChatBaseComponent, (byte) 2);
  7.         ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
  8.     }
  9.     public static void updateTimeBar() {
  10.         final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
  11.         simpleDateFormat.setTimeZone(TimeZone.getTimeZone("CET"));
  12.         final String message = "§7Teaming §8● §cVerboten §8▎ §7Spieler §8● §b"+ Bukkit.getOnlinePlayers().size();
  13.         Bukkit.getOnlinePlayers().forEach(current -> sendActionbar(current, message));
  14.  
  15.     }
  16.    
  17.     public static String getSimpleTime() {
  18.         final String now = new SimpleDateFormat("dd.MM.yyyy").format(new Date());
  19.         return now;
  20.     }
  21. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top