Add transaction id to TabCompleteEvent

This commit is contained in:
Mex Smits 2021-05-17 19:59:45 +02:00
parent b60a30c705
commit d4b3a5e86f
2 changed files with 15 additions and 1 deletions

View File

@ -29,11 +29,25 @@ public class TabCompleteEvent extends TargetedEvent implements Cancellable
* this list is empty, the request will be forwarded to the server.
*/
private final List<String> suggestions;
/**
* The transaction id for 1.13+ clients.
*/
private final int transactionId;
/**
* @deprecated Use {@link #TabCompleteEvent(Connection, Connection, String, List, int)} instead.
*/
@Deprecated
public TabCompleteEvent(Connection sender, Connection receiver, String cursor, List<String> suggestions)
{
this(sender, receiver, cursor, suggestions, 0);
}
public TabCompleteEvent(Connection sender, Connection receiver, String cursor, List<String> suggestions, int transactionId)
{
super( sender, receiver );
this.cursor = cursor;
this.suggestions = suggestions;
this.transactionId = transactionId;
}
}

View File

@ -169,7 +169,7 @@ public class UpstreamBridge extends PacketHandler
bungee.getPluginManager().dispatchCommand( con, tabComplete.getCursor().substring( 1 ), suggestions );
}
TabCompleteEvent tabCompleteEvent = new TabCompleteEvent( con, con.getServer(), tabComplete.getCursor(), suggestions );
TabCompleteEvent tabCompleteEvent = new TabCompleteEvent( con, con.getServer(), tabComplete.getCursor(), suggestions, tabComplete.getTransactionId() );
bungee.getPluginManager().callEvent( tabCompleteEvent );
if ( tabCompleteEvent.isCancelled() )