Ok, before you start telling me that this is impossible lemme tell you what I've tried: I've tried setting a custom Player Class on PlayerCreationEvent with a CustomPlayer::setGravity() method to be able access the protected Living class' gravity instance variable (instead of reflection, which also doesn't work) It worked ONE LUCKY TIME (not the first time) where I'm stuck mid air and doesn't fall down but I can still fly up. but, all the other time doesn't work and does nothing. I dumped the gravity property's value and it is the correct value I set it as (0.01) I also tried making a separate entity to test it there and it seems to work for the entity... but not for the player. And ideas why? What's my goal and why I'm changing the gravity you might ask, I'm trying to slow down player fall... instead of doing it the hacky and janky way of using a custom entity that has its gravity set to 0.01 that also falls down then teleporting the player on every update, I want to use the built-in player's physics because that'd be a lot smoother and the player would be able to move unlike when teleporting every update.
Player movement is entirely client-dependent. Those gravity values are only used for server-sided movement of mobs, which is disabled for players.
You could consider instead using negative levitation for a slow fall, but I think PM doesn't like negative effects so much when serialized to NBT.
If you don't care too much about anticheat you should be fine just doing PHP: $effect = new Effect(25, "%potion.levitation", 0, 0, 0 /* whatever colour you desire*/)->setDuration(100)->setAmplifier(-1 /*some negative number*/);$effect->add($player);
That actually worked... It should be fine though since I'm only going to use it for like 20-30 seconds... then remove it afterwards (Effect ID 25 is poison lol xD idk if you used that on purpose or as an example lmao)
It's entirely dependent on the player movement, so to other players it'll look fine, as long as you don't have any anti-cheat interfering.