Fix /dxl edit (0.9.1)

This commit is contained in:
Daniel Saukel 2015-07-15 00:12:10 +02:00
parent 2a6b52c962
commit 2256c13265
2 changed files with 26 additions and 22 deletions

View File

@ -54,6 +54,8 @@ public class DPlayer {
public String[] linesCopy;
public Inventory treasureInv = P.p.getServer().createInventory(player, 45, "Belohnungen");
public int initialLives = -1;
public DPlayer(Player player, World world, Location teleport, boolean isEditing) {
players.add(this);
@ -66,37 +68,39 @@ public class DPlayer {
this.savePlayer = new DSavePlayer(player.getName(), player.getUniqueId(), player.getLocation(), player.getInventory().getContents(), player.getInventory().getArmorContents(), player.getLevel(),
player.getTotalExperience(), (int) health, player.getFoodLevel(), player.getFireTicks(), player.getGameMode(), player.getActivePotionEffects());
if (!(GameWorld.get(world).config.getKeepInventory())) {
this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null);
this.player.setTotalExperience(0);
this.player.setLevel(0);
this.player.setHealth(20);
this.player.setFoodLevel(20);
for (PotionEffect effect : this.player.getActivePotionEffects()) {
this.player.removePotionEffect(effect.getType());
}
}
// Lives
P.lives.put(this.player, GameWorld.get(world).config.getInitialLives());
this.isEditing = isEditing;
if (isEditing)
this.player.setGameMode(GameMode.CREATIVE);
else
if (this.isEditing) {
this.clearPlayerData();
} else {
this.player.setGameMode(GameMode.SURVIVAL);
if (!isEditing) {
if (!(GameWorld.get(world).config.getKeepInventory())) {
this.clearPlayerData();
}
if (GameWorld.get(world).config.isLobbyDisabled()) {
this.ready();
}
initialLives = GameWorld.get(world).config.getInitialLives();
}
// Lives
P.lives.put(this.player, initialLives);
DUtility.secureTeleport(this.player, teleport);
}
public void clearPlayerData() {
this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null);
this.player.setTotalExperience(0);
this.player.setLevel(0);
this.player.setHealth(20);
this.player.setFoodLevel(20);
for (PotionEffect effect : this.player.getActivePotionEffects()) {
this.player.removePotionEffect(effect.getType());
}
}
public void escape() {
remove(this);
this.savePlayer.reset();

View File

@ -1,6 +1,6 @@
name: DungeonsXL
main: com.dre.dungeonsxl.P
version: 0.9
version: 0.9.1
author: Frank Baumann
authors: [Frank Baumann, Milan Albrecht, Tobias Schmitz, Daniel Saukel]
website: http://www.dre2n.ml