From 7adb931ea8dbcc0c37052f3c0e996e8d8b54310e Mon Sep 17 00:00:00 2001 From: Xeyame <34656654+Xeyame@users.noreply.github.com> Date: Mon, 2 Apr 2018 14:29:43 +0200 Subject: [PATCH] Expand /exp command --- .../essentials/commands/Commandexp.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index 8d915de62..aeb631d40 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -36,6 +36,18 @@ public class Commandexp extends EssentialsCommand { } else { setExp(user.getSource(), user, args[1], true); } + } else if (args.length > 1 && args[0].equalsIgnoreCase("take") && user.isAuthorized("essentials.exp.take")) { + if (args.length == 3 && user.isAuthorized("essentials.exp.take.others")) { + expMatch(server, user.getSource(), args[1], "-" + args[2], true); + } else { + setExp(user.getSource(), user, "-" + args[1], true); + } + } else if (args.length < 3 && args[0].equalsIgnoreCase("reset") && user.isAuthorized("essentials.exp.reset")) { + if (args.length == 2 && user.isAuthorized("essentials.exp.reset.others")) { + expMatch(server, user.getSource(), args[1], "0", false); + } else { + setExp(user.getSource(), user, "0", false); + } } else if (args[0].equalsIgnoreCase("show")) { if (args.length >= 2 && user.isAuthorized("essentials.exp.others")) { String match = args[1].trim(); @@ -159,6 +171,12 @@ public class Commandexp extends EssentialsCommand { if (user.isAuthorized("essentials.exp.give")) { options.add("give"); } + if (user.isAuthorized("essentials.exp.take")) { + options.add("take"); + } + if (user.isAuthorized("essentials.exp.reset")) { + options.add("reset"); + } return options; } else if (args.length == 2) { if ((args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set")) || (args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give"))) { @@ -184,7 +202,7 @@ public class Commandexp extends EssentialsCommand { protected List getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) { if (args.length == 1) { // TODO: This seems somewhat buggy, both setting and showing - right now, ignoring that - return Lists.newArrayList("set", "give", "show"); + return Lists.newArrayList("set", "give", "show", "take", "reset"); } else if (args.length == 2) { if (args[0].equalsIgnoreCase("set") || args[0].equalsIgnoreCase("give")) { String levellessArg = args[1].toLowerCase(Locale.ENGLISH).replace("l", "");