mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-26 01:51:42 +01: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
@ -23,7 +23,7 @@ public class Commandbalance extends EssentialsCommand {
|
|||||||
throw new NotEnoughArgumentsException();
|
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)));
|
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)) {
|
if (getHidden || canInteractWith(sourceUser, user)) {
|
||||||
return 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();
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user