diff options
author | kukelekuuk00 <luuk3904@hotmail.com> | 2012-05-13 13:44:41 +0200 |
---|---|---|
committer | kukelekuuk00 <luuk3904@hotmail.com> | 2012-05-13 13:44:41 +0200 |
commit | 5020f6b990e0657406d1677bd88ef4bb905dce6e (patch) | |
tree | eb6d86a1a4f935cceae236119e9dd7b65496c5fc | |
parent | a48f6c8c30ed3ebb1a79982158c155e013286e7d (diff) | |
download | Essentials-5020f6b990e0657406d1677bd88ef4bb905dce6e.tar Essentials-5020f6b990e0657406d1677bd88ef4bb905dce6e.tar.gz Essentials-5020f6b990e0657406d1677bd88ef4bb905dce6e.tar.lz Essentials-5020f6b990e0657406d1677bd88ef4bb905dce6e.tar.xz Essentials-5020f6b990e0657406d1677bd88ef4bb905dce6e.zip |
Added an /exp command that shows the amount of exp you have and how much you need for the next level.
Permissions are essentials.exp and essentials.exp.needed
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandexp.java | 39 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 2 | ||||
-rw-r--r-- | Essentials/src/plugin.yml | 4 |
3 files changed, 45 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java new file mode 100644 index 000000000..15efc02f7 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -0,0 +1,39 @@ +package com.earth2me.essentials.commands;
+
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
+import com.earth2me.essentials.craftbukkit.SetExpFix;
+import org.bukkit.Server;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+
+public class Commandexp extends EssentialsCommand
+{
+ public Commandexp()
+ {
+ super("exp");
+ }
+
+ @Override
+ public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args)throws Exception
+ {
+ for (Player onlinePlayer : server.getOnlinePlayers())
+ {
+ final User user = ess.getUser(onlinePlayer);
+ {
+ if (user.isAuthorized("essentials.exp.needed"))
+ {
+ int totalexp = SetExpFix.getTotalExperience(user);
+ int expleft = (int)Util.roundDouble(((((3.5 * user.getLevel()) + 6.7) - (totalexp - ((1.75 *(user.getLevel() * user.getLevel())) + (5.00 * user.getLevel())))) + 1));
+ sender.sendMessage(_("expneeded", SetExpFix.getTotalExperience(user),"" + expleft));
+ }
+ else if (user.isAuthorized("essentials.exp"))
+ {
+ sender.sendMessage(_("exp", SetExpFix.getTotalExperience(user)));
+ }
+ }
+ }
+ }
+}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 73ce00bee..21390d893 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -85,6 +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=\u00a79You have \u00a7c{0} \u00a79exp. +expneeded=\u00a79You have \u00a7c{0} \u00a79exp and you need \u00a7c{1} more to level up. 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 3e1dc52c0..6b1e8a038 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -90,6 +90,10 @@ commands: essentials: description: Reloads essentials. usage: /<command> + exp: + description: States how much exp you have. + usage: /<command> + aliases: [eexp] ext: description: Extinguish players. usage: /<command> [player] |