diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-05-19 22:02:42 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-05-19 22:02:42 +0100 |
commit | 32fa834f3f27288a5c272bda0a931e4f391dcaaa (patch) | |
tree | f64ca1878e2a33cce9207d8f13323bfa14b5918f | |
parent | 051af644a7e73c327fc44a182281068f405dde11 (diff) | |
download | Essentials-32fa834f3f27288a5c272bda0a931e4f391dcaaa.tar Essentials-32fa834f3f27288a5c272bda0a931e4f391dcaaa.tar.gz Essentials-32fa834f3f27288a5c272bda0a931e4f391dcaaa.tar.lz Essentials-32fa834f3f27288a5c272bda0a931e4f391dcaaa.tar.xz Essentials-32fa834f3f27288a5c272bda0a931e4f391dcaaa.zip |
Forgot to update plugin syntax.
Added missing perm checks.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandexp.java | 50 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 4 | ||||
-rw-r--r-- | Essentials/src/plugin.yml | 2 |
3 files changed, 28 insertions, 28 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index 2ca0ec1b5..22976ff92 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -15,38 +15,16 @@ public class Commandexp extends EssentialsCommand super("exp");
}
- private void showExp(final User user, final User target)
- {
- final int totalExp = SetExpFix.getTotalExperience(target);
- final int expLeft = (int)Util.roundDouble(((((3.5 * target.getLevel()) + 6.7) - (totalExp - ((1.75 * (target.getLevel() * target.getLevel())) + (5.00 * target.getLevel())))) + 1));
- user.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), expLeft));
- }
-
- private void setExp(final User user, final User target, final String strAmount, final boolean give)
- {
- Long amount = Long.parseLong(strAmount);
- if (give)
- {
- amount += SetExpFix.getTotalExperience(target);
- }
- if (amount > Integer.MAX_VALUE) {
- amount = (long)Integer.MAX_VALUE;
- }
- SetExpFix.setTotalExperience(target, amount.intValue());
- user.sendMessage(_("expset", target.getDisplayName(), amount));
- }
-
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length == 0)
{
showExp(user, user);
- return;
}
- if (args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set"))
+ else if (args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set"))
{
- if (args.length == 3)
+ if (args.length == 3 && user.isAuthorized("essentials.exp.set.others"))
{
Boolean foundUser = false;
for (Player matchPlayer : server.matchPlayer(args[1]))
@@ -65,7 +43,7 @@ public class Commandexp extends EssentialsCommand }
else if (args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give"))
{
- if (args.length == 3)
+ if (args.length == 3 && user.isAuthorized("essentials.exp.give.others"))
{
Boolean foundUser = false;
for (Player matchPlayer : server.matchPlayer(args[1]))
@@ -101,4 +79,26 @@ public class Commandexp extends EssentialsCommand }
}
}
+
+ private void showExp(final User user, final User target)
+ {
+ final int totalExp = SetExpFix.getTotalExperience(target);
+ final int expLeft = (int)Util.roundDouble(((((3.5 * target.getLevel()) + 6.7) - (totalExp - ((1.75 * (target.getLevel() * target.getLevel())) + (5.00 * target.getLevel())))) + 1));
+ user.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), expLeft));
+ }
+
+ private void setExp(final User user, final User target, final String strAmount, final boolean give)
+ {
+ Long amount = Long.parseLong(strAmount);
+ if (give)
+ {
+ amount += SetExpFix.getTotalExperience(target);
+ }
+ if (amount > Integer.MAX_VALUE)
+ {
+ amount = (long)Integer.MAX_VALUE;
+ }
+ SetExpFix.setTotalExperience(target, amount.intValue());
+ user.sendMessage(_("expSet", target.getDisplayName(), amount));
+ }
}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 317fe6dc4..0e941cc58 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -85,8 +85,8 @@ errorWithMessage=\u00a7cError: {0} essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Reloaded {0} -exp=\u00a7c{0}\u00a77 has \u00a7c{1} \u00a77exp (level {2}) and needs \u00a7c{3} \u00a77more exp to level up. -expset=\u00a7c{0} \u00a77now has \u00a7c{1} \u00a77exp. +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. extinguish=\u00a77You extinguished yourself. extinguishOthers=\u00a77You extinguished {0}. failedToCloseConfig=Failed to close config {0} diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index f778ab4dc..bfa7ee602 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -93,7 +93,7 @@ commands: aliases: [ess] exp: description: Give, set or look at a players exp. - usage: /<command> [show|set|give|fix] [playername [amount]] + usage: /<command> [show|set|give] [playername [amount]] aliases: [eexp,xp] ext: description: Extinguish players. |