Solved PlayerConnection

Discussion in 'Plugin Development' started by xTrollxDudex, Jan 19, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    xTrollxDudex

    Will directly proxying the playerConnection field in EntityPlayer have any adverse side effects? Or is there another way to proxy that class without having to use the field in EntityPlayer?

    What I'm trying to do:
    PHP:
    // PlayerJoinEvent
    EntityPlayer entityPlayer = ((CraftPlayere.getPlayer()).getHandle();
    entityPlayer.playerConnection = new ProxiedPlayerConnection(entityPlayer); 
    It's replacing the PlayerConnection with my own.

    I know Comphenix is the man to talk to about this ;)
     
  2. Offline

    Comphenix

    Last time I did it (1.6.4), I also had to inject the lists of PendingConnections and PlayerConnections in ServerConnection, otherwise players would get kicked for "spamming". But it doesn't look like it's necessary in 1.7.2. There might be other side-effects, though.

    But if you're doing this to intercept packets, you should consider using ProtocolLib instead. It's also much easier to inject into the channel pipeline (TinyProtocol) and get each sent/received packet that way.

    Here's an example of how to use it.
     
  3. Offline

    xTrollxDudex

    Comphenix
    Hey, the man himself has come ;)

    What if I'm not using it to intercept packets? :p

    Then would it be a good idea or not to directly proxy the field?
     
  4. Offline

    Comphenix

    Well, it worked in ProtocolLib, but as I said, I haven't tested it in 1.7.2.

    Just remember to clean up the field before your plugin is disabled. Otherwise, your plugin might break after a server reload.
     
  5. Offline

    xTrollxDudex

    Comphenix
    Alright, thanks. You have been most helpful :)
     
  6. xTrollxDudex Why would you want to proxy it in the first place?
     
  7. Offline

    xTrollxDudex

  8. Offline

    Garris0n

    I'm scared.
     
  9. Offline

    calebbfmv

    Oh god no
     
    Garris0n likes this.
Thread Status:
Not open for further replies.

Share This Page