Package net.glowstone.net.codec.play.game

Source Code of net.glowstone.net.codec.play.game.IncomingChatCodec

package net.glowstone.net.codec.play.game;

import com.flowpowered.networking.Codec;
import com.flowpowered.networking.util.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import net.glowstone.net.message.play.game.IncomingChatMessage;

import java.io.IOException;

public final class IncomingChatCodec implements Codec<IncomingChatMessage> {
    @Override
    public IncomingChatMessage decode(ByteBuf buffer) throws IOException {
        return new IncomingChatMessage(ByteBufUtils.readUTF8(buffer));
    }

    @Override
    public ByteBuf encode(ByteBuf buf, IncomingChatMessage message) throws IOException {
        ByteBufUtils.writeUTF8(buf, message.getText());
        return buf;
    }
}
TOP

Related Classes of net.glowstone.net.codec.play.game.IncomingChatCodec

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.