Add API for custom chat completions like on Paper (#1232)

* Add API for custom chat completions like on Paper, renamed enum constant to match its function, NMS and wiki-vg

* add null and version checks
This commit is contained in:
itsTyrion
2024-02-09 22:23:16 +01:00
committed by GitHub
parent 7bff6b19eb
commit d8bb4e97e4
3 changed files with 64 additions and 2 deletions

View File

@@ -309,4 +309,33 @@ public interface Player extends
* @return the player's client brand
*/
@Nullable String getClientBrand();
/**
* Add custom chat completion suggestions shown to the player while typing a message.
*
* @param completions the completions to send
*/
void addCustomChatCompletions(@NotNull Collection<String> completions);
/**
* Remove custom chat completion suggestions shown to the player while typing a message.
*
* <p>Online player names can't be removed with this method, it will only affect
* custom completions added by {@link #addCustomChatCompletions(Collection)}
* or {@link #setCustomChatCompletions(Collection)}.
*
* @param completions the completions to remove
*/
void removeCustomChatCompletions(@NotNull Collection<String> completions);
/**
* Set the list of chat completion suggestions shown to the player while typing a message.
*
* <p>If completions were set previously, this method will remove them all
* and replace them with the provided completions.
*
* @param completions the completions to set
*/
void setCustomChatCompletions(@NotNull Collection<String> completions);
}