1
0
Fork 0
mirror of https://github.com/xHyroM/lighteco.git synced 2024-12-22 12:31:05 +01:00

fix(pay): add check if you're trying to pay yourself

This commit is contained in:
Jozef Steinhübl 2023-08-27 14:05:04 +02:00
parent a99fb995e4
commit c902a6a989

View file

@ -114,6 +114,14 @@ public abstract class AbstractCommandManager implements CommandManager {
@Override
public void onPay(CommandSender sender, Currency currency, User target, BigDecimal amount) {
if (sender.getUniqueId() != null && (sender.getUniqueId() == target.getUniqueId())) {
sender.sendMessage(
miniMessage.deserialize("<red>You cannot pay yourself!")
);
return;
}
addToMustWait(sender.getUniqueId(), target.getUniqueId());
User user = this.plugin.getUserManager().getIfLoaded(sender.getUniqueId());