Advertisement
stirante

Untitled

Apr 24th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1.  
  2. private String getCountdownString() {
  3. Date countdown = plugin.getCountdown();
  4. Date now = new Date();
  5. long diff = countdown.getTime() - now.getTime();
  6. long diffSec = diff / 1000;
  7.  
  8. long days = diffSec / SECONDS_IN_A_DAY;
  9. long secondsDay = diffSec % SECONDS_IN_A_DAY;
  10. long seconds = secondsDay % 60;
  11. long minutes = (secondsDay / 60) % 60;
  12. long hours = (secondsDay / 3600);
  13. String s;
  14. if (days <= 0) {
  15. if (hours <= 0) {
  16. if (minutes <= 0) {
  17. if (seconds <= 0) {
  18. s = plugin.getCountdownFormatNow();
  19. } else
  20. s = plugin.getCountdownFormatSeconds();
  21. } else
  22. s = plugin.getCountdownFormatMinutes();
  23. } else
  24. s = plugin.getCountdownFormatHours();
  25. } else
  26. s = plugin.getCountdownFormatDays();
  27.  
  28. return s.replaceAll("%d", "" + days).replaceAll("%g", "" + hours).replaceAll("%m", "" + minutes).replaceAll("%s", "" + seconds);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement