Fixed coordinates in lookups not always being properly aligned

This commit is contained in:
Intelli 2022-02-07 18:03:53 -07:00
parent 3a0c86a614
commit 673529df54

View file

@ -807,9 +807,15 @@ public class LookupCommand {
int z = Integer.parseInt(data[5]); int z = Integer.parseInt(data[5]);
int action = Integer.parseInt(data[6]); int action = Integer.parseInt(data[6]);
String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true); String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
double time_length = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, false).replaceAll("[^0-9]", "").length() * 1.50; int timeLength = 50 + (Util.getTimeSince(Integer.parseInt(time), unixtimestamp, false).replaceAll("[^0-9]", "").length() * 6);
int padding = (int) (time_length + 12.50); String leftPadding = Color.BOLD + Strings.padStart("", 10, ' ');
String leftPadding = Strings.padStart("", padding, ' '); if (timeLength % 4 == 0) {
leftPadding = Strings.padStart("", timeLength / 4, ' ');
}
else {
leftPadding = leftPadding + Color.WHITE + Strings.padStart("", (timeLength - 50) / 4, ' ');
}
Chat.sendComponent(player2, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_LOGIN, Color.DARK_AQUA + dplayer + Color.WHITE, (action != 0 ? Selector.FIRST : Selector.SECOND))); Chat.sendComponent(player2, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_LOGIN, Color.DARK_AQUA + dplayer + Color.WHITE, (action != 0 ? Selector.FIRST : Selector.SECOND)));
Chat.sendComponent(player2, Color.WHITE + leftPadding + Color.GREY + "^ " + Util.getCoordinates(command.getName(), wid, x, y, z, true, true) + ""); Chat.sendComponent(player2, Color.WHITE + leftPadding + Color.GREY + "^ " + Util.getCoordinates(command.getName(), wid, x, y, z, true, true) + "");
} }
@ -833,9 +839,15 @@ public class LookupCommand {
int z = Integer.parseInt(data[5]); int z = Integer.parseInt(data[5]);
String message = data[6]; String message = data[6];
String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true); String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
double time_length = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, false).replaceAll("[^0-9]", "").length() * 1.50; int timeLength = 50 + (Util.getTimeSince(Integer.parseInt(time), unixtimestamp, false).replaceAll("[^0-9]", "").length() * 6);
int padding = (int) (time_length + 12.50); String leftPadding = Color.BOLD + Strings.padStart("", 10, ' ');
String leftPadding = Strings.padStart("", padding, ' '); if (timeLength % 4 == 0) {
leftPadding = Strings.padStart("", timeLength / 4, ' ');
}
else {
leftPadding = leftPadding + Color.WHITE + Strings.padStart("", (timeLength - 50) / 4, ' ');
}
Chat.sendComponent(player2, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + dplayer + ": " + Color.WHITE, message); Chat.sendComponent(player2, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + dplayer + ": " + Color.WHITE, message);
Chat.sendComponent(player2, Color.WHITE + leftPadding + Color.GREY + "^ " + Util.getCoordinates(command.getName(), wid, x, y, z, true, true) + ""); Chat.sendComponent(player2, Color.WHITE + leftPadding + Color.GREY + "^ " + Util.getCoordinates(command.getName(), wid, x, y, z, true, true) + "");
} }
@ -861,9 +873,14 @@ public class LookupCommand {
String tag = Color.WHITE + "-"; String tag = Color.WHITE + "-";
String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true); String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
double timeLength = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, false).replaceAll("[^0-9]", "").length() * 1.50; int timeLength = 50 + (Util.getTimeSince(Integer.parseInt(time), unixtimestamp, false).replaceAll("[^0-9]", "").length() * 6);
int padding = (int) (timeLength + 12.50); String leftPadding = Color.BOLD + Strings.padStart("", 10, ' ');
String leftPadding = Strings.padStart("", padding, ' '); if (timeLength % 4 == 0) {
leftPadding = Strings.padStart("", timeLength / 4, ' ');
}
else {
leftPadding = leftPadding + Color.WHITE + Strings.padStart("", (timeLength - 50) / 4, ' ');
}
String dname = ""; String dname = "";
boolean isPlayer = false; boolean isPlayer = false;