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
This commit is contained in:
Aikar 2020-05-02 15:25:55 -04:00
parent 0dd1907568
commit 932e97f345
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
* Called when sending Suggestions to the client. Will be called asynchronously if a plugin * Called when sending Suggestions to the client. Will be called asynchronously if a plugin
* marks the AsyncTabComplete event handled asynchronously, otherwise called synchronously. * marks the AsyncTabComplete event handled asynchronously, otherwise called synchronously.
*/ */
public class AsyncSendPlayerSuggestionsEvent extends PlayerEvent implements Cancellable { public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false; private boolean cancelled = false;
@ -21,7 +21,7 @@ public class AsyncSendPlayerSuggestionsEvent extends PlayerEvent implements Canc
private Suggestions suggestions; private Suggestions suggestions;
private final String buffer; private final String buffer;
public AsyncSendPlayerSuggestionsEvent(Player player, Suggestions suggestions, String buffer) { public AsyncPlayerSendSuggestionsEvent(Player player, Suggestions suggestions, String buffer) {
super(player, !Bukkit.isPrimaryThread()); super(player, !Bukkit.isPrimaryThread());
this.suggestions = suggestions; this.suggestions = suggestions;
this.buffer = buffer; this.buffer = buffer;

View File

@ -1,4 +1,4 @@
From 93ca45257861ecd220c28c8e9b14638d6e3206dc Mon Sep 17 00:00:00 2001 From 2b3eacadbea7c13465bc855a2dacd7bbeeaaa33b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 19 Apr 2020 18:15:29 -0400 Date: Sun, 19 Apr 2020 18:15:29 -0400
Subject: [PATCH] Implement Brigadier Mojang API Subject: [PATCH] Implement Brigadier Mojang API
@ -69,7 +69,7 @@ index 0b23a0548d..c988c929f1 100644
public boolean hasPermission(int i) { public boolean hasPermission(int i) {
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 38ec22f4c0..376f7f8f0b 100644 index 38ec22f4c0..a180df220e 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -576,8 +576,12 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -576,8 +576,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -79,7 +79,7 @@ index 38ec22f4c0..376f7f8f0b 100644
- if (((Suggestions) suggestions).isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer - if (((Suggestions) suggestions).isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error - this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error
+ // Paper start + // Paper start
+ com.destroystokyo.paper.event.brigadier.AsyncSendPlayerSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncSendPlayerSuggestionsEvent(this.getPlayer(), suggestions, buffer); + com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getPlayer(), suggestions, buffer);
+ suggestEvent.setCancelled(suggestions.isEmpty()); + suggestEvent.setCancelled(suggestions.isEmpty());
+ if (!suggestEvent.callEvent()) return; + if (!suggestEvent.callEvent()) return;
+ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestEvent.getSuggestions())); // CraftBukkit - decompile error // Paper + this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestEvent.getSuggestions())); // CraftBukkit - decompile error // Paper
@ -93,7 +93,7 @@ index 38ec22f4c0..376f7f8f0b 100644
completions.forEach(builder::suggest); completions.forEach(builder::suggest);
- player.playerConnection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), builder.buildFuture().join())); - player.playerConnection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), builder.buildFuture().join()));
+ Suggestions suggestions = builder.buildFuture().join(); + Suggestions suggestions = builder.buildFuture().join();
+ com.destroystokyo.paper.event.brigadier.AsyncSendPlayerSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncSendPlayerSuggestionsEvent(this.getPlayer(), suggestions, buffer); + com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getPlayer(), suggestions, buffer);
+ suggestEvent.setCancelled(suggestions.isEmpty()); + suggestEvent.setCancelled(suggestions.isEmpty());
+ if (!suggestEvent.callEvent()) return; + if (!suggestEvent.callEvent()) return;
+ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestEvent.getSuggestions())); + this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestEvent.getSuggestions()));