From 9cf21e29272b3770adf7497b69a4cbcbcd2fc0a0 Mon Sep 17 00:00:00 2001 From: Luck Date: Thu, 5 Dec 2019 21:44:45 +0000 Subject: [PATCH] Include loaded extensions in the info command (#1849) --- .../luckperms/common/commands/misc/InfoCommand.java | 10 ++++++++++ .../lucko/luckperms/common/locale/message/Message.java | 3 +++ 2 files changed, 13 insertions(+) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java index 0318b28ee..2fea03ea0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/InfoCommand.java @@ -39,7 +39,9 @@ import me.lucko.luckperms.common.util.DurationFormatter; import me.lucko.luckperms.common.util.Predicates; import net.luckperms.api.context.ImmutableContextSet; +import net.luckperms.api.extension.Extension; +import java.util.Collection; import java.util.List; import java.util.Map; @@ -64,6 +66,14 @@ public class InfoCommand extends SingleCommand { Message.INFO_STORAGE_META.send(sender, e.getKey(), formatValue(e.getValue())); } + Collection 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(); Message.INFO_MIDDLE.send(sender, plugin.getMessagingService().map(InternalMessagingService::getName).orElse("None"), diff --git a/common/src/main/java/me/lucko/luckperms/common/locale/message/Message.java b/common/src/main/java/me/lucko/luckperms/common/locale/message/Message.java index 0815e2f06..5898048a1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/locale/message/Message.java +++ b/common/src/main/java/me/lucko/luckperms/common/locale/message/Message.java @@ -217,6 +217,9 @@ public enum Message { INFO_STORAGE_META("&f- &3{}: {}", true), + INFO_EXTENSIONS("{PREFIX}&f- &bExtensions:", true), + INFO_EXTENSION_ENTRY("&f- &3{}", true), + INFO_MIDDLE( "{PREFIX}&f- &bMessaging: &f{}" + "\n" + "{PREFIX}&f- &bInstance:" + "\n" +