summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandexp.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java
index fc043f3a0..e8c187d29 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java
@@ -149,6 +149,7 @@ public class Commandexp extends EssentialsCommand
sender.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), SetExpFix.getExpUntilNextLevel(target)));
}
+ //TODO: Limit who can give negative exp?
private void setExp(final CommandSender sender, final User target, String strAmount, final boolean give) throws NotEnoughArgumentsException
{
long amount;
@@ -167,7 +168,7 @@ public class Commandexp extends EssentialsCommand
else
{
amount = Long.parseLong(strAmount);
- if (amount < 0 || amount > Integer.MAX_VALUE)
+ if (amount > Integer.MAX_VALUE || amount < Integer.MIN_VALUE)
{
throw new NotEnoughArgumentsException();
}
@@ -181,6 +182,10 @@ public class Commandexp extends EssentialsCommand
{
amount = (long)Integer.MAX_VALUE;
}
+ if (amount < 0l)
+ {
+ amount = 0l;
+ }
SetExpFix.setTotalExperience(target, (int)amount);
sender.sendMessage(_("expSet", target.getDisplayName(), amount));
}