Fixed item-dupe bug after teleport

This commit is contained in:
Frank Baumann 2013-10-28 15:54:21 +01:00
parent 673ec0f122
commit a6b5adf1dc
2 changed files with 4 additions and 2 deletions

View File

@ -64,7 +64,6 @@ public class DPlayer {
this.savePlayer = new DSavePlayer(player.getName(), player.getLocation(), player.getInventory().getContents(), player.getInventory().getArmorContents(), player.getLevel(),
player.getTotalExperience(), (int) player.getHealth(), player.getFoodLevel(), player.getFireTicks(), player.getGameMode(), player.getActivePotionEffects());
this.player.teleport(teleport);
this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null);
this.player.setTotalExperience(0);
@ -100,6 +99,8 @@ public class DPlayer {
}
}
}
this.player.teleport(teleport);
}
public void escape() {

View File

@ -58,7 +58,6 @@ public class DSavePlayer {
Player onlinePlayer = p.getServer().getPlayer(this.playerName);
if (onlinePlayer != null) {
/* Player is online */
onlinePlayer.teleport(this.oldLocation);
onlinePlayer.getInventory().setContents(this.oldInventory);
onlinePlayer.getInventory().setArmorContents(this.oldArmor);
onlinePlayer.setTotalExperience(this.oldExp);
@ -71,6 +70,8 @@ public class DSavePlayer {
onlinePlayer.removePotionEffect(effect.getType());
}
onlinePlayer.addPotionEffects(this.oldPotionEffects);
onlinePlayer.teleport(this.oldLocation);
} else {
/* Player is offline */
Player offlinePlayer = p.getOfflinePlayer(this.playerName, this.oldLocation);