mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-02-15 03:41:28 +01:00
Equip Armor after Respawn
This commit is contained in:
parent
b7bcacf32b
commit
0c39816f2b
@ -45,7 +45,8 @@ public class DPlayer {
|
||||
public Wolf wolf;
|
||||
public int wolfRespawnTime = 30;
|
||||
public long offlineTime;
|
||||
public CopyOnWriteArrayList<ItemStack> respawnInventory = new CopyOnWriteArrayList<ItemStack>();
|
||||
public ItemStack[] respawnInventory;
|
||||
public ItemStack[] respawnArmor;
|
||||
|
||||
public Inventory treasureInv = P.p.getServer().createInventory(player, 45, "Belohnungen");
|
||||
|
||||
@ -208,12 +209,12 @@ public class DPlayer {
|
||||
}
|
||||
|
||||
// Respawn Items
|
||||
for (ItemStack istack : this.respawnInventory) {
|
||||
if (istack != null) {
|
||||
this.player.getInventory().addItem(istack);
|
||||
}
|
||||
if (this.respawnInventory != null || this.respawnArmor != null) {
|
||||
this.player.getInventory().setContents(this.respawnInventory);
|
||||
this.player.getInventory().setArmorContents(this.respawnArmor);
|
||||
this.respawnInventory = null;
|
||||
this.respawnArmor = null;
|
||||
}
|
||||
this.respawnInventory.clear();
|
||||
// P.p.updateInventory(this.player);
|
||||
}
|
||||
|
||||
@ -403,12 +404,12 @@ public class DPlayer {
|
||||
}
|
||||
|
||||
// Respawn Items
|
||||
for (ItemStack istack : dplayer.respawnInventory) {
|
||||
if (istack != null) {
|
||||
dplayer.player.getInventory().addItem(istack);
|
||||
}
|
||||
if (dplayer.respawnInventory != null || dplayer.respawnArmor != null) {
|
||||
dplayer.player.getInventory().setContents(dplayer.respawnInventory);
|
||||
dplayer.player.getInventory().setArmorContents(dplayer.respawnArmor);
|
||||
dplayer.respawnInventory = null;
|
||||
dplayer.respawnArmor = null;
|
||||
}
|
||||
dplayer.respawnInventory.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -355,10 +355,10 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerDeath(PlayerDeathEvent event) {
|
||||
DPlayer dplayer = DPlayer.get(event.getEntity());
|
||||
if (dplayer != null) {
|
||||
dplayer.respawnInventory = event.getEntity().getInventory().getContents();
|
||||
dplayer.respawnArmor = event.getEntity().getInventory().getArmorContents();
|
||||
// Delete all drops
|
||||
for (ItemStack istack : event.getDrops()) {
|
||||
ItemStack copy = istack.clone();
|
||||
dplayer.respawnInventory.add(copy);
|
||||
istack.setTypeId(0);
|
||||
}
|
||||
}
|
||||
@ -446,12 +446,12 @@ public class PlayerListener implements Listener {
|
||||
|
||||
if (dplayer != null) {
|
||||
// Respawn Items
|
||||
for (ItemStack istack : dplayer.respawnInventory) {
|
||||
if (istack != null) {
|
||||
this.player.getInventory().addItem(istack);
|
||||
}
|
||||
if (dplayer.respawnInventory != null || dplayer.respawnArmor != null) {
|
||||
this.player.getInventory().setContents(dplayer.respawnInventory);
|
||||
this.player.getInventory().setArmorContents(dplayer.respawnArmor);
|
||||
dplayer.respawnInventory = null;
|
||||
dplayer.respawnArmor = null;
|
||||
}
|
||||
dplayer.respawnInventory.clear();
|
||||
// DungeonsXL.p.updateInventory(this.player);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user