Skip to content

Commit 7d3a547

Browse files
committed
Lists now show proper username
1 parent 943d708 commit 7d3a547

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/me/leoko/advancedban/utils/commands/ListProcessor.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public ListProcessor(Function<String, List<Punishment>> listSupplier, String con
3030
@Override
3131
public void accept(Command.CommandInput input) {
3232
String target = "";
33+
String name = input.getPrimary();
3334
if (hasTarget) {
3435
target = input.getPrimary();
3536
if (!target.matches("^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$")) {
@@ -45,7 +46,7 @@ public void accept(Command.CommandInput input) {
4546
final List<Punishment> punishments = listSupplier.apply(target);
4647
if (punishments.isEmpty()) {
4748
MessageManager.sendMessage(input.getSender(), config + ".NoEntries",
48-
true, "NAME", target);
49+
true, "NAME", name);
4950
return;
5051
}
5152

@@ -62,7 +63,7 @@ public void accept(Command.CommandInput input) {
6263

6364
String prefix = MessageManager.getMessage("General.Prefix");
6465
List<String> header = MessageManager.getLayout(mi.getMessages(), config + ".Header",
65-
"PREFIX", prefix, "NAME", target);
66+
"PREFIX", prefix, "NAME", name);
6667

6768
for (String line : header)
6869
mi.sendMessage(input.getSender(), line);
@@ -72,9 +73,10 @@ public void accept(Command.CommandInput input) {
7273

7374
for (int i = (page - 1) * 5; i < page * 5 && punishments.size() > i; i++) {
7475
Punishment punishment = punishments.get(i);
76+
String nameOrIp = punishment.getType().isIpOrientated() ? punishment.getName() + " / " +punishment.getUuid() : punishment.getName();
7577
List<String> entryLayout = MessageManager.getLayout(mi.getMessages(), config + ".Entry",
7678
"PREFIX", prefix,
77-
"NAME", punishment.getName(),
79+
"NAME", nameOrIp,
7880
"DURATION", punishment.getDuration(history),
7981
"OPERATOR", punishment.getOperator(),
8082
"REASON", punishment.getReason(),
@@ -92,7 +94,7 @@ public void accept(Command.CommandInput input) {
9294
"COUNT", punishments.size() + "");
9395
if (punishments.size() / 5.0 + 1 > page + 1) {
9496
MessageManager.sendMessage(input.getSender(), config + ".PageFooter", false,
95-
"NEXT_PAGE", (page + 1) + "", "NAME", target);
97+
"NEXT_PAGE", (page + 1) + "", "NAME", name);
9698
}
9799
}
98100
}

0 commit comments

Comments
 (0)