Package com.comphenix.protocol.injector.server

Examples of com.comphenix.protocol.injector.server.SocketInjector


   * @return The player we found.
   */
  @Override
  public Player getPlayerByConnection(DataInputStream inputStream) {
    // Wait until the connection owner has been established
    SocketInjector injector = inputStreamLookup.waitSocketInjector(inputStream);
   
    if (injector != null) {
      return injector.getPlayer();
    } else {
      return null;
    }
  }
View Full Code Here


           
            // Ignore logged out players
            if (address == null)
              return null;
           
            SocketInjector previous = inputStreamLookup.peekSocketInjector(address);
            Socket socket = injector.getSocket();

            // Close any previously associated hooks before we proceed
            if (previous != null && !(player instanceof Factory)) {
              switch (stategy) {
              case OVERRIDE:
                uninjectPlayer(previous.getPlayer(), true);
                break;
              case BAIL_OUT:
                return null;
              }
            }
View Full Code Here

  public void updatePlayer(Player player) {
    SocketAddress address = player.getAddress();
   
    // Ignore logged out players
    if (address != null) {
      SocketInjector injector = inputStreamLookup.peekSocketInjector(address);
     
      if (injector != null) {
        injector.setUpdatedPlayer(player);
      } else {
        inputStreamLookup.setSocketInjector(player.getAddress(),
            new BukkitSocketInjector(player));
      }
    }
View Full Code Here

   * @return TRUE if a player has been uninjected, FALSE otherwise.
   */
  @Override
  public boolean uninjectPlayer(InetSocketAddress address) {
    if (!hasClosed && address != null) {
      SocketInjector injector = inputStreamLookup.peekSocketInjector(address);
     
      // Clean up
      if (injector != null)
        uninjectPlayer(injector.getPlayer(), true);
      return true;
    }
   
    return false;
  }
View Full Code Here

   * @param filters - whether or not to invoke the packet filters.
   * @throws InvocationTargetException If an error occured during sending.
   */
  @Override
  public void sendServerPacket(Player receiver, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException {
    SocketInjector injector = getInjector(receiver);
   
    // Send the packet, or drop it completely
    if (injector != null) {
      injector.sendServerPacket(packet.getHandle(), marker, filters);
    } else {
      throw new PlayerLoggedOutException(String.format(
          "Unable to send packet %s (%s): Player %s has logged out.",
          packet.getType(), packet, receiver
      ));
View Full Code Here

      // Must have logged out - there's nothing we can do
      if (address == null)
        return null;
     
      // Look that up without blocking
      SocketInjector result = inputStreamLookup.peekSocketInjector(address);

      // Ensure that it is non-null and a player injector
      if (result instanceof PlayerInjector)
        return (PlayerInjector) result;
      else
View Full Code Here

   * Retrieve the associated channel injector.
   * @param player - the temporary player, or normal Bukkit player.
   * @return The associated injector, or NULL if this is a Bukkit player.
   */
  private ChannelInjector getTemporaryInjector(Player player) {
    SocketInjector injector = TemporaryPlayerFactory.getInjectorFromPlayer(player);
   
    if (injector != null) {
      return ((ChannelSocketInjector) injector).getChannelInjector();
    }
    return null;
View Full Code Here

TOP

Related Classes of com.comphenix.protocol.injector.server.SocketInjector

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.