Solved How to send packet to player?

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

Thread Status:
Not open for further replies.
  1. Offline

    Tim_M

    'While looking around on https://wiki.vg/Protocol 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:
    Code:
    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:
    Code:
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(
    new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.(INSERT LETER), 1f));
    
     
    Last edited: Sep 11, 2021
  2. Offline

    Kars

    Use UPS or FedEx.
     
    bennie3211, davidclue and byteful like this.
Thread Status:
Not open for further replies.

Share This Page