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: / + exp: + description: States how much exp you have. + usage: / + aliases: [eexp] ext: description: Extinguish players. usage: / [player]