Small fixes / improvements concerning lives

This commit is contained in:
Daniel Saukel 2015-08-12 20:16:08 +02:00
parent c8a9b510d4
commit 0dc20b271b
4 changed files with 14 additions and 14 deletions

View File

@ -86,7 +86,7 @@ public class DPlayer {
}
// Lives
P.lives.put(this.player, initialLives);
p.lives.put(this.player, initialLives);
DUtility.secureTeleport(this.player, teleport);
}
@ -112,7 +112,7 @@ public class DPlayer {
remove(this);
// Lives
P.lives.remove(player);
p.lives.remove(player);
this.savePlayer.reset();

View File

@ -43,7 +43,7 @@ public class P extends JavaPlugin {
public static P p;
// Lives
public static HashMap<Player, Integer> lives;
public HashMap<Player, Integer> lives;
// Listener
private static Listener entityListener;

View File

@ -18,8 +18,8 @@ public class CMDLives extends DCommand {
public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender;
String lives = "";
if (P.lives.containsKey(player)) {
lives = String.valueOf(P.lives.get(player));
if (P.p.lives.containsKey(player)) {
lives = String.valueOf(P.p.lives.get(player));
p.msg(player, p.language.get("Cmd_Lives").replaceAll("v1", player.getName()).replaceAll("v2", lives));
} else {
p.msg(player, p.language.get("Error_NotInDungeon"));

View File

@ -22,14 +22,14 @@ public class PlayerDeathListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
DPlayer dplayer = DPlayer.get(player);
DPlayer dPlayer = DPlayer.get(player);
DConfig dConfig = GameWorld.get(player.getLocation().getWorld()).config;
if (dConfig.getKeepInventoryOnDeath()) {
if (dplayer != null) {
dplayer.respawnInventory = event.getEntity().getInventory().getContents();
dplayer.respawnArmor = event.getEntity().getInventory().getArmorContents();
if (dPlayer != null) {
dPlayer.respawnInventory = event.getEntity().getInventory().getContents();
dPlayer.respawnArmor = event.getEntity().getInventory().getArmorContents();
// Delete all drops
for (ItemStack istack : event.getDrops()) {
istack.setType(Material.AIR);
@ -37,13 +37,13 @@ public class PlayerDeathListener implements Listener {
}
}
if (P.lives.containsKey(player)) {
lives = P.lives.get(player) - 1;
P.lives.put(player, lives);
if (p.lives.containsKey(player)) {
lives = p.lives.get(player) - 1;
p.lives.put(player, lives);
}
if (lives == 0) {
Bukkit.broadcastMessage(p.language.get("Player_DeathKick").replaceAll("v1", player.getName()).replaceAll("&", "\u00a76"));
if (lives == 0 && dPlayer.isReady) {
Bukkit.broadcastMessage(p.language.get("Player_DeathKick").replaceAll("v1", player.getName()).replaceAll("&", "\u00a7"));
player.performCommand("dxl leave");
} else if (!(lives == -1)) {
p.msg(player, p.language.get("Player_Death").replaceAll("v1", String.valueOf(lives)));