mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-01-07 07:41:03 +00:00
Don't show hidden players in /balance unless exact name entered (#3218)
Fixes #2305 Not looking for hidden players within the command, yet looking for offline players. Only matching a hidden player if the name match was exact (i.e not matching nicknames).
This commit is contained in:
parent
283c088b21
commit
b19dec120a
2 changed files with 5 additions and 1 deletions
|
@ -23,7 +23,7 @@ public class Commandbalance extends EssentialsCommand {
|
|||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
User target = getPlayer(server, args, 0, true, true);
|
||||
User target = getPlayer(server, args, 0, false, true);
|
||||
sender.sendMessage(tl("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(target.getMoney(), ess)));
|
||||
}
|
||||
|
||||
|
|
|
@ -124,6 +124,10 @@ public abstract class EssentialsCommand implements IEssentialsCommand {
|
|||
|
||||
if (getHidden || canInteractWith(sourceUser, user)) {
|
||||
return user;
|
||||
} else { // not looking for hidden and cannot interact (i.e is hidden)
|
||||
if (getOffline && user.getName().equalsIgnoreCase(searchTerm)) { // if looking for offline and got an exact match
|
||||
return user;
|
||||
}
|
||||
}
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue