File tree Expand file tree Collapse file tree
src/main/java/me/zetastormy/akropolis/util/text Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919
2020package me .zetastormy .akropolis .util .text ;
2121
22+ import java .lang .reflect .Method ;
23+ import java .util .Objects ;
24+
2225import org .bukkit .Color ;
2326import org .jetbrains .annotations .NotNull ;
2427
3134import net .kyori .adventure .text .minimessage .tag .standard .StandardTags ;
3235
3336public class TextUtil {
37+ static {
38+ try {
39+ final Method spriteMethod = StandardTags .class .getDeclaredMethod ("sprite" );
40+ SPRITE_TAG_RESOLVER = (TagResolver ) Objects .requireNonNull (spriteMethod .invoke (null ));
41+ } catch (final Exception ignored ) {
42+ SPRITE_TAG_RESOLVER = TagResolver .empty ();
43+ }
44+ }
45+ private static @ NotNull TagResolver SPRITE_TAG_RESOLVER ;
3446 private static final MiniMessage MINI_MESSAGE = MiniMessage .miniMessage ();
3547 private static final MiniMessage MINI_MESSAGE_USER_INPUT = MiniMessage .builder ().tags (
3648 TagResolver .builder ().resolvers (
@@ -45,6 +57,7 @@ public class TextUtil {
4557 StandardTags .reset (),
4658 StandardTags .shadowColor (),
4759 StandardTags .transition (),
60+ SPRITE_TAG_RESOLVER ,
4861 StandardTags .translatable (),
4962 StandardTags .translatableFallback ()
5063 ).build ()).build ();
You can’t perform that action at this time.
0 commit comments