mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-13 15:16:50 +01:00
Test for adventure text support by trying to use it
This commit is contained in:
parent
cafc9f22d6
commit
d0ce9c0536
@ -222,8 +222,15 @@ public class DisguiseUtilities {
|
||||
public static boolean hasAdventureTextSupport() {
|
||||
if (adventureTextSupport == null) {
|
||||
try {
|
||||
Class.forName("net.kyori.adventure.text.minimessage.MiniMessage");
|
||||
adventureTextSupport = true;
|
||||
|
||||
// Force a test for support by actually trying to use it all
|
||||
BaseComponent[] test1 = ComponentSerializer.parse(GsonComponentSerializer.gson().serialize(getAdventureChat("<green>test")));
|
||||
WrappedChatComponent test2 = AdventureComponentConverter.fromComponent(DisguiseUtilities.getAdventureChat("<green>test"));
|
||||
|
||||
if (test1 == null || test1.length == 0 || test2 == null) {
|
||||
adventureTextSupport = false;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
adventureTextSupport = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user