How to stop people from sprint jumping?



  • As part of a datapack-powered PvP map we want to apply slowness to players. Sadly we have run into the issue where slowness does not affect sprint-jumping speed, meaning even players with slowness 100 do not have a difficult time catching up with people running at normal speed.

    We have tried some very drastic measures:

    • Applying the slowness potion effect
    • Changing the player's movement speed attribute
    • Giving players jump boost 200 to disable their jump ability

    Sadly none of these solutions got rid of the speed boost players get from sprint-jumping. We considered disabling their sprint, but Java edition lacking a /hunger command we found this impossible.

    Is there a way to stop players from sprint-jumping, or otherwise make them actually slower?



  • I have figured out a way to counterbalance the effect of jumping but will involve predicates which could only be done with datapacks. Edit: Just saw you are already using datapacks, nevermind

    First create a scoreboard /scoreboard objectives add Jump custom:jump

    Now create a predicate JSON called "is_sprinting" with the following code:

    {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "type": "minecraft:player",
          "flags": {
            "is_sprinting": true
          }
        }
      }
    

    This predicate would output a true if the player is sprinting.

    So collectively, you can use execute as @a[predicate=namespace:is_sprinting,scores={Jump=1}] at @s run tp @s ~ ~-0.65~ So that those who are jump sprinting would be teleported to the ground, shutting them from jumping. (They can still jump, but as if the gravity is tripled, and their jump sprinting is slower than just sprinting.)

    However, "Jump" would increase by 1 every time you jump, therefore in your tick.mcfunction you must reset it at the end. execute as @a[scores={Jump=1..}] run scoreboard players reset @s Jump

    0.65 is the optimum value for teleportation, and 0.7 would tp them underground which is not what you want.

    I tried it out myself and it works, hoepfully it works for you as well.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2