Maven compile error: cannot access n.m.s.v1_11_R1.PacketPlayOutPlayerInfo.PlayerInfoD

Discussion in 'Spigot Plugin Development' started by Martiii, Apr 13, 2017.

  1. Hi spigot comunity,

    Today I was trying to modify tablist entries but I couldn't compile my plugin using Maven. I got this error:
    cannot access net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo.PlayerInfoData
    Full error log.
    My code:
    Code (Java):

    PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
    try {
        Field a = packet.getClass().getDeclaredField("a");
        a.setAccessible(true);
        a.set(packet, PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER);
        Field b = packet.getClass().getDeclaredField("b");
        b.setAccessible(true);
        List<PacketPlayOutPlayerInfo.PlayerInfoData> dataList = Lists.newArrayList();
        dataList.add(packet.new PlayerInfoData(new GameProfile(UUID.randomUUID(), "Test"), 0, EnumGamemode.ADVENTURE, IChatBaseComponent.ChatSerializer.a("{\"text\":\"Test\"}")));
        b.set(packet, dataList);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
    } catch (Exception e) {
        e.printStackTrace();
    }
     
    The error points at this line:
    Code (Java):
    List<PacketPlayOutPlayerInfo.PlayerInfoData> dataList = Lists.newArrayList();
    There are other types of packets in the same project, but this is the only one that can't be compiled.
    I have the craftbukkit dependency in my pom.xml:
    Code (XML):

    <dependency>
        <groupId>org.bukkit</groupId>
        <artifactId>craftbukkit</artifactId>
        <version>1.11.2-R0.1-SNAPSHOT</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/libs/craftbukkit-1.11.2-R0.1-SNAPSHOT.jar</systemPath>
    </dependency>
     
    I've already run again BuildTools but I get the same error.
    Can you check if you get the same error?

    Thanks,