Include loaded extensions in the info command (#1849)

This commit is contained in:
Luck 2019-12-05 21:44:45 +00:00
parent 86a15b9a66
commit 9cf21e2927
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 13 additions and 0 deletions

View File

@ -39,7 +39,9 @@ import me.lucko.luckperms.common.util.DurationFormatter;
import me.lucko.luckperms.common.util.Predicates; import me.lucko.luckperms.common.util.Predicates;
import net.luckperms.api.context.ImmutableContextSet; import net.luckperms.api.context.ImmutableContextSet;
import net.luckperms.api.extension.Extension;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -64,6 +66,14 @@ public class InfoCommand extends SingleCommand {
Message.INFO_STORAGE_META.send(sender, e.getKey(), formatValue(e.getValue())); Message.INFO_STORAGE_META.send(sender, e.getKey(), formatValue(e.getValue()));
} }
Collection<Extension> loadedExtensions = plugin.getExtensionManager().getLoadedExtensions();
if (!loadedExtensions.isEmpty()) {
Message.INFO_EXTENSIONS.send(sender);
for (Extension extension : loadedExtensions) {
Message.INFO_EXTENSION_ENTRY.send(sender, extension.getClass().getName());
}
}
ImmutableContextSet staticContext = plugin.getContextManager().getStaticContext(); ImmutableContextSet staticContext = plugin.getContextManager().getStaticContext();
Message.INFO_MIDDLE.send(sender, Message.INFO_MIDDLE.send(sender,
plugin.getMessagingService().map(InternalMessagingService::getName).orElse("None"), plugin.getMessagingService().map(InternalMessagingService::getName).orElse("None"),

View File

@ -217,6 +217,9 @@ public enum Message {
INFO_STORAGE_META("&f- &3{}: {}", true), INFO_STORAGE_META("&f- &3{}: {}", true),
INFO_EXTENSIONS("{PREFIX}&f- &bExtensions:", true),
INFO_EXTENSION_ENTRY("&f- &3{}", true),
INFO_MIDDLE( INFO_MIDDLE(
"{PREFIX}&f- &bMessaging: &f{}" + "\n" + "{PREFIX}&f- &bMessaging: &f{}" + "\n" +
"{PREFIX}&f- &bInstance:" + "\n" + "{PREFIX}&f- &bInstance:" + "\n" +