Fix cancelling TabCompleteEvent.

The packet would get sent regardless if the event was cancelled, only if there were no suggestions available.
This commit is contained in:
Tux 2016-02-07 01:33:51 -05:00 committed by md_5
parent 9c4380a201
commit 848cad2a59

View File

@ -134,17 +134,17 @@ public class UpstreamBridge extends PacketHandler
TabCompleteEvent tabCompleteEvent = new TabCompleteEvent( con, con.getServer(), tabComplete.getCursor(), suggestions ); TabCompleteEvent tabCompleteEvent = new TabCompleteEvent( con, con.getServer(), tabComplete.getCursor(), suggestions );
bungee.getPluginManager().callEvent( tabCompleteEvent ); bungee.getPluginManager().callEvent( tabCompleteEvent );
if ( tabCompleteEvent.isCancelled() )
{
throw CancelSendSignal.INSTANCE;
}
List<String> results = tabCompleteEvent.getSuggestions(); List<String> results = tabCompleteEvent.getSuggestions();
if ( !results.isEmpty() ) if ( !results.isEmpty() )
{ {
con.unsafe().sendPacket( new TabCompleteResponse( results ) ); con.unsafe().sendPacket( new TabCompleteResponse( results ) );
throw CancelSendSignal.INSTANCE; throw CancelSendSignal.INSTANCE;
} }
if ( tabCompleteEvent.isCancelled() )
{
throw CancelSendSignal.INSTANCE;
}
} }
@Override @Override