Closed ghost closed 11 years ago
If I recall correctly, the client handles the flying which requires the creative mode to be set otherwise the player is mortal and cannot fly. I may be wrong, as they may have changed it recently, but to my knowledge, this will be a no.
@shadow386 I thought the same thing, but have you seen http://wiki.vg/Protocol#Player_Abilities_.280xCA.29?
I have, and that's only an onGround packet and is not controlled by the server to allow a player flight. It will allow the server to tell the client that the onGround is false, which the client cannot do anything as it still needs the controls set which would have to be modified via a client mod. If you wish to have this setting for your server/plugins, change the setting for onGround to false.
I thought I added this already... Anyway, yes, all fields from that packet can be set independently. They're in the OPlayerCapabilites class.
But a b****t server can do that so we should be able to add this too or ?
@14mRh4X0r if you mean player.setFlying(boolean b) dont work
I was right, I did add the methods. But because I misunderstood their functions, I named them something that isn't quite right. I will be adding clones with proper names, but for now, use player.setFallingDisabled(bool)
K thx
Dont work. I mean that the player can fly like creative but he is in survival
Ah, then you'll have to send the packet as well:
player.setFallingDisabled(true);
player.getEntity().a.b(new OPacket202PlayerAbilities(player.getEntity().cd));
Works thx :+1:
The new names are canFly()
and setCanFly(boolean)
.
Thx but the server kicks the player if allow-flight=false can you pls fix that ?
No. That's a feature, not a bug. I will probably make kicks cancel-able though, so that can be caught.
Cant you check if the player isAllowed to flight ?
I could, perhaps. That's not a bad idea, even :wink: Marked as minecraft bug because it kicks players while they're allowed to fly.
Thx works fine but could you add the code to update the flymode: p.getEntity().a.b(new OPacket202PlayerAbilities(p.getEntity().cd)); in the method´s ?
If you had taken a closer look, you would've seen there already is: Player.updateCapabilities()
Hmm But why Player.setCanFly(boolean b) dont update it automatically ?
So that i can set that a player can fly without creative mode.