2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2021-06-17 11:37:24 +02:00
|
|
|
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
2021-06-11 14:02:28 +02:00
|
|
|
Date: Sat, 24 Apr 2021 02:09:32 -0700
|
|
|
|
Subject: [PATCH] Implement methods to convert between Component and
|
|
|
|
Brigadier's Message
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/brigadier/PaperBrigadierProviderImpl.java b/src/main/java/io/papermc/paper/brigadier/PaperBrigadierProviderImpl.java
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000000000000000000000000000000000000..dd6012b6a097575b2d1471be5069eccee4537c0a
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/io/papermc/paper/brigadier/PaperBrigadierProviderImpl.java
|
|
|
|
@@ -0,0 +1,30 @@
|
|
|
|
+package io.papermc.paper.brigadier;
|
|
|
|
+
|
|
|
|
+import com.mojang.brigadier.Message;
|
|
|
|
+import io.papermc.paper.adventure.PaperAdventure;
|
|
|
|
+import net.kyori.adventure.text.Component;
|
|
|
|
+import net.kyori.adventure.text.ComponentLike;
|
|
|
|
+import net.minecraft.network.chat.ComponentUtils;
|
|
|
|
+import org.checkerframework.checker.nullness.qual.NonNull;
|
|
|
|
+
|
|
|
|
+import static java.util.Objects.requireNonNull;
|
|
|
|
+
|
|
|
|
+public enum PaperBrigadierProviderImpl implements PaperBrigadierProvider {
|
|
|
|
+ INSTANCE;
|
|
|
|
+
|
|
|
|
+ PaperBrigadierProviderImpl() {
|
|
|
|
+ PaperBrigadierProvider.initialize(this);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public @NonNull Message message(final @NonNull ComponentLike componentLike) {
|
|
|
|
+ requireNonNull(componentLike, "componentLike");
|
|
|
|
+ return PaperAdventure.asVanilla(componentLike.asComponent());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public @NonNull Component componentFromMessage(final @NonNull Message message) {
|
|
|
|
+ requireNonNull(message, "message");
|
|
|
|
+ return PaperAdventure.asAdventure(ComponentUtils.fromMessage(message));
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
2024-06-13 17:45:43 +02:00
|
|
|
index 8f04770e479f2ee832edf55698153cd62524d9e8..c0261c3cd6de850edbd197272c2d1c52f76e6ebe 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
2024-04-24 15:46:45 +02:00
|
|
|
@@ -223,6 +223,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
2024-01-13 21:31:02 +01:00
|
|
|
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
|
|
|
|
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
|
|
|
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
|
|
|
+ io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // Paper - init PaperBrigadierProvider
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
2024-01-13 21:31:02 +01:00
|
|
|
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|