You can prevent this by setting the DATA_NO_AI flag on entities you don't want to be pushable (is that the right word?) Code: $entity->setDataProperty(Entity::DATA_NO_AI, Entity::DATA_TYPE_BYTE, true); Then to allow movement again, just set the flag to false. (Fun fact: if you set that flag on a player it will disable the controls and stop the player moving. )
This method is mod-vulnerable. You probably need to use this as a client-side method, in addition to handling PlayerMoveEvent. You just can't trust everything the client says, or have fun with mods. And we trust everything the client says about movement, so we have players flying everywhere.