mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-15 03:52:12 +01:00
#1141: Add methods to edit custom chat completions
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
c8aa873369
commit
ed5774c2f5
@ -38,6 +38,7 @@ import net.minecraft.network.PacketDataSerializer;
|
|||||||
import net.minecraft.network.chat.IChatBaseComponent;
|
import net.minecraft.network.chat.IChatBaseComponent;
|
||||||
import net.minecraft.network.chat.PlayerChatMessage;
|
import net.minecraft.network.chat.PlayerChatMessage;
|
||||||
import net.minecraft.network.protocol.game.ClientboundClearTitlesPacket;
|
import net.minecraft.network.protocol.game.ClientboundClearTitlesPacket;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket;
|
||||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket;
|
import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket;
|
||||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
|
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
|
||||||
import net.minecraft.network.protocol.game.ClientboundSetBorderCenterPacket;
|
import net.minecraft.network.protocol.game.ClientboundSetBorderCenterPacket;
|
||||||
@ -839,6 +840,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
getHandle().connection.send(packet);
|
getHandle().connection.send(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCustomChatCompletions(Collection<String> completions) {
|
||||||
|
this.sendCustomChatCompletionPacket(completions, ClientboundCustomChatCompletionsPacket.a.ADD);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeCustomChatCompletions(Collection<String> completions) {
|
||||||
|
this.sendCustomChatCompletionPacket(completions, ClientboundCustomChatCompletionsPacket.a.REMOVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCustomChatCompletions(Collection<String> completions) {
|
||||||
|
this.sendCustomChatCompletionPacket(completions, ClientboundCustomChatCompletionsPacket.a.SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendCustomChatCompletionPacket(Collection<String> completions, ClientboundCustomChatCompletionsPacket.a action) { // PAIL rename Action
|
||||||
|
if (getHandle().connection == null) return;
|
||||||
|
|
||||||
|
ClientboundCustomChatCompletionsPacket packet = new ClientboundCustomChatCompletionsPacket(action, new ArrayList<>(completions));
|
||||||
|
getHandle().connection.send(packet);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRotation(float yaw, float pitch) {
|
public void setRotation(float yaw, float pitch) {
|
||||||
throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead.");
|
throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead.");
|
||||||
|
Loading…
Reference in New Issue
Block a user