mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-28 03:57:48 +01:00
Forgot to update plugin syntax.
Added missing perm checks.
This commit is contained in:
parent
051af644a7
commit
32fa834f3f
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user