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

@ -55,6 +55,8 @@ public class DPlayer {
public Inventory treasureInv = P.p.getServer().createInventory(player, 45, "Belohnungen"); public Inventory treasureInv = P.p.getServer().createInventory(player, 45, "Belohnungen");
public int initialLives = -1;
public DPlayer(Player player, World world, Location teleport, boolean isEditing) { public DPlayer(Player player, World world, Location teleport, boolean isEditing) {
players.add(this); players.add(this);
@ -66,7 +68,28 @@ public class DPlayer {
this.savePlayer = new DSavePlayer(player.getName(), player.getUniqueId(), player.getLocation(), player.getInventory().getContents(), player.getInventory().getArmorContents(), player.getLevel(), 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()); player.getTotalExperience(), (int) health, player.getFoodLevel(), player.getFireTicks(), player.getGameMode(), player.getActivePotionEffects());
this.isEditing = isEditing;
if (this.isEditing) {
this.clearPlayerData();
} else {
this.player.setGameMode(GameMode.SURVIVAL);
if (!(GameWorld.get(world).config.getKeepInventory())) { 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().clear();
this.player.getInventory().setArmorContents(null); this.player.getInventory().setArmorContents(null);
this.player.setTotalExperience(0); this.player.setTotalExperience(0);
@ -78,25 +101,6 @@ public class DPlayer {
} }
} }
// Lives
P.lives.put(this.player, GameWorld.get(world).config.getInitialLives());
this.isEditing = isEditing;
if (isEditing)
this.player.setGameMode(GameMode.CREATIVE);
else
this.player.setGameMode(GameMode.SURVIVAL);
if (!isEditing) {
if (GameWorld.get(world).config.isLobbyDisabled()) {
this.ready();
}
}
DUtility.secureTeleport(this.player, teleport);
}
public void escape() { public void escape() {
remove(this); remove(this);
this.savePlayer.reset(); this.savePlayer.reset();

View File

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