1.15.2 Can yall help me figure this out.

Discussion in 'Spigot Plugin Development' started by ThatsJulian, Feb 25, 2020.

  1. java: cannot access net.minecraft.server.v1_15_R1.PacketPlayOutPlayerInfo.PlayerInfoData

    Code (Text):
    public PacketPlayOutPlayerInfo create(PacketPlayOutPlayerInfo.EnumPlayerInfoAction action, GameProfile gameProfile, String name) {
            PacketPlayOutPlayerInfo packetPlayOutPlayerInfo = new PacketPlayOutPlayerInfo();
            Reflection.getField(packetPlayOutPlayerInfo.getClass(), "a", PacketPlayOutPlayerInfo.EnumPlayerInfoAction.class)
                    .set(packetPlayOutPlayerInfo, action);

            PacketPlayOutPlayerInfo.PlayerInfoData playerInfoData = packetPlayOutPlayerInfo.new PlayerInfoData(gameProfile, 1,
                    EnumGamemode.NOT_SET, IChatBaseComponent.ChatSerializer.a(name));

            Reflection.FieldAccessor<List> fieldAccessor = Reflection.getField(packetPlayOutPlayerInfo.getClass(), "b", List.class);

            List list = fieldAccessor.get(packetPlayOutPlayerInfo);
            list.add(playerInfoData);
            fieldAccessor.set(packetPlayOutPlayerInfo, list);

            return packetPlayOutPlayerInfo;
        }
     
  2. Can you post the full stack trace?
     
  3. Have you included the full jar or the API jar?
     
  4. Did you set it accessible in your various reflection-helpers?
     
  5. I can post a screenshot that's all that intellj prints, when i try to maven build.
     
  6. Code (Text):
    Error:(18, 32) java: cannot access net.minecraft.server.v1_15_R1.PacketPlayOutPlayerInfo.PlayerInfoData
      bad class file: /C:/Users/jorde/.m2/repository/org/bukkit/craftbukkit/1.15.2-R0.1-SNAPSHOT/craftbukkit-1.15.2-R0.1-SNAPSHOT.jar!/net/minecraft/server/v1_15_R1/PacketPlayOutPlayerInfo$PlayerInfoData.class
        bad RuntimeInvisibleParameterAnnotations attribute: PlayerInfoData(com.mojang.authlib.GameProfile,int,net.minecraft.server.v1_15_R1.EnumGamemode,net.minecraft.server.v1_15_R1.IChatBaseComponent)
        Please remove or make sure it appears in the correct subdirectory of the classpath.
     
  7. So I try to narrow down the issue now, and it seems to only be

    Code (Text):

            PacketPlayOutPlayerInfo.PlayerInfoData playerInfoData = packetPlayOutPlayerInfo.new PlayerInfoData(gameProfile, 1,
                    EnumGamemode.NOT_SET, IChatBaseComponent.ChatSerializer.a(name));
    Cause the project can't access it but that makes no sense to me so I rebuilt the craftbukkit repo and still nothing
     
  8. I have the same problem, did you find any solution?