Discussion in 'Spigot Plugin Development' started by bys1, May 2, 2017.

  1. Is there a way to access a player's Channel in NMS v1_8_R1 without using any Reflection or API?

    In 1_8_R2, the Channel is a private Channel k in NetworkManager which has been made public in craftbukkit. From 1_8_R3 and newer, the channel is a public Channel channel in NetworkManager.
    In 1_8_R1, the Channel is a private Channel i which can also be accessed via static Channel a(NetworkManager manager) (package visibility level). Currently, in 1_8_R1 I get the Channel by invoking the static method a via Reflection, but I was wondering if there's a way to get it without Reflection.
    #1 bys1, May 2, 2017
    Last edited: May 2, 2017
  2. Confirmed, i already found this very useful.
    Confirmed, too. But this method isn't public. It only can be used by classes of the same package.
    Also see here:

    You could create a class inside of the same package, then use #a (so you wouldn't need a reflection)... but i would not recomment it.

    My personal opinion: If you really need to support 1.8 use reflection and reflection fallbacks to handle the different name of the channel.
  3. Like I said, that method is package visibility level and I'm now invoking that via reflection. I use abstraction with NMS so I have a different class for each version of minecraft as of 1_8_R1, so luckily I can just use Reflection in that one class.

    I also saw something where there was a private Channel m and a public static Channel a(NetworkManager manager). Does anyone know which version that is?
  4. Little bump for that