/** Sends the current cooldown in action bar. */ private void sendCooldownBar() { if (getPlayer() == null) return; StringBuilder stringBuilder = new StringBuilder(); double currentCooldown = Core.getCustomPlayer(getPlayer()).canUse(type); double maxCooldown = type.getCountdown(); int res = (int) (currentCooldown / maxCooldown * 10); ChatColor color; for (int i = 0; i < 10; i++) { color = ChatColor.RED; if (i < 10 - res) color = ChatColor.GREEN; stringBuilder.append(color + "â–�"); } DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.US); otherSymbols.setDecimalSeparator('.'); otherSymbols.setGroupingSeparator('.'); otherSymbols.setPatternSeparator('.'); final DecimalFormat decimalFormat = new DecimalFormat("0.0", otherSymbols); String timeLeft = decimalFormat.format(currentCooldown) + "s"; PlayerUtils.sendInActionBar( getPlayer(), getName() + " §f" + stringBuilder.toString() + " §f" + timeLeft); }