added CoordinateDisplay with settings preferences, directional updates, and time display
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package eu.mhsl.craftattack.spawn.core.util.text;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class DataSizeConverter {
|
||||
public static String convertBytesPerSecond(long bytes) {
|
||||
double kbits = bytes * 8.0 / 1000.0;
|
||||
@@ -52,4 +54,27 @@ public class DataSizeConverter {
|
||||
|
||||
return String.format("%dd %dh %dm %ds", days, hours, minutes, seconds);
|
||||
}
|
||||
|
||||
public static String getCardinalDirection(Location location) {
|
||||
float yaw = location.getYaw();
|
||||
yaw = (yaw % 360 + 360) % 360;
|
||||
|
||||
if (yaw >= 337.5 || yaw < 22.5) {
|
||||
return "S";
|
||||
} else if (yaw >= 22.5 && yaw < 67.5) {
|
||||
return "SW";
|
||||
} else if (yaw >= 67.5 && yaw < 112.5) {
|
||||
return "W";
|
||||
} else if (yaw >= 112.5 && yaw < 157.5) {
|
||||
return "NW";
|
||||
} else if (yaw >= 157.5 && yaw < 202.5) {
|
||||
return "N";
|
||||
} else if (yaw >= 202.5 && yaw < 247.5) {
|
||||
return "NO";
|
||||
} else if (yaw >= 247.5 && yaw < 292.5) {
|
||||
return "O";
|
||||
} else {
|
||||
return "SO";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package eu.mhsl.craftattack.spawn.core.util.world;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
public class WorldUtils {
|
||||
public static String getGameTime(World world) {
|
||||
long timeOfDay = world.getTime() % 24000;
|
||||
|
||||
int hours = (int) ((timeOfDay / 1000 + 6) % 24);
|
||||
int minutes = (int) ((timeOfDay % 1000) * 60 / 1000);
|
||||
|
||||
return String.format("%02d:%02d", hours, minutes);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user