当前位置: 首页>>代码示例>>Java>>正文


Java MessageToMessageDecoder类代码示例

本文整理汇总了Java中io.netty.handler.codec.MessageToMessageDecoder的典型用法代码示例。如果您正苦于以下问题:Java MessageToMessageDecoder类的具体用法?Java MessageToMessageDecoder怎么用?Java MessageToMessageDecoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MessageToMessageDecoder类属于io.netty.handler.codec包,在下文中一共展示了MessageToMessageDecoder类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: injectNetty

import io.netty.handler.codec.MessageToMessageDecoder; //导入依赖的package包/类
public static void injectNetty(final Player player) {
    try {
        Object handle = player.getClass().getMethod("getHandle").invoke(player);
        Object playerConnection = handle.getClass().getField("playerConnection").get(handle);
        final Channel channel = (Channel) channelField.get(playerConnection.getClass().getField("networkManager").get(playerConnection));
        if (channel != null) {
            channel.pipeline().addAfter("decoder", "update_sign", new MessageToMessageDecoder<Object>() {
                @Override
                protected void decode(ChannelHandlerContext channelHandlerContext, Object object, List list) throws Exception {
                    if (object.toString().contains("PacketPlayInUpdateSign")) {
                        Object packet = ReflectionUtil.getNMSClass("PacketPlayInUpdateSign").cast(object);
                        Bukkit.getPluginManager().callEvent(new PlayerInputEvent(player, (String[]) packet.getClass().getMethod("b").invoke(packet)));
                    }
                    list.add(object);
                }
            });
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:ConnorLinfoot,项目名称:CratesPlus,代码行数:22,代码来源:SignInputHandler.java

示例2: callDecode

import io.netty.handler.codec.MessageToMessageDecoder; //导入依赖的package包/类
public static List<Object> callDecode(MessageToMessageDecoder decoder, ChannelHandlerContext ctx, ByteBuf input) throws InvocationTargetException {
    List<Object> output = new ArrayList<>();
    try {
        BungeePipelineUtil.DECODE_METHOD.invoke(decoder, ctx, input, output);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return output;
}
 
开发者ID:MylesIsCool,项目名称:ViaVersion,代码行数:10,代码来源:BungeePipelineUtil.java

示例3: decompress

import io.netty.handler.codec.MessageToMessageDecoder; //导入依赖的package包/类
public static ByteBuf decompress(ChannelHandlerContext ctx, ByteBuf bytebuf) {
    try {
        return (ByteBuf) callDecode((MessageToMessageDecoder) ctx.pipeline().get("decompress"), ctx.pipeline().context("decompress"), bytebuf).get(0);
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        return ctx.alloc().buffer();
    }
}
 
开发者ID:MylesIsCool,项目名称:ViaVersion,代码行数:9,代码来源:BungeePipelineUtil.java

示例4: CryptoFunction

import io.netty.handler.codec.MessageToMessageDecoder; //导入依赖的package包/类
public CryptoFunction(byte[] key, MessageToMessageEncoder<ByteBuf> encoder, MessageToMessageDecoder<ByteBuf> decoder) {

        this.key = key;
        this.encoder = encoder;
        this.decoder = decoder;
    }
 
开发者ID:JackWhite20,项目名称:Cascade,代码行数:7,代码来源:CryptoFunction.java

示例5: getDecoder

import io.netty.handler.codec.MessageToMessageDecoder; //导入依赖的package包/类
public MessageToMessageDecoder<ByteBuf> getDecoder() {

        return decoder;
    }
 
开发者ID:JackWhite20,项目名称:Cascade,代码行数:5,代码来源:CryptoFunction.java


注:本文中的io.netty.handler.codec.MessageToMessageDecoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。