mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Add whitelist indicator for /seen and /whois (#5486)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
parent
e3e52db10e
commit
bb2df0b0a4
@ -32,6 +32,7 @@ public class Commandseen extends EssentialsCommand {
|
||||
final boolean showBan = sender.isAuthorized("essentials.seen.banreason", ess);
|
||||
final boolean showIp = sender.isAuthorized("essentials.seen.ip", ess);
|
||||
final boolean showLocation = sender.isAuthorized("essentials.seen.location", ess);
|
||||
final boolean showWhitelist = sender.isAuthorized("essentials.seen.whitelist", ess);
|
||||
final boolean searchAccounts = commandLabel.contains("alts") && sender.isAuthorized("essentials.seen.alts", ess);
|
||||
|
||||
User player;
|
||||
@ -79,21 +80,21 @@ public class Commandseen extends EssentialsCommand {
|
||||
}
|
||||
|
||||
private void showUserSeen(final User user) throws Exception {
|
||||
showSeenMessage(sender, user, searchAccounts, showBan, showIp, showLocation);
|
||||
showSeenMessage(sender, user, searchAccounts, showBan, showIp, showLocation, showWhitelist);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showSeenMessage(sender, player, searchAccounts, showBan, showIp, showLocation);
|
||||
showSeenMessage(sender, player, searchAccounts, showBan, showIp, showLocation, showWhitelist);
|
||||
}
|
||||
}
|
||||
|
||||
private void showSeenMessage(final CommandSource sender, final User player, final boolean searchAccounts, final boolean showBan, final boolean showIp, final boolean showLocation) {
|
||||
private void showSeenMessage(final CommandSource sender, final User player, final boolean searchAccounts, final boolean showBan, final boolean showIp, final boolean showLocation, final boolean showWhitelist) {
|
||||
if (searchAccounts) {
|
||||
seenIP(sender, player.getLastLoginAddress(), player.getDisplayName());
|
||||
} else if (player.getBase().isOnline() && canInteractWith(sender, player)) {
|
||||
seenOnline(sender, player, showIp);
|
||||
} else {
|
||||
seenOffline(sender, player, showBan, showIp, showLocation);
|
||||
seenOffline(sender, player, showBan, showIp, showLocation, showWhitelist);
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +135,7 @@ public class Commandseen extends EssentialsCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private void seenOffline(final CommandSource sender, final User user, final boolean showBan, final boolean showIp, final boolean showLocation) {
|
||||
private void seenOffline(final CommandSource sender, final User user, final boolean showBan, final boolean showIp, final boolean showLocation, final boolean showWhitelist) {
|
||||
user.setDisplayNick();
|
||||
if (user.getLastLogout() > 0) {
|
||||
sender.sendMessage(tl("seenOffline", user.getName(), DateUtil.formatDateDiff(user.getLastLogout())));
|
||||
@ -150,6 +151,10 @@ public class Commandseen extends EssentialsCommand {
|
||||
sender.sendMessage(tl("userUnknown", user.getName()));
|
||||
}
|
||||
|
||||
if (showWhitelist) {
|
||||
sender.sendMessage(tl("whoisWhitelist", user.getBase().isWhitelisted() ? tl("true") : tl("false")));
|
||||
}
|
||||
|
||||
if (BanLookup.isBanned(ess, user)) {
|
||||
final BanEntry banEntry = BanLookup.getBanEntry(ess, user.getName());
|
||||
final String reason = showBan ? banEntry.getReason() : tl("true");
|
||||
|
@ -57,6 +57,7 @@ public class Commandwhois extends EssentialsCommand {
|
||||
sender.sendMessage(tl("whoisOp", user.getBase().isOp() ? tl("true") : tl("false")));
|
||||
sender.sendMessage(tl("whoisFly", user.getBase().getAllowFlight() ? tl("true") : tl("false"), user.getBase().isFlying() ? tl("flying") : tl("notFlying")));
|
||||
sender.sendMessage(tl("whoisSpeed", user.getBase().isFlying() ? user.getBase().getFlySpeed() : user.getBase().getWalkSpeed()));
|
||||
sender.sendMessage(tl("whoisWhitelist", user.getBase().isWhitelisted() ? tl("true") : tl("false")));
|
||||
if (user.isAfk()) {
|
||||
sender.sendMessage(tl("whoisAFKSince", tl("true"), DateUtil.formatDateDiff(user.getAfkSince())));
|
||||
} else {
|
||||
|
@ -1569,6 +1569,7 @@ whoisPlaytime=\u00a76 - Playtime\:\u00a7r {0}
|
||||
whoisTempBanned=\u00a76 - Ban expires\:\u00a7r {0}
|
||||
whoisTop=\u00a76 \=\=\=\=\=\= WhoIs\:\u00a7c {0} \u00a76\=\=\=\=\=\=
|
||||
whoisUuid=\u00a76 - UUID\:\u00a7r {0}
|
||||
whoisWhitelist=\u00a76 - Whitelist\:\u00a7r {0}
|
||||
workbenchCommandDescription=Opens up a workbench.
|
||||
workbenchCommandUsage=/<command>
|
||||
worldCommandDescription=Switch between worlds.
|
||||
|
@ -638,6 +638,7 @@ permissions:
|
||||
essentials.seen.ip: true
|
||||
essentials.seen.location: true
|
||||
essentials.seen.uuid: true
|
||||
essentials.seen.whitelist: true
|
||||
essentials.keepinv:
|
||||
default: false
|
||||
description: Controls whether players keep their inventory on death.
|
||||
|
Loading…
Reference in New Issue
Block a user