aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-api/src/main/java/brigadier/PaperBrigadierProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'paper-api/src/main/java/brigadier/PaperBrigadierProvider.java')
-rw-r--r--paper-api/src/main/java/brigadier/PaperBrigadierProvider.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/paper-api/src/main/java/brigadier/PaperBrigadierProvider.java b/paper-api/src/main/java/brigadier/PaperBrigadierProvider.java
new file mode 100644
index 0000000000..7f24806384
--- /dev/null
+++ b/paper-api/src/main/java/brigadier/PaperBrigadierProvider.java
@@ -0,0 +1,30 @@
+package io.papermc.paper.brigadier;
+
+import com.mojang.brigadier.Message;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.ComponentLike;
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
+import org.checkerframework.checker.nullness.qual.NonNull;
+
+import static java.util.Objects.requireNonNull;
+
+interface PaperBrigadierProvider {
+ final class Holder {
+ private static @MonotonicNonNull PaperBrigadierProvider INSTANCE;
+ }
+
+ static @NonNull PaperBrigadierProvider instance() {
+ return requireNonNull(Holder.INSTANCE, "PaperBrigadierProvider has not yet been initialized!");
+ }
+
+ static void initialize(final @NonNull PaperBrigadierProvider instance) {
+ if (Holder.INSTANCE != null) {
+ throw new IllegalStateException("PaperBrigadierProvider has already been initialized!");
+ }
+ Holder.INSTANCE = instance;
+ }
+
+ @NonNull Message message(@NonNull ComponentLike componentLike);
+
+ @NonNull Component componentFromMessage(@NonNull Message message);
+}