mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-01-10 02:07:49 +01:00
Small fixes / improvements concerning lives
This commit is contained in:
parent
c8a9b510d4
commit
0dc20b271b
@ -86,7 +86,7 @@ public class DPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lives
|
// Lives
|
||||||
P.lives.put(this.player, initialLives);
|
p.lives.put(this.player, initialLives);
|
||||||
|
|
||||||
DUtility.secureTeleport(this.player, teleport);
|
DUtility.secureTeleport(this.player, teleport);
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ public class DPlayer {
|
|||||||
remove(this);
|
remove(this);
|
||||||
|
|
||||||
// Lives
|
// Lives
|
||||||
P.lives.remove(player);
|
p.lives.remove(player);
|
||||||
|
|
||||||
this.savePlayer.reset();
|
this.savePlayer.reset();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class P extends JavaPlugin {
|
|||||||
public static P p;
|
public static P p;
|
||||||
|
|
||||||
// Lives
|
// Lives
|
||||||
public static HashMap<Player, Integer> lives;
|
public HashMap<Player, Integer> lives;
|
||||||
|
|
||||||
// Listener
|
// Listener
|
||||||
private static Listener entityListener;
|
private static Listener entityListener;
|
||||||
|
@ -18,8 +18,8 @@ public class CMDLives extends DCommand {
|
|||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
String lives = "";
|
String lives = "";
|
||||||
if (P.lives.containsKey(player)) {
|
if (P.p.lives.containsKey(player)) {
|
||||||
lives = String.valueOf(P.lives.get(player));
|
lives = String.valueOf(P.p.lives.get(player));
|
||||||
p.msg(player, p.language.get("Cmd_Lives").replaceAll("v1", player.getName()).replaceAll("v2", lives));
|
p.msg(player, p.language.get("Cmd_Lives").replaceAll("v1", player.getName()).replaceAll("v2", lives));
|
||||||
} else {
|
} else {
|
||||||
p.msg(player, p.language.get("Error_NotInDungeon"));
|
p.msg(player, p.language.get("Error_NotInDungeon"));
|
||||||
|
@ -22,14 +22,14 @@ public class PlayerDeathListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onDeath(PlayerDeathEvent event) {
|
public void onDeath(PlayerDeathEvent event) {
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
DPlayer dplayer = DPlayer.get(player);
|
DPlayer dPlayer = DPlayer.get(player);
|
||||||
|
|
||||||
DConfig dConfig = GameWorld.get(player.getLocation().getWorld()).config;
|
DConfig dConfig = GameWorld.get(player.getLocation().getWorld()).config;
|
||||||
|
|
||||||
if (dConfig.getKeepInventoryOnDeath()) {
|
if (dConfig.getKeepInventoryOnDeath()) {
|
||||||
if (dplayer != null) {
|
if (dPlayer != null) {
|
||||||
dplayer.respawnInventory = event.getEntity().getInventory().getContents();
|
dPlayer.respawnInventory = event.getEntity().getInventory().getContents();
|
||||||
dplayer.respawnArmor = event.getEntity().getInventory().getArmorContents();
|
dPlayer.respawnArmor = event.getEntity().getInventory().getArmorContents();
|
||||||
// Delete all drops
|
// Delete all drops
|
||||||
for (ItemStack istack : event.getDrops()) {
|
for (ItemStack istack : event.getDrops()) {
|
||||||
istack.setType(Material.AIR);
|
istack.setType(Material.AIR);
|
||||||
@ -37,13 +37,13 @@ public class PlayerDeathListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (P.lives.containsKey(player)) {
|
if (p.lives.containsKey(player)) {
|
||||||
lives = P.lives.get(player) - 1;
|
lives = p.lives.get(player) - 1;
|
||||||
P.lives.put(player, lives);
|
p.lives.put(player, lives);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lives == 0) {
|
if (lives == 0 && dPlayer.isReady) {
|
||||||
Bukkit.broadcastMessage(p.language.get("Player_DeathKick").replaceAll("v1", player.getName()).replaceAll("&", "\u00a76"));
|
Bukkit.broadcastMessage(p.language.get("Player_DeathKick").replaceAll("v1", player.getName()).replaceAll("&", "\u00a7"));
|
||||||
player.performCommand("dxl leave");
|
player.performCommand("dxl leave");
|
||||||
} else if (!(lives == -1)) {
|
} else if (!(lives == -1)) {
|
||||||
p.msg(player, p.language.get("Player_Death").replaceAll("v1", String.valueOf(lives)));
|
p.msg(player, p.language.get("Player_Death").replaceAll("v1", String.valueOf(lives)));
|
||||||
|
Loading…
Reference in New Issue
Block a user