MCPcopy Index your code
hub / github.com/ZetaMap/MoreCommands / load

Method load

src/main/java/manager/CommandsManager.java:48–69  ·  view source on GitHub ↗
(CommandHandler handler)

Source from the content-addressed store, hash-verified

46 }
47
48 public static void load(CommandHandler handler) {
49 while (!canLoad) {}
50
51 handler.getCommandList().forEach(command -> {
52 if (!commands.containsKey(handler.getPrefix() + command.text))
53 commands.put(handler.getPrefix() + command.text, true);
54 });
55
56 Seq<String> list = (clientPrefix.equals(handler.getPrefix()) ? commands.keys().toSeq().filter(c -> c.startsWith(handler.getPrefix())) :
57 commands.keys().toSeq().filter(c -> !c.startsWith(clientPrefix))),
58 comparator = handler.getCommandList().map(command -> command.text);
59
60 commands.forEach(command -> {
61 if (!command.value) handler.removeCommand(command.key.substring(handler.getPrefix().length()));
62 });
63
64 comparator.each(c -> list.remove(handler.getPrefix() + c));
65 list.each(c -> commands.remove(c));
66
67 temp.putAll(commands);
68 save();
69 }
70
71 public static void init() {
72 if (Core.settings.has("handlerManager")) {

Callers 1

setHandlerMethod · 0.95

Calls 4

saveMethod · 0.95
putMethod · 0.45
eachMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected