mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Fixed: Inventory after respawn is empty
This commit is contained in:
parent
b0c0f372dd
commit
928b0e35af
@ -219,14 +219,7 @@ public class PlayerListener implements Listener{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Respawn Items
|
|
||||||
for(ItemStack istack:dplayer.respawnInventory){
|
|
||||||
if(istack!=null){
|
|
||||||
dplayer.player.getInventory().addItem(istack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dplayer.respawnInventory.clear();
|
|
||||||
DungeonsXL.p.updateInventory(dplayer.player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,10 +295,10 @@ public class PlayerListener implements Listener{
|
|||||||
public void onPlayerDeath(PlayerDeathEvent event){
|
public void onPlayerDeath(PlayerDeathEvent event){
|
||||||
DPlayer dplayer=DPlayer.get(event.getEntity());
|
DPlayer dplayer=DPlayer.get(event.getEntity());
|
||||||
if(dplayer!=null){
|
if(dplayer!=null){
|
||||||
dplayer.respawnInventory.addAll(event.getDrops());
|
|
||||||
|
|
||||||
//Delete all drops
|
//Delete all drops
|
||||||
for(ItemStack istack:event.getDrops()){
|
for(ItemStack istack:event.getDrops()){
|
||||||
|
ItemStack copy = istack.clone();
|
||||||
|
dplayer.respawnInventory.add(copy);
|
||||||
istack.setTypeId(0);
|
istack.setTypeId(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,6 +346,19 @@ public class PlayerListener implements Listener{
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
this.player.teleport(this.location);
|
this.player.teleport(this.location);
|
||||||
|
|
||||||
|
DPlayer dplayer = DPlayer.get(this.player);
|
||||||
|
|
||||||
|
if(dplayer!=null){
|
||||||
|
//Respawn Items
|
||||||
|
for(ItemStack istack:dplayer.respawnInventory){
|
||||||
|
if(istack!=null){
|
||||||
|
this.player.getInventory().addItem(istack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dplayer.respawnInventory.clear();
|
||||||
|
DungeonsXL.p.updateInventory(this.player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user