mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-26 13:17:49 +00:00
new command /exp [set|give|player] [player] [amount]
perms are essentials.exp, essentials.exp.others, essentials.exp.set, essentials.exp.set.others, essentials.exp.give and essentials.exp.give.others
This commit is contained in:
parent
5020f6b990
commit
16fc88b50c
|
@ -8,7 +8,6 @@ import org.bukkit.Server;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandexp extends EssentialsCommand
|
||||
{
|
||||
public Commandexp()
|
||||
|
@ -23,16 +22,63 @@ public class Commandexp extends EssentialsCommand
|
|||
{
|
||||
final User user = ess.getUser(onlinePlayer);
|
||||
{
|
||||
if (user.isAuthorized("essentials.exp.needed"))
|
||||
if (args.length < 1 && user.isAuthorized("essentials.exp"))
|
||||
{
|
||||
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));
|
||||
sender.sendMessage(_("exp", SetExpFix.getTotalExperience(user), expleft));
|
||||
}
|
||||
else if (user.isAuthorized("essentials.exp"))
|
||||
if (args.length == 1 && user.isAuthorized("essentials.exp.others"))
|
||||
{
|
||||
sender.sendMessage(_("exp", SetExpFix.getTotalExperience(user)));
|
||||
}
|
||||
for (Player p : server.matchPlayer(args[0]))
|
||||
{
|
||||
User player = getPlayer(server, args, 1);
|
||||
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(_("expothers", player.getDisplayName(), SetExpFix.getTotalExperience(p), expleft));
|
||||
}
|
||||
}
|
||||
if(args.length >= 1)
|
||||
if (args[0].equalsIgnoreCase("set"))
|
||||
{
|
||||
if (args.length >= 2)
|
||||
for (Player p : server.matchPlayer(args[1]))
|
||||
if ((args.length == 3) && (user.isAuthorized("essentials.exp.set.others")))
|
||||
{
|
||||
User player = getPlayer(server, args, 1);
|
||||
int exp = Integer.parseInt(args[2]);
|
||||
SetExpFix.setTotalExperience(p, exp);
|
||||
sender.sendMessage(_("expsetothers", player.getDisplayName(), exp));
|
||||
}
|
||||
else if ((args.length == 2) && (user.isAuthorized("essentials.exp.set")))
|
||||
{
|
||||
int exp = Integer.parseInt(args[1]);
|
||||
SetExpFix.setTotalExperience(user, exp);
|
||||
sender.sendMessage(_("expset", exp));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("give"))
|
||||
{
|
||||
if (args.length >= 2)
|
||||
for (Player p : server.matchPlayer(args[1]))
|
||||
if ((args.length == 3) && (user.isAuthorized("essentials.exp.give.others")))
|
||||
{
|
||||
User player = getPlayer(server, args, 1);
|
||||
int amount = Integer.parseInt(args[2]);
|
||||
p.giveExp(amount);
|
||||
sender.sendMessage(_("expgiveothers", player.getDisplayName(), amount));
|
||||
}
|
||||
else if ((args.length == 2) && (user.isAuthorized("essentials.exp.give")))
|
||||
{
|
||||
int amount = Integer.parseInt(args[1]);
|
||||
user.giveExp(amount);
|
||||
sender.sendMessage(_("expgive", amount));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,8 +85,12 @@ 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.
|
||||
exp=\u00a77You have \u00a7c{0} \u00a77exp and you need \u00a7c{1}\u00a77 more exp to level up.
|
||||
expgive=\u00a77You have given yourself {0}\u00a77 exp.
|
||||
expgiveothers=\u00a77You have given \u00a7c{0} {1}\u00a77 exp.
|
||||
expothers=\u00a7c{0}\u00a77 has \u00a7c{1} \u00a77exp and needs \u00a7c{2} \u00a77more exp to level up.
|
||||
expset=\u00a77You now have \u00a7c{0} \u00a77exp.
|
||||
expsetothers=\u00a7c{0} \u00a77now has \u00a7c{1} \u00a77exp.
|
||||
extinguish=\u00a77You extinguished yourself.
|
||||
extinguishOthers=\u00a77You extinguished {0}.
|
||||
failedToCloseConfig=Failed to close config {0}
|
||||
|
|
|
@ -91,8 +91,8 @@ commands:
|
|||
description: Reloads essentials.
|
||||
usage: /<command>
|
||||
exp:
|
||||
description: States how much exp you have.
|
||||
usage: /<command>
|
||||
description: States how much exp you have and how much you need to level up.
|
||||
usage: /<command> [player|set|give] [playername] [amount]
|
||||
aliases: [eexp]
|
||||
ext:
|
||||
description: Extinguish players.
|
||||
|
|
Loading…
Reference in a new issue