From ee41d3bf3893c7968e654d94bd11fa000b0478e8 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 15 Aug 2020 14:20:41 +0200 Subject: [PATCH] !Moved command API over to MMOLib --- lib/MMOLib.jar | Bin 276515 -> 284741 bytes .../java/net/Indyuce/mmocore/MMOCore.java | 4 +- .../mmocore/command/MMOCoreCommand.java | 60 --------- .../command/MMOCoreCommandTreeRoot.java | 38 ++++++ .../mmocore/command/api/CommandEnd.java | 27 ---- .../mmocore/command/api/CommandMap.java | 125 ------------------ .../mmocore/command/api/CommandRoot.java | 64 --------- .../mmocore/command/api/Parameter.java | 62 --------- ...mandMap.java => CoinsCommandTreeNode.java} | 9 +- ...mmandMap.java => NoteCommandTreeNode.java} | 13 +- ...andMap.java => ReloadCommandTreeNode.java} | 7 +- .../command/rpg/admin/AdminCommandMap.java | 35 ----- .../rpg/admin/AdminCommandTreeNode.java | 35 +++++ ...mandMap.java => ClassCommandTreeNode.java} | 15 ++- ...ap.java => ExperienceCommandTreeNode.java} | 33 +++-- ...java => HideActionBarCommandTreeNode.java} | 9 +- ...mmandMap.java => InfoCommandTreeNode.java} | 9 +- ...mandMap.java => LevelCommandTreeNode.java} | 31 +++-- ...ap.java => NoCooldownCommandTreeNode.java} | 9 +- ...andMap.java => PointsCommandTreeNode.java} | 21 +-- ...mandMap.java => ResetCommandTreeNode.java} | 45 +++---- ...dMap.java => ResourceCommandTreeNode.java} | 23 ++-- .../rpg/booster/BoosterCommandMap.java | 20 --- .../rpg/booster/BoosterCommandTreeNode.java | 20 +++ ...andMap.java => CreateCommandTreeNode.java} | 20 +-- ...mmandMap.java => ListCommandTreeNode.java} | 15 ++- ...andMap.java => RemoveCommandTreeNode.java} | 12 +- ...mandMap.java => DebugCommandTreeNode.java} | 10 +- ...java => StatModifiersCommandTreeNode.java} | 11 +- ...Map.java => StatValueCommandTreeNode.java} | 17 ++- ...andEnd.java => CancelCommandTreeNode.java} | 9 +- .../command/rpg/quest/QuestCommandMap.java | 20 --- .../rpg/quest/QuestCommandTreeNode.java | 20 +++ ...mandEnd.java => StartCommandTreeNode.java} | 12 +- ...mmandMap.java => OpenCommandTreeNode.java} | 9 +- ...andMap.java => UnlockCommandTreeNode.java} | 14 +- .../rpg/waypoint/WaypointsCommandMap.java | 19 --- .../waypoint/WaypointsCommandTreeNode.java | 19 +++ 38 files changed, 316 insertions(+), 605 deletions(-) delete mode 100644 src/main/java/net/Indyuce/mmocore/command/MMOCoreCommand.java create mode 100644 src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java delete mode 100644 src/main/java/net/Indyuce/mmocore/command/api/CommandEnd.java delete mode 100644 src/main/java/net/Indyuce/mmocore/command/api/CommandMap.java delete mode 100644 src/main/java/net/Indyuce/mmocore/command/api/CommandRoot.java delete mode 100644 src/main/java/net/Indyuce/mmocore/command/api/Parameter.java rename src/main/java/net/Indyuce/mmocore/command/rpg/{CoinsCommandMap.java => CoinsCommandTreeNode.java} (80%) rename src/main/java/net/Indyuce/mmocore/command/rpg/{NoteCommandMap.java => NoteCommandTreeNode.java} (72%) rename src/main/java/net/Indyuce/mmocore/command/rpg/{ReloadCommandMap.java => ReloadCommandTreeNode.java} (83%) delete mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandMap.java create mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java rename src/main/java/net/Indyuce/mmocore/command/rpg/admin/{ClassCommandMap.java => ClassCommandTreeNode.java} (67%) rename src/main/java/net/Indyuce/mmocore/command/rpg/admin/{ExperienceCommandMap.java => ExperienceCommandTreeNode.java} (64%) rename src/main/java/net/Indyuce/mmocore/command/rpg/admin/{HideActionBarCommandMap.java => HideActionBarCommandTreeNode.java} (78%) rename src/main/java/net/Indyuce/mmocore/command/rpg/admin/{InfoCommandMap.java => InfoCommandTreeNode.java} (90%) rename src/main/java/net/Indyuce/mmocore/command/rpg/admin/{LevelCommandMap.java => LevelCommandTreeNode.java} (65%) rename src/main/java/net/Indyuce/mmocore/command/rpg/admin/{NoCooldownCommandMap.java => NoCooldownCommandTreeNode.java} (77%) rename src/main/java/net/Indyuce/mmocore/command/rpg/admin/{PointsCommandMap.java => PointsCommandTreeNode.java} (66%) rename src/main/java/net/Indyuce/mmocore/command/rpg/admin/{ResetCommandMap.java => ResetCommandTreeNode.java} (81%) rename src/main/java/net/Indyuce/mmocore/command/rpg/admin/{ResourceCommandMap.java => ResourceCommandTreeNode.java} (64%) delete mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandMap.java create mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java rename src/main/java/net/Indyuce/mmocore/command/rpg/booster/{CreateCommandMap.java => CreateCommandTreeNode.java} (74%) rename src/main/java/net/Indyuce/mmocore/command/rpg/booster/{ListCommandMap.java => ListCommandTreeNode.java} (51%) rename src/main/java/net/Indyuce/mmocore/command/rpg/booster/{RemoveCommandMap.java => RemoveCommandTreeNode.java} (71%) rename src/main/java/net/Indyuce/mmocore/command/rpg/debug/{DebugCommandMap.java => DebugCommandTreeNode.java} (60%) rename src/main/java/net/Indyuce/mmocore/command/rpg/debug/{StatModifiersCommandMap.java => StatModifiersCommandTreeNode.java} (82%) rename src/main/java/net/Indyuce/mmocore/command/rpg/debug/{StatValueCommandMap.java => StatValueCommandTreeNode.java} (67%) rename src/main/java/net/Indyuce/mmocore/command/rpg/quest/{CancelCommandEnd.java => CancelCommandTreeNode.java} (79%) delete mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandMap.java create mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java rename src/main/java/net/Indyuce/mmocore/command/rpg/quest/{StartCommandEnd.java => StartCommandTreeNode.java} (80%) rename src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/{OpenCommandMap.java => OpenCommandTreeNode.java} (75%) rename src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/{UnlockCommandMap.java => UnlockCommandTreeNode.java} (73%) delete mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandMap.java create mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java diff --git a/lib/MMOLib.jar b/lib/MMOLib.jar index 5311a1d108efe3cfee9abd727656e640edcd6817..8acf11cfc2eb012587dab0faf4b7bb78480e9735 100644 GIT binary patch delta 15798 zcmaL82RxPU|37|~nZ5Vkd&??YL|Gv#J7kZDbRrblM{XK+L?Ve}6@_H4B(qQmS!FkV z_qmUT_vicn*Q4(1yq>Rhy{_weUDvtp*C|+|YI{sgZhR7nB8B1p9Py`2CFetuf)Ba7 z{QS0*CJ_1HKNR@%aSf9E%MWs-ZVDs82ZkFi3q392Le&2iq{EmHF#cl(&rgr(fO9}H zi*P0ADS*(1p56#m=*f)|1{}U4i7*og;@<=e6_WCQ3~*wm^;t2w0Yv{bf>S_=BETdf zNg)Ndk?PQM5~*>Z@F>#9n-bGRz>g7cA!hyCwNSsqo#(<-cCcWiS_r5e{X7nb0F!}| zgS7Ra)bLv2xV}*Vej0EBvOmFvdX3@-QrzJr|MBw*!7)g%i9qq-$q#%`KoI}KCIH4* zmQV$Wd-@X|M}k9DRYiCWiQ}(QA{{;gHK-YK5m4hPQ!T#X%Su29Q9`&;aHw&G=ME%= zVH22zBKe`U#lVON20KR$gQ@?o+ZN)kS z32wOWPKA3rVR99ffun>ds;VMoFFYr`+6%nZ(PQ86BK?|Vc<8q>Wg+dWj{m{?A^Jf^9<2C4=P9%W*88MH-cgfaf0}q+lDdM4ZduO^#X*KB7j0BizV$T!DQ=&LC$vzNw zYH^6@wwe=&wdEW5J7R)j209EqGb?vsXw8uFceVW@8eK6Lx{_&pL#XK7XcZ>0;k|X+ z-y-;$uAqOxKM1TWxjWTP$2XT+Jc~!K#>jgd-KsycQF>-2L)^aV(dEf2i$^LSp9xew zx1%f&XEX`>Q~UkDG+ilgD9*Sa-K9N{?s7WK z?%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)g)22{4eu6`0r1y7E(V=11TPtrlSa4Fh+c@=%iUMf?f)}` z8k5eblM4V}y-%Yvf%U3@u?z=6h4HNrSs|eQ9VGnPX=*+Lj2Hye*RvTF`ebaImUxv6 zu?AbG|Hsw?)kHKJ-`%gmrqw_gIJ4*;Zq9^i5Vw{H?p+no-VR01xM(Oe`+jA=+;Qtr=%$rCr@RP*P247~Jq8Yk7Z6JB{{WKw63GAn diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index c3646c6c..637685ce 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -25,7 +25,7 @@ import net.Indyuce.mmocore.command.ClassCommand; import net.Indyuce.mmocore.command.DepositCommand; import net.Indyuce.mmocore.command.FriendsCommand; import net.Indyuce.mmocore.command.GuildCommand; -import net.Indyuce.mmocore.command.MMOCoreCommand; +import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; import net.Indyuce.mmocore.command.PartyCommand; import net.Indyuce.mmocore.command.PlayerStatsCommand; import net.Indyuce.mmocore.command.QuestsCommand; @@ -341,7 +341,7 @@ public class MMOCore extends JavaPlugin { ex.printStackTrace(); } - MMOCoreCommand mmoCoreCommand = new MMOCoreCommand(); + MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot(); getCommand("mmocore").setExecutor(mmoCoreCommand); getCommand("mmocore").setTabCompleter(mmoCoreCommand); diff --git a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommand.java b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommand.java deleted file mode 100644 index 2c870325..00000000 --- a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommand.java +++ /dev/null @@ -1,60 +0,0 @@ -package net.Indyuce.mmocore.command; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import net.Indyuce.mmocore.command.api.CommandRoot; -import net.Indyuce.mmocore.command.rpg.CoinsCommandMap; -import net.Indyuce.mmocore.command.rpg.NoteCommandMap; -import net.Indyuce.mmocore.command.rpg.ReloadCommandMap; -import net.Indyuce.mmocore.command.rpg.admin.AdminCommandMap; -import net.Indyuce.mmocore.command.rpg.booster.BoosterCommandMap; -import net.Indyuce.mmocore.command.rpg.debug.DebugCommandMap; -import net.Indyuce.mmocore.command.rpg.quest.QuestCommandMap; -import net.Indyuce.mmocore.command.rpg.waypoint.WaypointsCommandMap; - -public class MMOCoreCommand extends CommandRoot implements CommandExecutor, TabCompleter { - public MMOCoreCommand() { - super("mmocore"); - - addFloor(new ReloadCommandMap(this)); - addFloor(new CoinsCommandMap(this)); - addFloor(new NoteCommandMap(this)); - addFloor(new AdminCommandMap(this)); - addFloor(new DebugCommandMap(this)); - addFloor(new BoosterCommandMap(this)); - addFloor(new WaypointsCommandMap(this)); - addFloor(new QuestCommandMap(this)); - } - - @Override - public CommandResult execute(CommandSender sender, String[] args) { - return CommandResult.THROW_USAGE; - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (!sender.hasPermission("mmocore.admin")) - return false; - - executeCommand(sender, args); - return true; - } - - @Override - public List onTabComplete(CommandSender sender, Command command, String label, String[] args) { - if (!sender.hasPermission("mmocore.admin")) - return new ArrayList<>(); - - CommandParser reader = readCommand(args); - List list = reader.readTabCompletion(); - return args[args.length - 1].isEmpty() ? list - : list.stream().filter(string -> string.toLowerCase().startsWith(args[args.length - 1].toLowerCase())).collect(Collectors.toList()); - } -} diff --git a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java new file mode 100644 index 00000000..58b1b8e8 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java @@ -0,0 +1,38 @@ +package net.Indyuce.mmocore.command; + +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.TabCompleter; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.command.rpg.CoinsCommandTreeNode; +import net.Indyuce.mmocore.command.rpg.NoteCommandTreeNode; +import net.Indyuce.mmocore.command.rpg.ReloadCommandTreeNode; +import net.Indyuce.mmocore.command.rpg.admin.AdminCommandTreeNode; +import net.Indyuce.mmocore.command.rpg.booster.BoosterCommandTreeNode; +import net.Indyuce.mmocore.command.rpg.debug.DebugCommandTreeNode; +import net.Indyuce.mmocore.command.rpg.quest.QuestCommandTreeNode; +import net.Indyuce.mmocore.command.rpg.waypoint.WaypointsCommandTreeNode; +import net.mmogroup.mmolib.command.api.CommandTreeRoot; +import net.mmogroup.mmolib.command.api.Parameter; + +public class MMOCoreCommandTreeRoot extends CommandTreeRoot implements CommandExecutor, TabCompleter { + public static final Parameter PROFESSION = new Parameter("", (explorer, list) -> { + MMOCore.plugin.professionManager.getAll().forEach(profession -> list.add(profession.getId())); + list.add("main"); + }); + public static final Parameter QUEST = new Parameter("", + (explorer, list) -> MMOCore.plugin.questManager.getAll().forEach(quest -> list.add(quest.getId()))); + + public MMOCoreCommandTreeRoot() { + super("mmocore", "mmocore.admin"); + + addChild(new ReloadCommandTreeNode(this)); + addChild(new CoinsCommandTreeNode(this)); + addChild(new NoteCommandTreeNode(this)); + addChild(new AdminCommandTreeNode(this)); + addChild(new DebugCommandTreeNode(this)); + addChild(new BoosterCommandTreeNode(this)); + addChild(new WaypointsCommandTreeNode(this)); + addChild(new QuestCommandTreeNode(this)); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/command/api/CommandEnd.java b/src/main/java/net/Indyuce/mmocore/command/api/CommandEnd.java deleted file mode 100644 index 8e9226ea..00000000 --- a/src/main/java/net/Indyuce/mmocore/command/api/CommandEnd.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.Indyuce.mmocore.command.api; - -import java.util.ArrayList; -import java.util.List; - -public abstract class CommandEnd extends CommandMap { - private final List parameters = new ArrayList<>(); - - public CommandEnd(CommandMap parent, String id) { - super(parent, id); - } - - public void addParameter(Parameter param) { - parameters.add(param); - } - - public List getParameters() { - return parameters; - } - - public String formatParameters() { - String str = ""; - for (Parameter param : parameters) - str += param.getKey() + " "; - return str.isEmpty() ? str : str.substring(0, str.length() - 1); - } -} diff --git a/src/main/java/net/Indyuce/mmocore/command/api/CommandMap.java b/src/main/java/net/Indyuce/mmocore/command/api/CommandMap.java deleted file mode 100644 index d45141c2..00000000 --- a/src/main/java/net/Indyuce/mmocore/command/api/CommandMap.java +++ /dev/null @@ -1,125 +0,0 @@ -package net.Indyuce.mmocore.command.api; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang.Validate; -import org.bukkit.command.CommandSender; - -public abstract class CommandMap { - private final Map floors = new HashMap<>(); - private final String id; - private final CommandMap parent; - - public static final CommandMap EMPTY = new CommandMap(null, "empty") { - public CommandResult execute(CommandSender sender, String[] args) { - return CommandResult.THROW_USAGE; - } - }; - - public CommandMap(CommandMap parent, String id) { - Validate.isTrue(!(parent instanceof CommandEnd), "You cannot use a CommandEnd as a parent"); - - this.id = id; - this.parent = parent; - } - - public String getId() { - return id; - } - - public String getPath() { - return (hasParent() ? parent.getPath() + " " : "") + getId(); - } - - public Collection getFloors() { - return floors.values(); - } - - public boolean hasParent() { - return parent != null; - } - - public CommandMap getFloor(String str) { - return floors.get(str.toLowerCase()); - } - - public boolean hasFloor(String str) { - return floors.containsKey(str.toLowerCase()); - } - - public void addFloor(CommandMap floor) { - floors.put(floor.getId(), floor); - } - - public Set getKeys() { - return floors.keySet(); - } - - public abstract CommandResult execute(CommandSender sender, String[] args); - - public List calculateTabCompletion(int parameterIndex) { - - /* - * add extra floor keys. only commandEnds can have parameters, that - * means commands must be clean and cannot have both floors and - * parameters to input - */ - List list = new ArrayList<>(); - getKeys().forEach(key -> list.add(key)); - - /* - * if the player is at the end of a command branch, display the - * parameter with the right index that the player must input - */ - if (isEnd() && ((CommandEnd) this).getParameters().size() > parameterIndex) - ((CommandEnd) this).getParameters().get(parameterIndex).autoComplete(list); - - return list; - } - - public List calculateUsageList() { - return calculateUsageList(getPath(), new ArrayList<>()); - } - - private List calculateUsageList(String path, List usages) { - - /* - * calculate for final arguments - */ - if (isEnd()) - usages.add(path + " " + ((CommandEnd) this).formatParameters()); - - for (CommandMap floor : getFloors()) - floor.calculateUsageList(new String(path + " " + floor.getId()), usages); - - return usages; - } - - public boolean isEnd() { - return this instanceof CommandEnd; - } - - public enum CommandResult { - - /* - * command cast successfully, nothing to do - */ - SUCCESS, - - /* - * command cast unsuccessfully, display message handled via command - * floor - */ - FAILURE, - - /* - * send command usage - */ - THROW_USAGE; - } -} diff --git a/src/main/java/net/Indyuce/mmocore/command/api/CommandRoot.java b/src/main/java/net/Indyuce/mmocore/command/api/CommandRoot.java deleted file mode 100644 index 7f0699b3..00000000 --- a/src/main/java/net/Indyuce/mmocore/command/api/CommandRoot.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.Indyuce.mmocore.command.api; - -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -public abstract class CommandRoot extends CommandMap { - public CommandRoot(String id) { - super(null, id); - } - - public void executeCommand(CommandSender sender, String[] args) { - CommandMap read = readCommand(args).read(); - - if (read.execute(sender, args) == CommandResult.THROW_USAGE) - read.calculateUsageList().forEach(str -> sender.sendMessage(ChatColor.YELLOW + "/" + str)); - } - - public CommandParser readCommand(String[] args) { - return new CommandParser(this, args); - } - - public class CommandParser { - private CommandMap current; - private int parameter = 0; - - /* - * used to parse a command and identify the commandMap which is supposed - * to - */ - public CommandParser(CommandRoot begin, String[] args) { - this.current = begin; - - for (String arg : args) - - /* - * check if current command floor has the corresponding arg, if - * so let the next floor handle the command. - */ - if (parameter == 0 && current.hasFloor(arg)) - current = current.getFloor(arg); - - /* - * if the plugin cannot find a command map higher, then the - * current floor will handle the command. - */ - else - parameter++; - } - - public CommandMap read() { - return current; - } - - public int extraCount() { - return parameter; - } - - public List readTabCompletion() { - return current.calculateTabCompletion(Math.max(0, parameter - 1)); - } - } -} diff --git a/src/main/java/net/Indyuce/mmocore/command/api/Parameter.java b/src/main/java/net/Indyuce/mmocore/command/api/Parameter.java deleted file mode 100644 index df4c1362..00000000 --- a/src/main/java/net/Indyuce/mmocore/command/api/Parameter.java +++ /dev/null @@ -1,62 +0,0 @@ -package net.Indyuce.mmocore.command.api; - -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.util.Consumer; - -import net.Indyuce.mmocore.MMOCore; - -public class Parameter { - private final String key; - // private final ParameterType type;ParameterType type, - private final Consumer> autoComplete; - - public static final Parameter PROFESSION = new Parameter("", list -> { - MMOCore.plugin.professionManager.getAll().forEach(profession -> list.add(profession.getId())); - list.add("main"); - }); - public static final Parameter PLAYER = new Parameter("", list -> Bukkit.getOnlinePlayers().forEach(online -> list.add(online.getName()))); - public static final Parameter QUEST = new Parameter("", - list -> MMOCore.plugin.questManager.getAll().forEach(quest -> list.add(quest.getId()))); - public static final Parameter PLAYER_OPTIONAL = new Parameter("(player)", - list -> Bukkit.getOnlinePlayers().forEach(online -> list.add(online.getName()))); - public static final Parameter AMOUNT = new Parameter("", list -> { - for (int j = 0; j <= 10; j++) - list.add("" + j); - }); - - public Parameter(String key, Consumer> autoComplete) { - this.key = key; - // this.type = type; - this.autoComplete = autoComplete; - } - - public String getKey() { - return key; - } - - // public ParameterType getType() { - // return type; - // } - - public void autoComplete(List list) { - autoComplete.accept(list); - } - - // public enum ParameterType { - // OPTIONAL('(', ')'), - // REQUIRED('<', '>'); - // - // private final char prefix, suffix; - // - // private ParameterType(char... chars) { - // this.prefix = chars[0]; - // this.suffix = chars[1]; - // } - // - // public String format(Parameter parameter) { - // return prefix + parameter.getKey() + suffix; - // } - // } -} \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java similarity index 80% rename from src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java index 2c4cb93d..96f9358a 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java @@ -6,13 +6,12 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.util.item.CurrencyItem; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; import net.mmogroup.mmolib.api.util.SmartGive; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class CoinsCommandMap extends CommandEnd { - public CoinsCommandMap(CommandMap parent) { +public class CoinsCommandTreeNode extends CommandTreeNode { + public CoinsCommandTreeNode(CommandTreeNode parent) { super(parent, "coins"); addParameter(Parameter.PLAYER); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java similarity index 72% rename from src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java index 5146d213..121bdf73 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java @@ -8,17 +8,17 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.util.item.CurrencyItem; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; import net.mmogroup.mmolib.api.util.SmartGive; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class NoteCommandMap extends CommandEnd { - public NoteCommandMap(CommandMap parent) { +public class NoteCommandTreeNode extends CommandTreeNode { + public NoteCommandTreeNode(CommandTreeNode parent) { super(parent, "note"); addParameter(Parameter.PLAYER); - addParameter(new Parameter("", (list) -> list.addAll(Arrays.asList("10", "20", "30", "40", "50", "60", "70", "80", "90", "100")))); + addParameter(new Parameter("", + (explorer, list) -> list.addAll(Arrays.asList("10", "20", "30", "40", "50", "60", "70", "80", "90", "100")))); } @Override @@ -43,5 +43,4 @@ public class NoteCommandMap extends CommandEnd { new SmartGive(player).give(new CurrencyItem("NOTE", worth).build()); return CommandResult.SUCCESS; } - } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java similarity index 83% rename from src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java index aeb87513..6a00fc05 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java @@ -5,11 +5,10 @@ import org.bukkit.command.CommandSender; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; +import net.mmogroup.mmolib.command.api.CommandTreeNode; -public class ReloadCommandMap extends CommandEnd { - public ReloadCommandMap(CommandMap parent) { +public class ReloadCommandTreeNode extends CommandTreeNode { + public ReloadCommandTreeNode(CommandTreeNode parent) { super(parent, "reload"); } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandMap.java deleted file mode 100644 index 7a46768a..00000000 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandMap.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.Indyuce.mmocore.command.rpg.admin; - -import org.bukkit.command.CommandSender; - -import net.Indyuce.mmocore.command.api.CommandMap; - -public class AdminCommandMap extends CommandMap { - public AdminCommandMap(CommandMap parent) { - super(parent, "admin"); - - addFloor(new HideActionBarCommandMap(this)); - addFloor(new NoCooldownCommandMap(this)); - addFloor(new ResetCommandMap(this)); - addFloor(new InfoCommandMap(this)); - addFloor(new ClassCommandMap(this)); - - addFloor(new ExperienceCommandMap(this)); - addFloor(new LevelCommandMap(this)); - - addFloor(new PointsCommandMap("skill", this, (data, points) -> data.setSkillPoints(points), (data, points) -> data.giveSkillPoints(points), (data) -> data.getSkillPoints())); - addFloor(new PointsCommandMap("class", this, (data, points) -> data.setClassPoints(points), (data, points) -> data.giveClassPoints(points), (data) -> data.getClassPoints())); - addFloor(new PointsCommandMap("attribute", this, (data, points) -> data.setAttributePoints(points), (data, points) -> data.giveAttributePoints(points), (data) -> data.getAttributePoints())); - addFloor(new PointsCommandMap("attr-realloc", this, (data, points) -> data.setAttributeReallocationPoints(points), (data, points) -> data.giveAttributeReallocationPoints(points), (data) -> data.getAttributeReallocationPoints())); - - addFloor(new ResourceCommandMap("health", this, (data, value) -> data.getPlayer().setHealth(value), (data, value) -> data.heal(value), (data, value) -> data.heal(-value), (data) -> data.getPlayer().getHealth())); - addFloor(new ResourceCommandMap("mana", this, (data, value) -> data.setMana(value), (data, value) -> data.giveMana(value), (data, value) -> data.giveMana(-value), (data) -> data.getMana())); - addFloor(new ResourceCommandMap("stamina", this, (data, value) -> data.setStamina(value), (data, value) -> data.giveStamina(value), (data, value) -> data.giveStamina(-value), (data) -> data.getStamina())); - addFloor(new ResourceCommandMap("stellium", this, (data, value) -> data.setStellium(value), (data, value) -> data.giveStellium(value), (data, value) -> data.giveStellium(-value), (data) -> data.getStellium())); - } - - @Override - public CommandResult execute(CommandSender sender, String[] args) { - return CommandResult.THROW_USAGE; - } -} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java new file mode 100644 index 00000000..3310229a --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java @@ -0,0 +1,35 @@ +package net.Indyuce.mmocore.command.rpg.admin; + +import org.bukkit.command.CommandSender; + +import net.mmogroup.mmolib.command.api.CommandTreeNode; + +public class AdminCommandTreeNode extends CommandTreeNode { + public AdminCommandTreeNode(CommandTreeNode parent) { + super(parent, "admin"); + + addChild(new HideActionBarCommandTreeNode(this)); + addChild(new NoCooldownCommandTreeNode(this)); + addChild(new ResetCommandTreeNode(this)); + addChild(new InfoCommandTreeNode(this)); + addChild(new ClassCommandTreeNode(this)); + + addChild(new ExperienceCommandTreeNode(this)); + addChild(new LevelCommandTreeNode(this)); + + addChild(new PointsCommandTreeNode("skill", this, (data, points) -> data.setSkillPoints(points), (data, points) -> data.giveSkillPoints(points), (data) -> data.getSkillPoints())); + addChild(new PointsCommandTreeNode("class", this, (data, points) -> data.setClassPoints(points), (data, points) -> data.giveClassPoints(points), (data) -> data.getClassPoints())); + addChild(new PointsCommandTreeNode("attribute", this, (data, points) -> data.setAttributePoints(points), (data, points) -> data.giveAttributePoints(points), (data) -> data.getAttributePoints())); + addChild(new PointsCommandTreeNode("attr-realloc", this, (data, points) -> data.setAttributeReallocationPoints(points), (data, points) -> data.giveAttributeReallocationPoints(points), (data) -> data.getAttributeReallocationPoints())); + + addChild(new ResourceCommandTreeNode("health", this, (data, value) -> data.getPlayer().setHealth(value), (data, value) -> data.heal(value), (data, value) -> data.heal(-value), (data) -> data.getPlayer().getHealth())); + addChild(new ResourceCommandTreeNode("mana", this, (data, value) -> data.setMana(value), (data, value) -> data.giveMana(value), (data, value) -> data.giveMana(-value), (data) -> data.getMana())); + addChild(new ResourceCommandTreeNode("stamina", this, (data, value) -> data.setStamina(value), (data, value) -> data.giveStamina(value), (data, value) -> data.giveStamina(-value), (data) -> data.getStamina())); + addChild(new ResourceCommandTreeNode("stellium", this, (data, value) -> data.setStellium(value), (data, value) -> data.giveStellium(value), (data, value) -> data.giveStellium(-value), (data) -> data.getStellium())); + } + + @Override + public CommandResult execute(CommandSender sender, String[] args) { + return CommandResult.THROW_USAGE; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java similarity index 67% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java index 9052dcae..8bd9b993 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java @@ -8,16 +8,16 @@ import org.bukkit.entity.Player; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.PlayerClass; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class ClassCommandMap extends CommandEnd { - public ClassCommandMap(CommandMap parent) { +public class ClassCommandTreeNode extends CommandTreeNode { + public ClassCommandTreeNode(CommandTreeNode parent) { super(parent, "class"); addParameter(Parameter.PLAYER); - addParameter(new Parameter("", (list) -> MMOCore.plugin.classManager.getAll().forEach(profess -> list.add(profess.getId())))); + addParameter( + new Parameter("", (explorer, list) -> MMOCore.plugin.classManager.getAll().forEach(profess -> list.add(profess.getId())))); } @Override @@ -41,7 +41,8 @@ public class ClassCommandMap extends CommandEnd { PlayerData data = PlayerData.get(player); data.setClass(profess); - sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " is now a " + ChatColor.GOLD + profess.getName() + ChatColor.YELLOW + "."); + sender.sendMessage( + ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " is now a " + ChatColor.GOLD + profess.getName() + ChatColor.YELLOW + "."); return CommandResult.SUCCESS; } } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java similarity index 64% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java index 14177d52..e325e031 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java @@ -8,34 +8,39 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.experience.Profession; import net.Indyuce.mmocore.api.experience.EXPSource; import net.Indyuce.mmocore.api.experience.PlayerProfessions; +import net.Indyuce.mmocore.api.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class ExperienceCommandMap extends CommandMap { - public ExperienceCommandMap(CommandMap parent) { +public class ExperienceCommandTreeNode extends CommandTreeNode { + public ExperienceCommandTreeNode(CommandTreeNode parent) { super(parent, "exp"); - addFloor(new ActionCommandMap(this, "set", (data, value) -> data.setExperience(value), (professions, profession, value) -> professions.setExperience(profession, value))); - addFloor(new ActionCommandMap(this, "give", (data, value) -> data.giveExperience(value, data.getPlayer().getLocation(), EXPSource.COMMAND), (professions, profession, value) -> professions.giveExperience(profession, value, professions.getPlayerData().getPlayer().getLocation(), EXPSource.COMMAND))); + addChild(new ActionCommandTreeNode(this, "set", (data, value) -> data.setExperience(value), + (professions, profession, value) -> professions.setExperience(profession, value))); + addChild(new ActionCommandTreeNode(this, "give", + (data, value) -> data.giveExperience(value, data.getPlayer().getLocation(), EXPSource.COMMAND), + (professions, profession, value) -> professions.giveExperience(profession, value, + professions.getPlayerData().getPlayer().getLocation(), EXPSource.COMMAND))); } - public class ActionCommandMap extends CommandEnd { + public class ActionCommandTreeNode extends CommandTreeNode { private final BiConsumer main; private final TriConsumer profession; - public ActionCommandMap(CommandMap parent, String type, BiConsumer main, TriConsumer profession) { + public ActionCommandTreeNode(CommandTreeNode parent, String type, BiConsumer main, + TriConsumer profession) { super(parent, type); this.main = main; this.profession = profession; addParameter(Parameter.PLAYER); - addParameter(Parameter.PROFESSION); + addParameter(MMOCoreCommandTreeRoot.PROFESSION); addParameter(Parameter.AMOUNT); } @@ -61,7 +66,8 @@ public class ExperienceCommandMap extends CommandMap { PlayerData data = PlayerData.get(player); if (args[4].equalsIgnoreCase("main")) { main.accept(data, amount); - sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " now has " + ChatColor.GOLD + data.getExperience() + ChatColor.YELLOW + " EXP."); + sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " now has " + ChatColor.GOLD + data.getExperience() + + ChatColor.YELLOW + " EXP."); return CommandResult.SUCCESS; } @@ -73,7 +79,8 @@ public class ExperienceCommandMap extends CommandMap { Profession profession = MMOCore.plugin.professionManager.get(format); this.profession.accept(data.getCollectionSkills(), profession, amount); - sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " now has " + ChatColor.GOLD + data.getCollectionSkills().getExperience(profession) + ChatColor.YELLOW + " EXP in " + profession.getName() + "."); + sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " now has " + ChatColor.GOLD + + data.getCollectionSkills().getExperience(profession) + ChatColor.YELLOW + " EXP in " + profession.getName() + "."); return CommandResult.SUCCESS; } } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java similarity index 78% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java index aa535ee7..929a8a1d 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java @@ -6,12 +6,11 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class HideActionBarCommandMap extends CommandEnd { - public HideActionBarCommandMap(CommandMap parent) { +public class HideActionBarCommandTreeNode extends CommandTreeNode { + public HideActionBarCommandTreeNode(CommandTreeNode parent) { super(parent, "hideab"); addParameter(Parameter.PLAYER); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java similarity index 90% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java index 16a74da8..c8456231 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java @@ -8,12 +8,11 @@ import org.bukkit.entity.Player; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class InfoCommandMap extends CommandEnd { - public InfoCommandMap(CommandMap parent) { +public class InfoCommandTreeNode extends CommandTreeNode { + public InfoCommandTreeNode(CommandTreeNode parent) { super(parent, "info"); addParameter(Parameter.PLAYER); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java similarity index 65% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java index c1550458..0e6fa5aa 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java @@ -8,34 +8,37 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.experience.Profession; import net.Indyuce.mmocore.api.experience.EXPSource; import net.Indyuce.mmocore.api.experience.PlayerProfessions; +import net.Indyuce.mmocore.api.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class LevelCommandMap extends CommandMap { - public LevelCommandMap(CommandMap parent) { +public class LevelCommandTreeNode extends CommandTreeNode { + public LevelCommandTreeNode(CommandTreeNode parent) { super(parent, "level"); - addFloor(new ActionCommandMap(this, "set", (data, value) -> data.setLevel(value), (professions, profession, value) -> professions.setLevel(profession, value))); - addFloor(new ActionCommandMap(this, "give", (data, value) -> data.giveLevels(value, EXPSource.COMMAND), (professions, profession, value) -> professions.giveLevels(profession, value, EXPSource.COMMAND))); + addChild(new ActionCommandTreeNode(this, "set", (data, value) -> data.setLevel(value), + (professions, profession, value) -> professions.setLevel(profession, value))); + addChild(new ActionCommandTreeNode(this, "give", (data, value) -> data.giveLevels(value, EXPSource.COMMAND), + (professions, profession, value) -> professions.giveLevels(profession, value, EXPSource.COMMAND))); } - public class ActionCommandMap extends CommandEnd { + public class ActionCommandTreeNode extends CommandTreeNode { private final BiConsumer main; private final TriConsumer profession; - public ActionCommandMap(CommandMap parent, String type, BiConsumer main, TriConsumer profession) { + public ActionCommandTreeNode(CommandTreeNode parent, String type, BiConsumer main, + TriConsumer profession) { super(parent, type); this.main = main; this.profession = profession; addParameter(Parameter.PLAYER); - addParameter(Parameter.PROFESSION); + addParameter(MMOCoreCommandTreeRoot.PROFESSION); addParameter(Parameter.AMOUNT); } @@ -61,7 +64,8 @@ public class LevelCommandMap extends CommandMap { PlayerData data = PlayerData.get(player); if (args[4].equalsIgnoreCase("main")) { main.accept(data, amount); - sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " is now Lvl " + ChatColor.GOLD + data.getLevel() + ChatColor.YELLOW + "."); + sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " is now Lvl " + ChatColor.GOLD + data.getLevel() + + ChatColor.YELLOW + "."); return CommandResult.SUCCESS; } @@ -73,7 +77,8 @@ public class LevelCommandMap extends CommandMap { Profession profession = MMOCore.plugin.professionManager.get(format); this.profession.accept(data.getCollectionSkills(), profession, amount); - sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " is now Lvl " + ChatColor.GOLD + data.getCollectionSkills().getLevel(profession) + ChatColor.YELLOW + " in " + profession.getName() + "."); + sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " is now Lvl " + ChatColor.GOLD + + data.getCollectionSkills().getLevel(profession) + ChatColor.YELLOW + " in " + profession.getName() + "."); return CommandResult.SUCCESS; } } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java similarity index 77% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java index 490993ca..f2505743 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java @@ -6,12 +6,11 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class NoCooldownCommandMap extends CommandEnd { - public NoCooldownCommandMap(CommandMap parent) { +public class NoCooldownCommandTreeNode extends CommandTreeNode { + public NoCooldownCommandTreeNode(CommandTreeNode parent) { super(parent, "nocd"); addParameter(Parameter.PLAYER); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java similarity index 66% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java index 26600142..acaea6da 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java @@ -9,28 +9,28 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class PointsCommandMap extends CommandMap { +public class PointsCommandTreeNode extends CommandTreeNode { private final String type; private final Function get; - public PointsCommandMap(String type, CommandMap parent, BiConsumer set, BiConsumer give, Function get) { + public PointsCommandTreeNode(String type, CommandTreeNode parent, BiConsumer set, BiConsumer give, + Function get) { super(parent, type + "-points"); this.type = type; this.get = get; - addFloor(new ActionCommandMap(this, "set", set)); - addFloor(new ActionCommandMap(this, "give", give)); + addChild(new ActionCommandTreeNode(this, "set", set)); + addChild(new ActionCommandTreeNode(this, "give", give)); } - public class ActionCommandMap extends CommandEnd { + public class ActionCommandTreeNode extends CommandTreeNode { private final BiConsumer action; - public ActionCommandMap(CommandMap parent, String type, BiConsumer action) { + public ActionCommandTreeNode(CommandTreeNode parent, String type, BiConsumer action) { super(parent, type); this.action = action; @@ -60,7 +60,8 @@ public class PointsCommandMap extends CommandMap { PlayerData data = PlayerData.get(player); action.accept(data, amount); - sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " now has " + ChatColor.GOLD + get.apply(data) + ChatColor.YELLOW + " " + type + " points."); + sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " now has " + ChatColor.GOLD + get.apply(data) + + ChatColor.YELLOW + " " + type + " points."); return CommandResult.SUCCESS; } } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java similarity index 81% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java index 67ccc8cf..2d7242dc 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java @@ -9,19 +9,18 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class ResetCommandMap extends CommandMap { - public ResetCommandMap(CommandMap parent) { +public class ResetCommandTreeNode extends CommandTreeNode { + public ResetCommandTreeNode(CommandTreeNode parent) { super(parent, "reset"); - addFloor(new ResetLevelsCommandMap(this)); - addFloor(new ResetSkillsCommandMap(this)); - addFloor(new ResetAllCommandMap(this)); - addFloor(new ResetAttributesCommandMap(this)); - addFloor(new ResetWaypointsCommandMap(this)); + addChild(new ResetLevelsCommandTreeNode(this)); + addChild(new ResetSkillsCommandTreeNode(this)); + addChild(new ResetAllCommandTreeNode(this)); + addChild(new ResetAttributesCommandTreeNode(this)); + addChild(new ResetWaypointsCommandTreeNode(this)); } @Override @@ -29,8 +28,8 @@ public class ResetCommandMap extends CommandMap { return CommandResult.THROW_USAGE; } - public class ResetAllCommandMap extends CommandEnd { - public ResetAllCommandMap(CommandMap parent) { + public class ResetAllCommandTreeNode extends CommandTreeNode { + public ResetAllCommandTreeNode(CommandTreeNode parent) { super(parent, "all"); addParameter(Parameter.PLAYER); @@ -72,8 +71,8 @@ public class ResetCommandMap extends CommandMap { } } - public class ResetWaypointsCommandMap extends CommandEnd { - public ResetWaypointsCommandMap(CommandMap parent) { + public class ResetWaypointsCommandTreeNode extends CommandTreeNode { + public ResetWaypointsCommandTreeNode(CommandTreeNode parent) { super(parent, "waypoints"); addParameter(Parameter.PLAYER); @@ -98,8 +97,8 @@ public class ResetCommandMap extends CommandMap { } } - public class ResetQuestsCommandMap extends CommandEnd { - public ResetQuestsCommandMap(CommandMap parent) { + public class ResetQuestsCommandTreeNode extends CommandTreeNode { + public ResetQuestsCommandTreeNode(CommandTreeNode parent) { super(parent, "quests"); addParameter(Parameter.PLAYER); @@ -123,8 +122,8 @@ public class ResetCommandMap extends CommandMap { } } - public class ResetSkillsCommandMap extends CommandEnd { - public ResetSkillsCommandMap(CommandMap parent) { + public class ResetSkillsCommandTreeNode extends CommandTreeNode { + public ResetSkillsCommandTreeNode(CommandTreeNode parent) { super(parent, "skills"); addParameter(Parameter.PLAYER); @@ -150,12 +149,12 @@ public class ResetCommandMap extends CommandMap { } } - public class ResetAttributesCommandMap extends CommandEnd { - public ResetAttributesCommandMap(CommandMap parent) { + public class ResetAttributesCommandTreeNode extends CommandTreeNode { + public ResetAttributesCommandTreeNode(CommandTreeNode parent) { super(parent, "attributes"); addParameter(Parameter.PLAYER); - addParameter(new Parameter("(-reallocate)", list -> list.add("-reallocate"))); + addParameter(new Parameter("(-reallocate)", (explore, list) -> list.add("-reallocate"))); } @Override @@ -193,8 +192,8 @@ public class ResetCommandMap extends CommandMap { } } - public class ResetLevelsCommandMap extends CommandEnd { - public ResetLevelsCommandMap(CommandMap parent) { + public class ResetLevelsCommandTreeNode extends CommandTreeNode { + public ResetLevelsCommandTreeNode(CommandTreeNode parent) { super(parent, "levels"); addParameter(Parameter.PLAYER); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java similarity index 64% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java index c58d784f..050eb2e9 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java @@ -9,29 +9,29 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class ResourceCommandMap extends CommandMap { +public class ResourceCommandTreeNode extends CommandTreeNode { private final String type; private final Function get; - public ResourceCommandMap(String type, CommandMap parent, BiConsumer set, BiConsumer give, BiConsumer take, Function get) { + public ResourceCommandTreeNode(String type, CommandTreeNode parent, BiConsumer set, BiConsumer give, + BiConsumer take, Function get) { super(parent, "resource-" + type); this.type = type; this.get = get; - addFloor(new ActionCommandMap(this, "set", set)); - addFloor(new ActionCommandMap(this, "give", give)); - addFloor(new ActionCommandMap(this, "take", take)); + addChild(new ActionCommandTreeNode(this, "set", set)); + addChild(new ActionCommandTreeNode(this, "give", give)); + addChild(new ActionCommandTreeNode(this, "take", take)); } - public class ActionCommandMap extends CommandEnd { + public class ActionCommandTreeNode extends CommandTreeNode { private final BiConsumer action; - public ActionCommandMap(CommandMap parent, String type, BiConsumer action) { + public ActionCommandTreeNode(CommandTreeNode parent, String type, BiConsumer action) { super(parent, type); this.action = action; @@ -61,7 +61,8 @@ public class ResourceCommandMap extends CommandMap { PlayerData data = PlayerData.get(player); action.accept(data, amount); - sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " now has " + ChatColor.GOLD + get.apply(data) + ChatColor.YELLOW + " " + type + " points."); + sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " now has " + ChatColor.GOLD + get.apply(data) + + ChatColor.YELLOW + " " + type + " points."); return CommandResult.SUCCESS; } } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandMap.java deleted file mode 100644 index 9a570942..00000000 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandMap.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.Indyuce.mmocore.command.rpg.booster; - -import org.bukkit.command.CommandSender; - -import net.Indyuce.mmocore.command.api.CommandMap; - -public class BoosterCommandMap extends CommandMap { - public BoosterCommandMap(CommandMap parent) { - super(parent, "booster"); - - addFloor(new CreateCommandMap(this)); - addFloor(new ListCommandMap(this)); - addFloor(new RemoveCommandMap(this)); - } - - @Override - public CommandResult execute(CommandSender sender, String[] args) { - return CommandResult.THROW_USAGE; - } -} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java new file mode 100644 index 00000000..babcea5a --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java @@ -0,0 +1,20 @@ +package net.Indyuce.mmocore.command.rpg.booster; + +import org.bukkit.command.CommandSender; + +import net.mmogroup.mmolib.command.api.CommandTreeNode; + +public class BoosterCommandTreeNode extends CommandTreeNode { + public BoosterCommandTreeNode(CommandTreeNode parent) { + super(parent, "booster"); + + addChild(new CreateCommandTreeNode(this)); + addChild(new ListCommandTreeNode(this)); + addChild(new RemoveCommandTreeNode(this)); + } + + @Override + public CommandResult execute(CommandSender sender, String[] args) { + return CommandResult.THROW_USAGE; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java similarity index 74% rename from src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java index 3f83a7c6..906bf854 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java @@ -11,17 +11,18 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.experience.Booster; import net.Indyuce.mmocore.api.experience.Profession; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class CreateCommandMap extends CommandEnd { - public CreateCommandMap(CommandMap parent) { +public class CreateCommandTreeNode extends CommandTreeNode { + public CreateCommandTreeNode(CommandTreeNode parent) { super(parent, "create"); - addParameter(Parameter.PROFESSION); - addParameter(new Parameter("", (list) -> list.addAll(Arrays.asList("0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1")))); - addParameter(new Parameter("", (list) -> list.addAll(Arrays.asList("60", "300", "3600", "43200", "86400")))); + addParameter(MMOCoreCommandTreeRoot.PROFESSION); + addParameter(new Parameter("", + (explorer, list) -> list.addAll(Arrays.asList("0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1")))); + addParameter(new Parameter("", (explorer, list) -> list.addAll(Arrays.asList("60", "300", "3600", "43200", "86400")))); addParameter(Parameter.PLAYER_OPTIONAL); } @@ -61,7 +62,8 @@ public class CreateCommandMap extends CommandEnd { Profession profession = MMOCore.plugin.professionManager.get(format); MMOCore.plugin.boosterManager.register(new Booster(args.length > 5 ? args[5] : null, profession, extra, length)); - new ConfigMessage("booster-skill").addPlaceholders("multiplier", "" + (1 + extra), "profession", profession.getName()).send(Bukkit.getOnlinePlayers()); + new ConfigMessage("booster-skill").addPlaceholders("multiplier", "" + (1 + extra), "profession", profession.getName()) + .send(Bukkit.getOnlinePlayers()); Bukkit.getOnlinePlayers().forEach(player -> player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1)); return CommandResult.SUCCESS; } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java similarity index 51% rename from src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java index 07b92b1d..724e162e 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java @@ -7,12 +7,11 @@ import org.bukkit.entity.Player; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.experience.Booster; import net.Indyuce.mmocore.api.util.math.format.DelayFormat; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; import net.mmogroup.mmolib.MMOLib; +import net.mmogroup.mmolib.command.api.CommandTreeNode; -public class ListCommandMap extends CommandEnd { - public ListCommandMap(CommandMap parent) { +public class ListCommandTreeNode extends CommandTreeNode { + public ListCommandTreeNode(CommandTreeNode parent) { super(parent, "list"); } @@ -24,7 +23,13 @@ public class ListCommandMap extends CommandEnd { sender.sendMessage(ChatColor.YELLOW + "----------------------------------------------------"); for (Booster booster : MMOCore.plugin.boosterManager.getBoosters()) if (!booster.isTimedOut()) - MMOLib.plugin.getVersion().getWrapper().sendJson((Player) sender, "{\"text\":\"" + ChatColor.YELLOW + "- " + ChatColor.GOLD + MMOCore.plugin.configManager.decimal.format((1 + booster.getExtra())) + "x" + ChatColor.YELLOW + " Booster - " + ChatColor.GOLD + (!booster.hasProfession() ? "ExploreAttributesCommand" : booster.getProfession().getName()) + ChatColor.YELLOW + " - " + ChatColor.GOLD + new DelayFormat().format(booster.getCreationDate() + booster.getLength() - System.currentTimeMillis()) + "\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/mmocore booster remove " + booster.getUniqueId().toString() + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"Click to remove.\"}}}"); + MMOLib.plugin.getVersion().getWrapper().sendJson((Player) sender, "{\"text\":\"" + ChatColor.YELLOW + "- " + ChatColor.GOLD + + MMOCore.plugin.configManager.decimal.format((1 + booster.getExtra())) + "x" + ChatColor.YELLOW + " Booster - " + + ChatColor.GOLD + (!booster.hasProfession() ? "ExploreAttributesCommand" : booster.getProfession().getName()) + + ChatColor.YELLOW + " - " + ChatColor.GOLD + + new DelayFormat().format(booster.getCreationDate() + booster.getLength() - System.currentTimeMillis()) + + "\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/mmocore booster remove " + booster.getUniqueId().toString() + + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"Click to remove.\"}}}"); sender.sendMessage(ChatColor.YELLOW + "----------------------------------------------------"); return CommandResult.SUCCESS; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java similarity index 71% rename from src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java index 4f2ac856..8f2b9a2a 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java @@ -8,15 +8,15 @@ import org.bukkit.command.CommandSender; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.experience.Booster; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class RemoveCommandMap extends CommandEnd { - public RemoveCommandMap(CommandMap parent) { +public class RemoveCommandTreeNode extends CommandTreeNode { + public RemoveCommandTreeNode(CommandTreeNode parent) { super(parent, "remove"); - addParameter(new Parameter("", (list) -> MMOCore.plugin.boosterManager.getBoosters().forEach(booster -> list.add("" + booster.getUniqueId().toString())))); + addParameter(new Parameter("", + (explorer, list) -> MMOCore.plugin.boosterManager.getBoosters().forEach(booster -> list.add("" + booster.getUniqueId().toString())))); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java similarity index 60% rename from src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java index 51c1b690..8bf0bf28 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java @@ -3,16 +3,16 @@ package net.Indyuce.mmocore.command.rpg.debug; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import net.Indyuce.mmocore.command.api.CommandMap; +import net.mmogroup.mmolib.command.api.CommandTreeNode; -public class DebugCommandMap extends CommandMap { +public class DebugCommandTreeNode extends CommandTreeNode { public static final String commandPrefix = ChatColor.YELLOW + "[" + ChatColor.RED + "DEBUG" + ChatColor.GOLD + "] " + ChatColor.RESET; - public DebugCommandMap(CommandMap parent) { + public DebugCommandTreeNode(CommandTreeNode parent) { super(parent, "debug"); - addFloor(new StatValueCommandMap(this)); - addFloor(new StatModifiersCommandMap(this)); + addChild(new StatValueCommandTreeNode(this)); + addChild(new StatModifiersCommandTreeNode(this)); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java similarity index 82% rename from src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java index a3e8f9a8..4c4dd09c 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java @@ -6,17 +6,16 @@ import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.stats.StatType; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; import net.mmogroup.mmolib.api.stat.StatInstance; import net.mmogroup.mmolib.api.stat.modifier.StatModifier; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class StatModifiersCommandMap extends CommandEnd { - public StatModifiersCommandMap(CommandMap parent) { +public class StatModifiersCommandTreeNode extends CommandTreeNode { + public StatModifiersCommandTreeNode(CommandTreeNode parent) { super(parent, "statmods"); - addParameter(new Parameter("", list -> { + addParameter(new Parameter("", (explorer, list) -> { for (StatType stat : StatType.values()) list.add(stat.name()); })); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java similarity index 67% rename from src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java index 90682d93..4fb69407 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java @@ -6,19 +6,18 @@ import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.stats.StatType; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class StatValueCommandMap extends CommandEnd { - public StatValueCommandMap(CommandMap parent) { +public class StatValueCommandTreeNode extends CommandTreeNode { + public StatValueCommandTreeNode(CommandTreeNode parent) { super(parent, "statvalue"); - addParameter(new Parameter("", list -> { + addParameter(new Parameter("", (explorer, list) -> { for (StatType stat : StatType.values()) list.add(stat.name()); })); - addParameter(new Parameter("(formatted)", list -> { + addParameter(new Parameter("(formatted)", (explorer, list) -> { list.add("true"); })); } @@ -43,10 +42,10 @@ public class StatValueCommandMap extends CommandEnd { } if (args.length > 3 && args[3].equals("true")) - sender.sendMessage(DebugCommandMap.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): " + sender.sendMessage(DebugCommandTreeNode.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): " + ChatColor.GREEN + stat.format(data.getStats().getStat(stat)) + ChatColor.WHITE + " *"); else - sender.sendMessage(DebugCommandMap.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): " + sender.sendMessage(DebugCommandTreeNode.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): " + ChatColor.GREEN + data.getStats().getStat(stat)); return CommandResult.SUCCESS; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandEnd.java b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java similarity index 79% rename from src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandEnd.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java index 7a8304cb..7cc9e730 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandEnd.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java @@ -7,12 +7,11 @@ import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.quest.PlayerQuests; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class CancelCommandEnd extends CommandEnd { - public CancelCommandEnd(CommandMap parent) { +public class CancelCommandTreeNode extends CommandTreeNode { + public CancelCommandTreeNode(CommandTreeNode parent) { super(parent, "cancel"); addParameter(Parameter.PLAYER); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandMap.java deleted file mode 100644 index 2294e0cc..00000000 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandMap.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.Indyuce.mmocore.command.rpg.quest; - -import org.bukkit.command.CommandSender; - -import net.Indyuce.mmocore.command.api.CommandMap; - -public class QuestCommandMap extends CommandMap { - - public QuestCommandMap(CommandMap parent) { - super(parent, "quest"); - - addFloor(new StartCommandEnd(this)); - addFloor(new CancelCommandEnd(this)); - } - - @Override - public CommandResult execute(CommandSender sender, String[] args) { - return CommandResult.THROW_USAGE; - } -} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java new file mode 100644 index 00000000..4c9ae130 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java @@ -0,0 +1,20 @@ +package net.Indyuce.mmocore.command.rpg.quest; + +import org.bukkit.command.CommandSender; + +import net.mmogroup.mmolib.command.api.CommandTreeNode; + +public class QuestCommandTreeNode extends CommandTreeNode { + + public QuestCommandTreeNode(CommandTreeNode parent) { + super(parent, "quest"); + + addChild(new StartCommandTreeNode(this)); + addChild(new CancelCommandTreeNode(this)); + } + + @Override + public CommandResult execute(CommandSender sender, String[] args) { + return CommandResult.THROW_USAGE; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandEnd.java b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java similarity index 80% rename from src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandEnd.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java index 4334cd79..538f01ab 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandEnd.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java @@ -9,16 +9,16 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.quest.PlayerQuests; import net.Indyuce.mmocore.api.quest.Quest; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class StartCommandEnd extends CommandEnd { - public StartCommandEnd(CommandMap parent) { +public class StartCommandTreeNode extends CommandTreeNode { + public StartCommandTreeNode(CommandTreeNode parent) { super(parent, "start"); addParameter(Parameter.PLAYER); - addParameter(Parameter.QUEST); + addParameter(MMOCoreCommandTreeRoot.QUEST); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java similarity index 75% rename from src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java index c7ee2b43..3a7bd80f 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java @@ -5,13 +5,12 @@ import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; import net.Indyuce.mmocore.manager.InventoryManager; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class OpenCommandMap extends CommandEnd { - public OpenCommandMap(CommandMap parent) { +public class OpenCommandTreeNode extends CommandTreeNode { + public OpenCommandTreeNode(CommandTreeNode parent) { super(parent, "open"); addParameter(Parameter.PLAYER); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java similarity index 73% rename from src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandMap.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java index adeb7921..017b01df 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandMap.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java @@ -8,15 +8,14 @@ import org.bukkit.entity.Player; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.Waypoint; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.api.CommandEnd; -import net.Indyuce.mmocore.command.api.CommandMap; -import net.Indyuce.mmocore.command.api.Parameter; +import net.mmogroup.mmolib.command.api.CommandTreeNode; +import net.mmogroup.mmolib.command.api.Parameter; -public class UnlockCommandMap extends CommandEnd { - public UnlockCommandMap(CommandMap parent) { +public class UnlockCommandTreeNode extends CommandTreeNode { + public UnlockCommandTreeNode(CommandTreeNode parent) { super(parent, "unlock"); - addParameter(new Parameter("", (list) -> MMOCore.plugin.waypointManager.getAll().forEach(way -> list.add(way.getId())))); + addParameter(new Parameter("", (explorer, list) -> MMOCore.plugin.waypointManager.getAll().forEach(way -> list.add(way.getId())))); addParameter(Parameter.PLAYER); } @@ -38,7 +37,8 @@ public class UnlockCommandMap extends CommandEnd { Waypoint waypoint = MMOCore.plugin.waypointManager.get(args[2]); PlayerData.get(player).unlockWaypoint(waypoint); - sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " successfully unlocked " + ChatColor.GOLD + waypoint.getId() + ChatColor.YELLOW + "."); + sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " successfully unlocked " + ChatColor.GOLD + waypoint.getId() + + ChatColor.YELLOW + "."); return CommandResult.SUCCESS; } } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandMap.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandMap.java deleted file mode 100644 index 2b9bcce2..00000000 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandMap.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.Indyuce.mmocore.command.rpg.waypoint; - -import org.bukkit.command.CommandSender; - -import net.Indyuce.mmocore.command.api.CommandMap; - -public class WaypointsCommandMap extends CommandMap { - public WaypointsCommandMap(CommandMap parent) { - super(parent, "waypoints"); - - addFloor(new UnlockCommandMap(this)); - addFloor(new OpenCommandMap(this)); - } - - @Override - public CommandResult execute(CommandSender sender, String[] args) { - return CommandResult.THROW_USAGE; - } -} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java new file mode 100644 index 00000000..9b056793 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java @@ -0,0 +1,19 @@ +package net.Indyuce.mmocore.command.rpg.waypoint; + +import org.bukkit.command.CommandSender; + +import net.mmogroup.mmolib.command.api.CommandTreeNode; + +public class WaypointsCommandTreeNode extends CommandTreeNode { + public WaypointsCommandTreeNode(CommandTreeNode parent) { + super(parent, "waypoints"); + + addChild(new UnlockCommandTreeNode(this)); + addChild(new OpenCommandTreeNode(this)); + } + + @Override + public CommandResult execute(CommandSender sender, String[] args) { + return CommandResult.THROW_USAGE; + } +}