Cleanup formatting / spacing

This commit is contained in:
Draycia
2019-06-10 11:03:48 -07:00
parent c9abc4ae00
commit dfbf1b95f6
15 changed files with 216 additions and 70 deletions

View File

@@ -23,7 +23,6 @@ package me.clip.placeholderapi.util;
public class TimeUtil {
public static String getRemaining(int seconds, TimeFormat type) {
if (seconds < 60) {
switch (type) {
case DAYS:
@@ -33,12 +32,14 @@ public class TimeUtil {
case SECONDS:
return String.valueOf(seconds);
}
return String.valueOf(seconds);
}
int minutes = seconds / 60;
int s = 60 * minutes;
int secondsLeft = seconds - s;
if (minutes < 60) {
switch (type) {
case DAYS:
@@ -49,6 +50,7 @@ public class TimeUtil {
case SECONDS:
return String.valueOf(secondsLeft);
}
return String.valueOf(seconds);
}
@@ -56,6 +58,7 @@ public class TimeUtil {
int hours = minutes / 60;
int inMins = 60 * hours;
int leftOver = minutes - inMins;
switch (type) {
case DAYS:
return "0";
@@ -66,6 +69,7 @@ public class TimeUtil {
case SECONDS:
return String.valueOf(secondsLeft);
}
return String.valueOf(seconds);
}
@@ -84,12 +88,14 @@ public class TimeUtil {
case SECONDS:
return String.valueOf(secondsLeft);
}
return String.valueOf(seconds);
} else {
int hours = leftOver / 60;
int hoursInMins = 60 * hours;
int minsLeft = leftOver - hoursInMins;
switch (type) {
case DAYS:
return String.valueOf(days);
@@ -100,6 +106,7 @@ public class TimeUtil {
case SECONDS:
return String.valueOf(secondsLeft);
}
return String.valueOf(seconds);
}
}
@@ -113,6 +120,7 @@ public class TimeUtil {
int minutes = seconds / 60;
int s = 60 * minutes;
int secondsLeft = seconds - s;
if (minutes < 60) {
if (secondsLeft > 0) {
return minutes + "m " + secondsLeft + "s";
@@ -120,18 +128,22 @@ public class TimeUtil {
return minutes + "m";
}
}
if (minutes < 1440) {
String time;
int hours = minutes / 60;
time = hours + "h";
int inMins = 60 * hours;
int leftOver = minutes - inMins;
if (leftOver >= 1) {
time = time + " " + leftOver + "m";
}
if (secondsLeft > 0) {
time = time + " " + secondsLeft + "s";
}
return time;
}
@@ -140,20 +152,24 @@ public class TimeUtil {
time = days + "d";
int inMins = 1440 * days;
int leftOver = minutes - inMins;
if (leftOver >= 1) {
if (leftOver < 60) {
time = time + " " + leftOver + "m";
} else {
int hours = leftOver / 60;
time = time + " " + hours + "h";
int hoursInMins = 60 * hours;
int minsLeft = leftOver - hoursInMins;
time = time + " " + minsLeft + "m";
}
}
if (secondsLeft > 0) {
time = time + " " + secondsLeft + "s";
}
return time;
}
}