diff options
author | okamosy <okamosy@gmail.com> | 2011-08-11 15:03:08 +0100 |
---|---|---|
committer | okamosy <okamosy@gmail.com> | 2011-08-11 15:03:08 +0100 |
commit | 8dccf1798a5c9cc45eaad7dd0cab97cce4844efa (patch) | |
tree | f7fe347be0c6995d1e2d38a9b0c3606f6f21c36e | |
parent | 7e314f5d0163bfee4063b851f41a0856b08a8878 (diff) | |
download | Essentials-8dccf1798a5c9cc45eaad7dd0cab97cce4844efa.tar Essentials-8dccf1798a5c9cc45eaad7dd0cab97cce4844efa.tar.gz Essentials-8dccf1798a5c9cc45eaad7dd0cab97cce4844efa.tar.lz Essentials-8dccf1798a5c9cc45eaad7dd0cab97cce4844efa.tar.xz Essentials-8dccf1798a5c9cc45eaad7dd0cab97cce4844efa.zip |
added error message when attempting to pay a user that isn't online
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandpay.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index 4f52eee58..9be844996 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import org.bukkit.Server; import org.bukkit.entity.Player; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; public class Commandpay extends EssentialsCommand @@ -22,6 +23,7 @@ public class Commandpay extends EssentialsCommand double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", "")); + Boolean foundUser = false; for (Player p : server.matchPlayer(args[0])) { User u = ess.getUser(p); @@ -30,6 +32,11 @@ public class Commandpay extends EssentialsCommand continue; } user.payUser(u, amount); + foundUser = true; + } + + if(foundUser == false) { + throw new NoSuchFieldException(Util.i18n("playerNotFound")); } } } |