From 932e97f345fa539c0a690ff298e61cc13e3071b8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 2 May 2020 15:25:55 -0400 Subject: Rename to AsyncPlayerSendSuggestionsEvent to be consistent in naming It was still technically read correctly in what it was doing, but all our Player events begin with Player. Nothing uses this event yet so safe to rename. If you are some rapid adopter of this event, sorry :P --- .../brigadier/AsyncPlayerSendSuggestionsEvent.java | 77 ++++++++++++++++++++++ .../brigadier/AsyncSendPlayerSuggestionsEvent.java | 77 ---------------------- 2 files changed, 77 insertions(+), 77 deletions(-) create mode 100644 Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendSuggestionsEvent.java delete mode 100644 Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncSendPlayerSuggestionsEvent.java (limited to 'Paper-MojangAPI') diff --git a/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendSuggestionsEvent.java b/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendSuggestionsEvent.java new file mode 100644 index 0000000000..13819b6185 --- /dev/null +++ b/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendSuggestionsEvent.java @@ -0,0 +1,77 @@ +package com.destroystokyo.paper.event.brigadier; + +import com.mojang.brigadier.suggestion.Suggestions; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; +import org.jetbrains.annotations.NotNull; + +/** + * Called when sending Suggestions to the client. Will be called asynchronously if a plugin + * marks the AsyncTabComplete event handled asynchronously, otherwise called synchronously. + */ +public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Cancellable { + + private static final HandlerList handlers = new HandlerList(); + private boolean cancelled = false; + + private Suggestions suggestions; + private final String buffer; + + public AsyncPlayerSendSuggestionsEvent(Player player, Suggestions suggestions, String buffer) { + super(player, !Bukkit.isPrimaryThread()); + this.suggestions = suggestions; + this.buffer = buffer; + } + + /** + * @return The input buffer sent to request these suggestions + */ + public String getBuffer() { + return buffer; + } + + /** + * @return The suggestions being sent to client + */ + public Suggestions getSuggestions() { + return suggestions; + } + + /** + * @param suggestions The suggestions to be sent to client if need to change them + */ + public void setSuggestions(Suggestions suggestions) { + this.suggestions = suggestions; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isCancelled() { + return this.cancelled; + } + + /** + * Cancels sending suggestions to the client + * {@inheritDoc} + */ + @Override + public void setCancelled(boolean cancel) { + this.cancelled = cancel; + } + + @NotNull + public HandlerList getHandlers() { + return handlers; + } + + @NotNull + public static HandlerList getHandlerList() { + return handlers; + } +} diff --git a/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncSendPlayerSuggestionsEvent.java b/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncSendPlayerSuggestionsEvent.java deleted file mode 100644 index dbdb72984b..0000000000 --- a/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncSendPlayerSuggestionsEvent.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.destroystokyo.paper.event.brigadier; - -import com.mojang.brigadier.suggestion.Suggestions; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -/** - * Called when sending Suggestions to the client. Will be called asynchronously if a plugin - * marks the AsyncTabComplete event handled asynchronously, otherwise called synchronously. - */ -public class AsyncSendPlayerSuggestionsEvent extends PlayerEvent implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled = false; - - private Suggestions suggestions; - private final String buffer; - - public AsyncSendPlayerSuggestionsEvent(Player player, Suggestions suggestions, String buffer) { - super(player, !Bukkit.isPrimaryThread()); - this.suggestions = suggestions; - this.buffer = buffer; - } - - /** - * @return The input buffer sent to request these suggestions - */ - public String getBuffer() { - return buffer; - } - - /** - * @return The suggestions being sent to client - */ - public Suggestions getSuggestions() { - return suggestions; - } - - /** - * @param suggestions The suggestions to be sent to client if need to change them - */ - public void setSuggestions(Suggestions suggestions) { - this.suggestions = suggestions; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isCancelled() { - return this.cancelled; - } - - /** - * Cancels sending suggestions to the client - * {@inheritDoc} - */ - @Override - public void setCancelled(boolean cancel) { - this.cancelled = cancel; - } - - @NotNull - public HandlerList getHandlers() { - return handlers; - } - - @NotNull - public static HandlerList getHandlerList() { - return handlers; - } -} -- cgit v1.2.3