mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-27 10:31:31 +01:00
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
This commit is contained in:
parent
a48f6c8c30
commit
5020f6b990
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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}
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user