ProtocolLib

3M Downloads

What packages are needed for move actions?

rejomy opened this issue ยท 6 comments

commented

I write a plugin that checks the jump height, the plugin writes the last "player.isOnGround" and checks against the jump height, if player.location.y - oldGroundLoc.y > 1.3 { action }
And the problem is that this action is often triggered, even though it shouldn't be. If I use PlayerMoveEvent to write oldGroundLoc everything works correctly, but with protocollib (PacketType.Play.Client.FLYING,
PacketType.Play.Client.LOOK,
PacketType.Play Client.POSITION,
PacketType.Play.Client.GROUND,) for some reason it doesn't record some jumps, as if it lacks some other packet to move, which would show that I jump. I.e., if I jump sharply a block higher and jump again = action. But if I jump, run a little bit (to trigger POSITION) and jump, it's ok.

commented

By the way, what does a GROUND packet do? When moving, jumping, it does not work (I left only it and tried to display a message in the chat), nothing is displayed. I was running, jumping, breaking blocks, hitting mobs, flying.

commented

You also need to handle PacketType.Play.Client.PacketType.Play.Client.POSITION_LOOK. It is sent when the client both rotates and moves in the same tick.
The packet handler is triggered more often (should be every tick) as the client sends any position packet regardless whether the player moved or not.

I recommend that you have a look at: https://wiki.vg/Protocol

commented

You also need to handle PacketType.Play.Client.PacketType.Play.Client.POSITION_LOOK. It is sent when the client both rotates and moves in the same tick. The packet handler is triggered more often (should be every tick) as the client sends any position packet regardless whether the player moved or not.

I recommend that you have a look at: https://wiki.vg/Protocol

I check the jump height, but those packets above, not enough for this treatment. GROUND package does nothing at all, it has never been brought out during the game, the rest although it records the location, but not always. That is the trick is that I jump on the block above, from this block still 1 jump, and if I'm on the block above, did not do a couple of movements, well, run, the package is not sent, or something else. If there are no other packets on the movements, what packets include playermoveevent, it sees the movements that I do and records ground position, but that list of packets above - no.

commented

You can read what the Ground packet does here: https://wiki.vg/Protocol#Set_Player_On_Ground

ProtocolLib only provides access to the Packets the Minecraft Client sends. These packets are all the packets used by the client to update its position on the server:

  • PacketType.Play.Client.LOOK,
  • PacketType.Play Client.POSITION,
  • PacketType.Play.Client.GROUND
  • PacketType.Play.Client.POSITION_LOOK

If this does not cover all movements, the only thing I can imagine is that the server interpolates movements from the client and calls movement events for this as well. You probably want to have a look at the source code of Spigot to get an insight into this.

I read about the GROUND package, and if I understand correctly, PacketType.Play.Client.GROUND should be called when I run on the ground? If so, then I don't have it called at all.

commented

You can read what the Ground packet does here: https://wiki.vg/Protocol#Set_Player_On_Ground

ProtocolLib only provides access to the Packets the Minecraft Client sends. These packets are all the packets used by the client to update its position on the server:

  • PacketType.Play.Client.LOOK,
  • PacketType.Play Client.POSITION,
  • PacketType.Play.Client.GROUND
  • PacketType.Play.Client.POSITION_LOOK

If this does not cover all movements, the only thing I can imagine is that the server interpolates movements from the client and calls movement events for this as well. You probably want to have a look at the source code of Spigot to get an insight into this.

commented

No, ground is only sent to update whether the client is on ground or not. Nothing else is included.