mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
Adjust console list printing logic
This commit is contained in:
1 parent
5874bc9992
commit
2402f12536
3 files changed
+16
-19
No files matched your search
@@ -96,16 +96,16 @@ public class HomeListCommand extends CommandBase implements ConsoleExecutable {
|
||||
return;
|
||||
}
|
||||
final List<Home> homes = plugin.getDatabase().getHomes(userData.get().user()).join();
|
||||
StringJoiner rowJoiner = new StringJoiner(" ");
|
||||
StringJoiner rowJoiner = new StringJoiner("\t");
|
||||
|
||||
plugin.getLoggingAdapter().log(Level.INFO, "List of " + userData.get().user().username + "'s "
|
||||
+ homes.size() + " homes:");
|
||||
for (int i = 1; i <= homes.size(); i++) {
|
||||
final String home = homes.get(i - 1).meta.name;
|
||||
for (int i = 0; i < homes.size(); i++) {
|
||||
final String home = homes.get(i).meta.name;
|
||||
rowJoiner.add(home.length() < 16 ? home + " ".repeat(16 - home.length()) : home);
|
||||
if (i % 3 == 0) {
|
||||
if ((i + 1) % 3 == 0) {
|
||||
plugin.getLoggingAdapter().log(Level.INFO, rowJoiner.toString());
|
||||
rowJoiner = new StringJoiner(" ");
|
||||
rowJoiner = new StringJoiner("\t");
|
||||
}
|
||||
}
|
||||
plugin.getLoggingAdapter().log(Level.INFO, rowJoiner.toString());
|
||||
|
||||
@@ -64,18 +64,18 @@ public class PublicHomeListCommand extends CommandBase implements ConsoleExecuta
|
||||
public void onConsoleExecute(@NotNull String[] args) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
final List<Home> homes = plugin.getDatabase().getPublicHomes().join();
|
||||
StringJoiner rowJoiner = new StringJoiner(" ");
|
||||
StringJoiner rowJoiner = new StringJoiner("\t");
|
||||
|
||||
plugin.getLoggingAdapter().log(Level.INFO, "List of " + homes.size() + " public homes:");
|
||||
for (int i = 1; i <= homes.size(); i++) {
|
||||
final String ownerUsername = homes.get(i - 1).owner.username;
|
||||
final String homeName = homes.get(i - 1).meta.name;
|
||||
for (int i = 0; i < homes.size(); i++) {
|
||||
final String ownerUsername = homes.get(i).owner.username;
|
||||
final String homeName = homes.get(i).meta.name;
|
||||
final String home = ownerUsername + "." + homeName;
|
||||
int spacingSize = (16 - ownerUsername.length()) + 17;
|
||||
rowJoiner.add(home.length() < spacingSize ? home + " ".repeat(spacingSize - home.length()) : home);
|
||||
if (i % 3 == 0) {
|
||||
if ((i + 1) % 3 == 0) {
|
||||
plugin.getLoggingAdapter().log(Level.INFO, rowJoiner.toString());
|
||||
rowJoiner = new StringJoiner(" ");
|
||||
rowJoiner = new StringJoiner("\t");
|
||||
}
|
||||
}
|
||||
plugin.getLoggingAdapter().log(Level.INFO, rowJoiner.toString());
|
||||
|
||||
@@ -2,13 +2,10 @@ package net.william278.huskhomes.command;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.player.OnlineUser;
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import net.william278.huskhomes.util.Permission;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class WarpListCommand extends CommandBase implements ConsoleExecutable {
|
||||
@@ -66,13 +63,13 @@ public class WarpListCommand extends CommandBase implements ConsoleExecutable {
|
||||
plugin.getDatabase().getWarps().thenAccept(warps -> {
|
||||
plugin.getLoggingAdapter().log(Level.INFO, "List of " + warps.size() + " warps:");
|
||||
|
||||
StringJoiner rowJoiner = new StringJoiner(" ");
|
||||
for (int i = 1; i <= warps.size(); i++) {
|
||||
final String warp = warps.get(i - 1).meta.name;
|
||||
StringJoiner rowJoiner = new StringJoiner("\t");
|
||||
for (int i = 0; i < warps.size(); i++) {
|
||||
final String warp = warps.get(i).meta.name;
|
||||
rowJoiner.add(warp.length() < 16 ? warp + " ".repeat(16 - warp.length()) : warp);
|
||||
if (i % 3 == 0) {
|
||||
if ((i + 1) % 3 == 0) {
|
||||
plugin.getLoggingAdapter().log(Level.INFO, rowJoiner.toString());
|
||||
rowJoiner = new StringJoiner(" ");
|
||||
rowJoiner = new StringJoiner("\t");
|
||||
}
|
||||
}
|
||||
plugin.getLoggingAdapter().log(Level.INFO, rowJoiner.toString());
|
||||
|
||||
Reference in new issue
Block a user