Search in sources :

Example 1 with SPacketTabComplete

use of net.minecraft.network.play.server.SPacketTabComplete in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class NetHandlerPlayServer method processTabComplete.

/**
 * Retrieves possible tab completions for the requested command string and sends them to the client
 */
public void processTabComplete(CPacketTabComplete packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    List<String> list = Lists.<String>newArrayList();
    for (String s : this.serverController.getTabCompletions(this.playerEntity, packetIn.getMessage(), packetIn.getTargetBlock(), packetIn.hasTargetBlock())) {
        list.add(s);
    }
    this.playerEntity.connection.sendPacket(new SPacketTabComplete((String[]) list.toArray(new String[list.size()])));
}
Also used : SPacketTabComplete(net.minecraft.network.play.server.SPacketTabComplete) NBTTagString(net.minecraft.nbt.NBTTagString) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 2 with SPacketTabComplete

use of net.minecraft.network.play.server.SPacketTabComplete in project CumServerPro by MCUmbrella.

the class NetHandlerPlayServer method processTabComplete.

public void processTabComplete(CPacketTabComplete packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.player.getServerWorld());
    if (chatSpamField.addAndGet(this, 10) > 500 && !this.serverController.getPlayerList().canSendCommands(this.player.getGameProfile())) {
        this.disconnect(new TextComponentTranslation("disconnect.spam"));
        return;
    }
    // CumServer - start 删除不必要的实例
    List<String> list = this.serverController.getTabCompletions(this.player, packetIn.getMessage(), packetIn.getTargetBlock(), packetIn.hasTargetBlock());
    // CumServer - end
    this.player.connection.sendPacket(new SPacketTabComplete(list.toArray(new String[0])));
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) SPacketTabComplete(net.minecraft.network.play.server.SPacketTabComplete) NBTTagString(net.minecraft.nbt.NBTTagString) TextComponentString(net.minecraft.util.text.TextComponentString)

Aggregations

NBTTagString (net.minecraft.nbt.NBTTagString)2 SPacketTabComplete (net.minecraft.network.play.server.SPacketTabComplete)2 TextComponentString (net.minecraft.util.text.TextComponentString)2 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1