refactor(disguise): update player after disguise
This commit is contained in:
parent
3ec2e7a584
commit
15b02ff390
1 changed files with 3 additions and 3 deletions
|
@ -99,6 +99,7 @@ public class AppearanceManager {
|
||||||
|
|
||||||
final WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(player).withName(displayName);
|
final WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(player).withName(displayName);
|
||||||
final ActionResult<Void> result = updateGameProfileSkin(gameProfile, skinChange);
|
final ActionResult<Void> result = updateGameProfileSkin(gameProfile, skinChange);
|
||||||
|
final boolean wasFlying = player.isFlying();
|
||||||
if (!result.isError()) {
|
if (!result.isError()) {
|
||||||
updateMetadata();
|
updateMetadata();
|
||||||
updateTabList(gameProfile, displayName);
|
updateTabList(gameProfile, displayName);
|
||||||
|
@ -106,6 +107,8 @@ public class AppearanceManager {
|
||||||
updateOthers();
|
updateOthers();
|
||||||
}
|
}
|
||||||
player.teleport(player.getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
player.teleport(player.getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||||
|
player.setFlying(wasFlying);
|
||||||
|
player.updateInventory();
|
||||||
return new ActionResult<>();
|
return new ActionResult<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +160,6 @@ 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());
|
||||||
|
@ -166,8 +168,6 @@ 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.updateInventory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
Loading…
Reference in a new issue