EnumPlayerInfoAction NMS

Discussion in 'Spigot Plugin Development' started by ano95, May 27, 2016.

  1. Hello, I am trying to access [nms].PacketPlayOutPlayerInfo.EnumPlayerInfoAction and use it as argument for PacketPlayOutPlayerInfo. But it can't find constructor.
    This is my code:
    Code (Text):
    Class enumPIA = NMSUtil.getNMSClass("PacketPlayOutPlayerInfo$EnumPlayerInfoAction");
    Object packet1 = NMSUtil.getNMSClass("PacketPlayOutPlayerInfo").getConstructor(enumPIA, npc.getClass()).newInstance(
                            enumPIA.getMethod("valueOf", String.class).invoke("ADD_PLAYER"),
    (npc is instance of EntityPlayer)
    This is the error:
    Code (Text):
    java.lang.NoSuchMethodException: net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo.<init>(net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo$EnumPlayerInfoAction, net.minecraft.server.v1_9_R1.EntityPlayer)
    But the constructor for PacketPlayOutPlayerInfo is
    PacketPlayOutPlayerInfo([nms].PacketPlayOutPlayerInfo.EnumPlayerInfoAction action, [nms].EntityPlayer... eps)

    So, where is the problem?

  2. This is an array. You are aware of that, right?
  3. It is not. There is a option to put array as parameter, but I am not using it.
  4. @ano95 ... compiles into an array, but in the code it allows you to specify less arguments.
  5. Yes, it does, but I am not inserting array into it. However, I think thath I found a solution