2222
2323import com .google .gson .JsonParseException ;
2424import com .mojang .serialization .JsonOps ;
25- import eu .pb4 .placeholders .api .PlaceholderContext ;
26- import eu .pb4 .placeholders .api .PlaceholderHandler ;
27- import eu .pb4 .placeholders .api .PlaceholderResult ;
28- import eu .pb4 .placeholders .api .Placeholders ;
25+ // import eu.pb4.placeholders.api.PlaceholderContext;
26+ // import eu.pb4.placeholders.api.PlaceholderHandler;
27+ // import eu.pb4.placeholders.api.PlaceholderResult;
28+ // import eu.pb4.placeholders.api.Placeholders;
2929import me .lucko .spark .common .SparkPlatform ;
3030import me .lucko .spark .common .util .SparkPlaceholder ;
3131import net .kyori .adventure .text .Component ;
@@ -40,31 +40,31 @@ public enum SparkFabricPlaceholderApi {
4040
4141 public static void register (SparkPlatform platform ) {
4242 for (SparkPlaceholder placeholder : SparkPlaceholder .values ()) {
43- Placeholders .register (
44- Identifier .fromNamespaceAndPath ("spark" , placeholder .getName ()),
45- new Handler (platform , placeholder )
46- );
43+ // Placeholders.register(
44+ // Identifier.fromNamespaceAndPath("spark", placeholder.getName()),
45+ // new Handler(platform, placeholder)
46+ // );
4747 }
4848 }
4949
50- private record Handler (SparkPlatform platform , SparkPlaceholder placeholder ) implements PlaceholderHandler {
51- @ Override
52- public PlaceholderResult onPlaceholderRequest (PlaceholderContext context , @ Nullable String argument ) {
53- return toResult (this .placeholder .resolve (this .platform , argument ));
54- }
55-
56- private static PlaceholderResult toResult (Component component ) {
57- return component == null
58- ? PlaceholderResult .invalid ()
59- : PlaceholderResult .value (toText (component ));
60- }
61-
62- private static net .minecraft .network .chat .Component toText (Component component ) {
63- return ComponentSerialization .CODEC .decode (
64- RegistryAccess .EMPTY .createSerializationContext (JsonOps .INSTANCE ),
65- GsonComponentSerializer .gson ().serializeToTree (component )
66- ).getOrThrow (JsonParseException ::new ).getFirst ();
67- }
68- }
50+ // private record Handler(SparkPlatform platform, SparkPlaceholder placeholder) implements PlaceholderHandler {
51+ // @Override
52+ // public PlaceholderResult onPlaceholderRequest(PlaceholderContext context, @Nullable String argument) {
53+ // return toResult(this.placeholder.resolve(this.platform, argument));
54+ // }
55+ //
56+ // private static PlaceholderResult toResult(Component component) {
57+ // return component == null
58+ // ? PlaceholderResult.invalid()
59+ // : PlaceholderResult.value(toText(component));
60+ // }
61+ //
62+ // private static net.minecraft.network.chat.Component toText(Component component) {
63+ // return ComponentSerialization.CODEC.decode(
64+ // RegistryAccess.EMPTY.createSerializationContext(JsonOps.INSTANCE),
65+ // GsonComponentSerializer.gson().serializeToTree(component)
66+ // ).getOrThrow(JsonParseException::new).getFirst();
67+ // }
68+ // }
6969
7070}
0 commit comments