Add Tab Completion loosely based on @TheUnnamedDude's work.

This commit is contained in:
md_5
2013-09-15 06:46:10 +10:00
parent 042f47cbb9
commit 29c897c9cf
6 changed files with 102 additions and 2 deletions

View File

@@ -13,8 +13,11 @@ import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.netty.PacketWrapper;
import net.md_5.bungee.protocol.packet.Packet0KeepAlive;
import net.md_5.bungee.protocol.packet.Packet3Chat;
import net.md_5.bungee.protocol.packet.PacketCBTabComplete;
import net.md_5.bungee.protocol.packet.PacketCCSettings;
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
import java.util.ArrayList;
import java.util.List;
public class UpstreamBridge extends PacketHandler
{
@@ -89,6 +92,18 @@ public class UpstreamBridge extends PacketHandler
throw new CancelSendSignal();
}
@Override
public void handle(PacketCBTabComplete tabComplete) throws Exception
{
if ( tabComplete.getCursor().startsWith( "/" ) )
{
List<String> results = new ArrayList<>();
bungee.getPluginManager().dispatchCommand( con, tabComplete.getCursor(), results );
con.unsafe().sendPacket( new PacketCBTabComplete( results.toArray( new String[ results.size() ] ) ) );
throw new CancelSendSignal();
}
}
@Override
public void handle(PacketCCSettings settings) throws Exception
{