mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
ef0e5a642d
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API 48c0c547 PR-786: Add methods to get sounds from entities CraftBukkit Changes: 5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event 4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation 4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API e5d6a9bbf PR-1100: Add methods to get sounds from entities b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta Spigot Changes: 4c157bb4 Rebuild patches
56 lines
2.6 KiB
Diff
56 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
|
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
|
|
index f812b0a2d5534a7c443361bd69cfc2fe2110ba9a..2c215e2080f00d6c875fbde92fd2c1c051d0cf98 100644
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -214,6 +214,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
io.papermc.paper.command.PaperCommands.registerCommands(this);
|
|
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics();
|
|
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
|
+ io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
|
// Paper end
|
|
|
|
this.setPvpAllowed(dedicatedserverproperties.pvp);
|