[unsolved] How to make the client think they have a walking speed of 0?

Discussion in 'Spigot Plugin Development' started by retrodaredevil, Jun 5, 2016.

  1. I am making a few games where I am setting the velocity of players. However, any of the players can press w to get a little bit more speed or s to lose speed. I would like to stop this. I tried setting their walking speed to 0 but when I set their velocity I get a "player moved to quickly" in the console. Right now I am trying to do this with packet listener api and would like to know what packet and field to use to get them to think they have a walking speed of 0. If anyone has any better ideas than editing the packet, I'd like to hear it too.
  2. Try the Entity Properties packet. There's a movement speed value you can set in this packet.
  3. There's also a serverbound Player Abilities packet that contains a walking speed. Not exactly sure what the behavior for this packet will be when you set the walking speed. It's serverbound, so it might not be what you're looking for.
  4. Maybe you could just give them the slowness effect with a huge amplifier?
  5. I would do that, but I don't want their FOV to zoom in.

    Also, what is the name of the packet for EntityProperties?
    #7 retrodaredevil, Jun 5, 2016
    Last edited: Jun 5, 2016
  6. Does anyone know where I can set the speed of the player to 0 and make the server think that their walk speed is higher than that? Is there like a variable stored somewhere that changes when you do setWalkSpeed but can be changed and won't affect the player? I looked around in CraftPlayer.java and EntityPlayer.java (googled them) and couldn't seem to find anything. Even tried something like this:
    Code (Text):

        public void setClientWalkSpeed(float speed){
            float s = player.getWalkSpeed();
            EntityPlayer p = ((CraftPlayer)player).getHandle();
            p.abilities.walkSpeed = speed / 2f;
            p.abilities.walkSpeed = s / 2F;
  7. You could alternatively give the player slowness level 127. They wont be able to move

    And jump boost 127 will restrict their jumping
  8. It still makes you zoom in a lot.
    I even ran this code every tick:
    Code (Text):

                PlayerAbilities pa = new PlayerAbilities();
                pa.canFly = false;;
                pa.canInstantlyBuild = false;
                pa.flySpeed = 0;
                pa.isFlying = false;
                pa.isInvulnerable = false;
                pa.mayBuild = false;
                pa.walkSpeed = 0;
                yp.sendPacket(new PacketPlayOutAbilities(pa));
    EDIT: Well now giving them a slowness affect of 127 does't seem to affect their fov. Gonna use that for now but if anyone knows a way to do this without that (If the no fov thing gets fixed or something) please tell or pm meh.
    #11 retrodaredevil, Jun 5, 2016
    Last edited: Jun 7, 2016
  9. It would be more resource friendly to check if the player changes mode rather than sending a packet every tick