Custom Chat Completion Suggestions API

This commit is contained in:
Owen1212055 2022-07-30 11:23:05 -04:00
parent ce7cf07354
commit 44f8b39a2c

View file

@ -698,6 +698,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
// Paper end - Add sendOpLevel API // 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 @Override
public void setCompassTarget(Location loc) { public void setCompassTarget(Location loc) {
Preconditions.checkArgument(loc != null, "Location cannot be null"); Preconditions.checkArgument(loc != null, "Location cannot be null");