PaperMC/patches/server/0732-Custom-Chat-Completion-Suggestions-API.patch

36 lines
1.7 KiB
Diff
Raw Normal View History

2022-07-30 18:28:24 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Sat, 30 Jul 2022 11:23:05 -0400
Subject: [PATCH] Custom Chat Completion Suggestions API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2024-06-14 16:01:00 +02:00
index d0005af63d4ae0081a39797cb62c5ff3e2efa537..bffb3c029e917ccfc4b092a5d213a4d0f7a42ce4 100644
2022-07-30 18:28:24 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2024-06-14 03:30:23 +02:00
@@ -691,6 +691,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2022-07-30 18:28:24 +02:00
}
// Paper end - Add sendOpLevel API
+ // Paper start - custom chat completions API
2022-07-30 18:28:24 +02:00
+ @Override
+ public void addAdditionalChatCompletions(@NotNull Collection<String> completions) {
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket(
+ net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket.Action.ADD,
+ new ArrayList<>(completions)
+ ));
+ }
+
+ @Override
+ public void removeAdditionalChatCompletions(@NotNull Collection<String> completions) {
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket(
+ net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket.Action.REMOVE,
+ new ArrayList<>(completions)
+ ));
+ }
+ // Paper end - custom chat completions API
+
2022-07-30 18:28:24 +02:00
@Override
public void setCompassTarget(Location loc) {
Preconditions.checkArgument(loc != null, "Location cannot be null");