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 String[] linesCopy;
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,37 +68,39 @@ 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());
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; this.isEditing = isEditing;
if (isEditing) if (this.isEditing) {
this.player.setGameMode(GameMode.CREATIVE); this.clearPlayerData();
else } else {
this.player.setGameMode(GameMode.SURVIVAL); this.player.setGameMode(GameMode.SURVIVAL);
if (!(GameWorld.get(world).config.getKeepInventory())) {
if (!isEditing) { this.clearPlayerData();
}
if (GameWorld.get(world).config.isLobbyDisabled()) { if (GameWorld.get(world).config.isLobbyDisabled()) {
this.ready(); this.ready();
} }
initialLives = GameWorld.get(world).config.getInitialLives();
} }
// Lives
P.lives.put(this.player, initialLives);
DUtility.secureTeleport(this.player, teleport); 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() { 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