mirror of
https://github.com/kami-blue/client
synced 2025-01-20 05:50:42 +00:00
cleanup and fix enabledcommand
This commit is contained in:
parent
b34598bd80
commit
2fa807e830
@ -3,10 +3,12 @@ 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 net.minecraft.util.text.TextFormatting;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author S-B99
|
||||
@ -14,23 +16,22 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class EnabledCommand extends Command {
|
||||
public EnabledCommand() {
|
||||
super("enabledlist", null, "enabled");
|
||||
super("enabledlist", null, "enabled", "enabledmodules");
|
||||
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());
|
||||
List<Module> mods = new ArrayList<>(ModuleManager.getModules());
|
||||
|
||||
mods.forEach(module -> {
|
||||
if (module.isEnabled()) {
|
||||
enabled.set(String.join(", ", module.getName()));
|
||||
enabled.set(enabled + module.getName() + ", ");
|
||||
}
|
||||
});
|
||||
Command.sendChatMessage("Enabled modules: \n" + enabled);
|
||||
enabled.set(StringUtils.chop(StringUtils.chop(String.valueOf(enabled)))); // this looks horrible but I don't know how else to do it sorry
|
||||
Command.sendChatMessage("Enabled modules: \n" + TextFormatting.GRAY + enabled);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user