Solved How to send packet to player?

Discussion in 'Plugin Development' started by Tim_M, Sep 10, 2021.

  1. Offline


    'While looking around on I found ChangeGameStatePacket, which allows for changing the rain level. When set to high values it create cool effects like pitch black skies. I have been trying to make this packet for almost 3 hours now (including Bukkit API and ProtocolLib). But everything I tried always in some way ended up with this exact error:
    java.lang.NullPointerException: Cannot read field "b" because "var0" is null
    How can I send this packet? (I'm coding for 1.16.5)

    I should say that I managed to fix it. If anyone cares here's the solution:
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(
    new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.(INSERT LETER), 1f));
    Last edited: Sep 11, 2021
  2. Offline


    Use UPS or FedEx.
    bennie3211, davidclue and byteful like this.

Share This Page