mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-12-01 06:53:26 +01:00
Delete corrupt saveplayer data
This commit is contained in:
parent
998dbe4873
commit
eccf82b733
@ -60,45 +60,52 @@ public class DSavePlayer {
|
|||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
Player onlinePlayer = p.getServer().getPlayer(this.playerName);
|
Player onlinePlayer = p.getServer().getPlayer(this.playerName);
|
||||||
if (onlinePlayer != null) {
|
|
||||||
/* Player is online */
|
try{
|
||||||
onlinePlayer.getInventory().setContents(this.oldInventory);
|
if (onlinePlayer != null) {
|
||||||
onlinePlayer.getInventory().setArmorContents(this.oldArmor);
|
/* Player is online */
|
||||||
onlinePlayer.setTotalExperience(this.oldExp);
|
onlinePlayer.getInventory().setContents(this.oldInventory);
|
||||||
onlinePlayer.setLevel(this.oldLvl);
|
onlinePlayer.getInventory().setArmorContents(this.oldArmor);
|
||||||
onlinePlayer.setHealth(this.oldHealth);
|
onlinePlayer.setTotalExperience(this.oldExp);
|
||||||
onlinePlayer.setFoodLevel(this.oldFoodLevel);
|
onlinePlayer.setLevel(this.oldLvl);
|
||||||
onlinePlayer.setGameMode(this.oldGamemode);
|
onlinePlayer.setHealth(this.oldHealth);
|
||||||
onlinePlayer.setFireTicks(this.oldFireTicks);
|
onlinePlayer.setFoodLevel(this.oldFoodLevel);
|
||||||
for (PotionEffect effect : onlinePlayer.getActivePotionEffects()) {
|
onlinePlayer.setGameMode(this.oldGamemode);
|
||||||
onlinePlayer.removePotionEffect(effect.getType());
|
onlinePlayer.setFireTicks(this.oldFireTicks);
|
||||||
}
|
for (PotionEffect effect : onlinePlayer.getActivePotionEffects()) {
|
||||||
onlinePlayer.addPotionEffects(this.oldPotionEffects);
|
onlinePlayer.removePotionEffect(effect.getType());
|
||||||
|
}
|
||||||
DUtility.secureTeleport(onlinePlayer, this.oldLocation);
|
onlinePlayer.addPotionEffects(this.oldPotionEffects);
|
||||||
} else {
|
|
||||||
/* Player is offline */
|
DUtility.secureTeleport(onlinePlayer, this.oldLocation);
|
||||||
Player offlinePlayer = p.getOfflinePlayer(this.playerName, this.uuid, this.oldLocation);
|
} else {
|
||||||
if (offlinePlayer != null) {
|
/* Player is offline */
|
||||||
offlinePlayer.getInventory().setContents(this.oldInventory);
|
Player offlinePlayer = p.getOfflinePlayer(this.playerName, this.uuid, this.oldLocation);
|
||||||
offlinePlayer.getInventory().setArmorContents(this.oldArmor);
|
if (offlinePlayer != null) {
|
||||||
offlinePlayer.setTotalExperience(this.oldExp);
|
offlinePlayer.getInventory().setContents(this.oldInventory);
|
||||||
offlinePlayer.setLevel(this.oldLvl);
|
offlinePlayer.getInventory().setArmorContents(this.oldArmor);
|
||||||
offlinePlayer.setHealth(this.oldHealth);
|
offlinePlayer.setTotalExperience(this.oldExp);
|
||||||
offlinePlayer.setFoodLevel(this.oldFoodLevel);
|
offlinePlayer.setLevel(this.oldLvl);
|
||||||
offlinePlayer.setGameMode(this.oldGamemode);
|
offlinePlayer.setHealth(this.oldHealth);
|
||||||
offlinePlayer.setFireTicks(this.oldFireTicks);
|
offlinePlayer.setFoodLevel(this.oldFoodLevel);
|
||||||
for (PotionEffect effect : offlinePlayer.getActivePotionEffects()) {
|
offlinePlayer.setGameMode(this.oldGamemode);
|
||||||
offlinePlayer.removePotionEffect(effect.getType());
|
offlinePlayer.setFireTicks(this.oldFireTicks);
|
||||||
|
for (PotionEffect effect : offlinePlayer.getActivePotionEffects()) {
|
||||||
|
offlinePlayer.removePotionEffect(effect.getType());
|
||||||
|
}
|
||||||
|
//causes NP
|
||||||
|
//offlinePlayer.addPotionEffects(this.oldPotionEffects);
|
||||||
|
|
||||||
|
offlinePlayer.saveData();
|
||||||
}
|
}
|
||||||
//causes NP
|
|
||||||
//offlinePlayer.addPotionEffects(this.oldPotionEffects);
|
|
||||||
|
|
||||||
offlinePlayer.saveData();
|
|
||||||
}
|
}
|
||||||
|
} catch (NullPointerException exception) {
|
||||||
|
P.p.log("Corrupt playerdata detected and removed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
savePlayers.remove(this);
|
savePlayers.remove(this);
|
||||||
save();
|
save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
|
Loading…
Reference in New Issue
Block a user