Package net.minecraft.util.io.netty.channel

Examples of net.minecraft.util.io.netty.channel.Channel


        };
   
        serverChannelHandler = new ChannelInboundHandlerAdapter() {
          @Override
          public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                Channel channel = (Channel) msg;

                // Prepare to initialize ths channel
                channel.pipeline().addFirst(beginInitProtocol);
                ctx.fireChannelRead(msg);
          }
        };
  }
View Full Code Here


    listener = new Listener() {
      @EventHandler(priority = EventPriority.LOWEST)
      public final void onPlayerLogin(PlayerLoginEvent e) {
        if (closed)
          return;
        Channel channel = getChannel(e.getPlayer());
       
        // Don't inject players that have been explicitly uninjected
        if (!uninjectedChannels.contains(channel)) {
          injectPlayer(e.getPlayer());
        }
View Full Code Here

      for (Object item : list) {
        if (!ChannelFuture.class.isInstance(item))
          break;
       
        // Channel future that contains the server connection
        Channel serverChannel = ((ChannelFuture)item).channel();
 
        serverChannels.add(serverChannel);
        serverChannel.pipeline().addFirst(serverChannelHandler);
        looking = false;
      }
    }
  }
View Full Code Here

   * Retrieve the Netty channel associated with a player. This is cached.
   * @param player - the player.
   * @return The Netty channel.
   */
  public Channel getChannel(Player player) {
    Channel channel = channelLookup.get(player.getName());
   
    // Lookup channel again
    if (channel == null) {
      Object connection = getConnection.get(getPlayerHandle.invoke(player));
      Object manager = getManager.get(connection);
View Full Code Here

    public volatile Player player;
   
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
      // Intercept channel
      final Channel channel = ctx.channel();
      handleLoginStart(channel, msg);
     
      try {
        msg = onPacketInAsync(player, channel, msg);
      } catch (Exception e) {
View Full Code Here

   
    // Must be a temporary Bukkit player
    if (networkManager == null) {
      return fromName(player.getName(), player);
    }
    Channel channel = FuzzyReflection.getFieldValue(networkManager, Channel.class, true);
   
    // See if a channel has already been created
    injector = (ChannelInjector) ChannelInjector.findChannelHandler(channel, ChannelInjector.class);
   
    if (injector != null) {
View Full Code Here

           
            // Add our handler to newly created channels
            final ChannelHandler connectionHandler = new ChannelInboundHandlerAdapter() {
              @Override
              public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                    Channel channel = (Channel) msg;

                    // Prepare to initialize ths channel
                    channel.pipeline().addFirst(beginInitProtocol);
                    ctx.fireChannelRead(msg);
              }
            };
           
            // Get the current NetworkMananger list
View Full Code Here

  /**
   * Revert any changes we made to the channel future.
   * @param future - the future.
   */
  protected void unprocessBootstrap(ChannelFuture future) {
    final Channel channel = future.channel();
   
    // For thread safety - see ChannelInjector.close()
    channel.eventLoop().submit(new Callable<Object>() {
      @Override
      public Object call() throws Exception {
        channel.pipeline().remove(handler);
        return null;
      }
    });
  }
View Full Code Here

        }
        this.disposalCrew.dispose(pipeline);
    }

    protected ChannelPipeline getPipeline(Player player) {
        Channel channel;
        try {
            channel = (Channel) this.getChannelField().get(this.getNetworkManager(player));
        } catch (final Exception e) {
            e.printStackTrace();
            return null;
        }
        return channel.pipeline();
    }
View Full Code Here

   
    public static void bind(Player player) {
      Object entityPlayer = Conversion.toEntityHandle.convert(player);
      Object playerConnection = EntityPlayerRef.playerConnection.get(entityPlayer);
      Object networkManager = PlayerConnectionRef.networkManager.get(playerConnection);
      Channel channel = NetworkManagerRef.channel.get(networkManager);
      channel.pipeline().addBefore("packet_handler", "bkcommonlib", new CommonChannelListener(player));
    }
View Full Code Here

TOP

Related Classes of net.minecraft.util.io.netty.channel.Channel

Copyright © 2018 www.massapicom. 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.