fix: flying after respawn
This commit is contained in:
parent
a254d3ed9b
commit
48257e2028
1 changed files with 4 additions and 5 deletions
|
@ -95,18 +95,13 @@ public class AppearanceManager {
|
||||||
|
|
||||||
public ActionResult updatePlayer(boolean skinChange, boolean reset) {
|
public ActionResult updatePlayer(boolean skinChange, boolean reset) {
|
||||||
final String displayName = profile.getName() == null ? player.getName() : profile.getName();
|
final String displayName = profile.getName() == null ? player.getName() : profile.getName();
|
||||||
|
|
||||||
final WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(player).withName(displayName);
|
final WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(player).withName(displayName);
|
||||||
final ActionResult result = updateGameProfileSkin(gameProfile, skinChange, reset);
|
final ActionResult result = updateGameProfileSkin(gameProfile, skinChange, reset);
|
||||||
final boolean wasFlying = player.isFlying();
|
|
||||||
if (!result.isError()) {
|
if (!result.isError()) {
|
||||||
updateMetadata();
|
updateMetadata();
|
||||||
updateTabList(gameProfile, displayName);
|
updateTabList(gameProfile, displayName);
|
||||||
respawnPlayer();
|
respawnPlayer();
|
||||||
updateOthers();
|
updateOthers();
|
||||||
player.teleport(player.getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
|
||||||
player.setFlying(wasFlying);
|
|
||||||
player.updateInventory();
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -163,6 +158,7 @@ public class AppearanceManager {
|
||||||
|
|
||||||
private void respawnPlayer() {
|
private void respawnPlayer() {
|
||||||
final World world = player.getWorld();
|
final World world = player.getWorld();
|
||||||
|
final boolean wasFlying = player.isFlying();
|
||||||
final WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn();
|
final WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn();
|
||||||
respawn.setDimension(world);
|
respawn.setDimension(world);
|
||||||
respawn.setSeed(world.getSeed());
|
respawn.setSeed(world.getSeed());
|
||||||
|
@ -171,6 +167,9 @@ public class AppearanceManager {
|
||||||
respawn.setDifficulty(world.getDifficulty());
|
respawn.setDifficulty(world.getDifficulty());
|
||||||
respawn.setCopyMetadata(true);
|
respawn.setCopyMetadata(true);
|
||||||
respawn.sendPacket(player);
|
respawn.sendPacket(player);
|
||||||
|
player.setFlying(wasFlying);
|
||||||
|
player.teleport(player.getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||||
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
Loading…
Reference in a new issue