Paper/patches/server/0770-Custom-Chat-Completion-Suggestions-API.patch
Owen 89d51d5f29
Allow enabling sand duping (#10191)
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable.

It should be noted that this decision does not promise all future exploits will be configurable.
2024-03-03 17:05:34 -05:00

36 lines
1.7 KiB
Diff

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
index f606250106f1bcf5870dff1167f2902f85f7784a..e278933f1b8fec3165ef088e2a15872cf34f1258 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -611,6 +611,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end - Add sendOpLevel API
+ // Paper start - custom chat completions API
+ @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
+
@Override
public void setCompassTarget(Location loc) {
Preconditions.checkArgument(loc != null, "Location cannot be null");