Skip to content

Instantly share code, notes, and snippets.

@ServOKio
Created November 24, 2021 15:16
Show Gist options
  • Save ServOKio/4031dd30311d0317d33016998ca05f68 to your computer and use it in GitHub Desktop.
Save ServOKio/4031dd30311d0317d33016998ca05f68 to your computer and use it in GitHub Desktop.
Отображение времени и кол-во игроков пока вы играете
Bukkit.getScheduler().runTaskTimerAsynchronously(main, () -> {
Calendar cal = Calendar.getInstance(); // creates calendar
cal.setTime(new Date()); // sets calendar time/date
cal.add(Calendar.HOUR_OF_DAY, 2); // adds one hour
String text = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime())+"|"+Bukkit.getOnlinePlayers().size();
for(Player player : Bukkit.getOnlinePlayers()) nms.sendActionBar(player, "{\"text\": \""+text+"\",\"color\":\"white\"}");
}, 0, 20);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment