mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 12:23:59 +00:00
added error message when attempting to pay a user that isn't online
This commit is contained in:
parent
576b48c08c
commit
6ec674d0a3
1 changed files with 7 additions and 0 deletions
|
@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.Util;
|
||||||
|
|
||||||
|
|
||||||
public class Commandpay extends EssentialsCommand
|
public class Commandpay extends EssentialsCommand
|
||||||
|
@ -22,6 +23,7 @@ public class Commandpay extends EssentialsCommand
|
||||||
|
|
||||||
double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", ""));
|
double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", ""));
|
||||||
|
|
||||||
|
Boolean foundUser = false;
|
||||||
for (Player p : server.matchPlayer(args[0]))
|
for (Player p : server.matchPlayer(args[0]))
|
||||||
{
|
{
|
||||||
User u = ess.getUser(p);
|
User u = ess.getUser(p);
|
||||||
|
@ -30,6 +32,11 @@ public class Commandpay extends EssentialsCommand
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
user.payUser(u, amount);
|
user.payUser(u, amount);
|
||||||
|
foundUser = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(foundUser == false) {
|
||||||
|
throw new NoSuchFieldException(Util.i18n("playerNotFound"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue