forked from RepoMirrors/kami-blue
add enabled command
This commit is contained in:
parent
77059122a1
commit
b34598bd80
|
@ -0,0 +1,36 @@
|
|||
package me.zeroeightsix.kami.command.commands;
|
||||
|
||||
import me.zeroeightsix.kami.command.Command;
|
||||
import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.module.ModuleManager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author S-B99
|
||||
* Updated by S-B99 on 07/02/20
|
||||
*/
|
||||
public class EnabledCommand extends Command {
|
||||
public EnabledCommand() {
|
||||
super("enabledlist", null, "enabled");
|
||||
setDescription("Prints Enabled Modules");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(String[] args) {
|
||||
AtomicReference<String> enabled = new AtomicReference<>("");
|
||||
List<Module> mods = ModuleManager.getModules().stream()
|
||||
.filter(Module::isEnabled)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
mods.forEach(module -> {
|
||||
if (module.isEnabled()) {
|
||||
enabled.set(String.join(", ", module.getName()));
|
||||
}
|
||||
});
|
||||
Command.sendChatMessage("Enabled modules: \n" + enabled);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue