Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String getCountdownString() {
- Date countdown = plugin.getCountdown();
- Date now = new Date();
- long diff = countdown.getTime() - now.getTime();
- long diffSec = diff / 1000;
- long days = diffSec / SECONDS_IN_A_DAY;
- long secondsDay = diffSec % SECONDS_IN_A_DAY;
- long seconds = secondsDay % 60;
- long minutes = (secondsDay / 60) % 60;
- long hours = (secondsDay / 3600);
- String s;
- if (days <= 0) {
- if (hours <= 0) {
- if (minutes <= 0) {
- if (seconds <= 0) {
- s = plugin.getCountdownFormatNow();
- } else
- s = plugin.getCountdownFormatSeconds();
- } else
- s = plugin.getCountdownFormatMinutes();
- } else
- s = plugin.getCountdownFormatHours();
- } else
- s = plugin.getCountdownFormatDays();
- return s.replaceAll("%d", "" + days).replaceAll("%g", "" + hours).replaceAll("%m", "" + minutes).replaceAll("%s", "" + seconds);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement