Skip to content

Commit

Permalink
fix: respects keepInventory gameRule on quit
Browse files Browse the repository at this point in the history
  • Loading branch information
RoinujNosde committed Sep 3, 2022
1 parent 3934d86 commit 2e303e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/me/roinujnosde/titansbattle/BaseGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,16 @@ protected void processInventoryOnExit(@NotNull Warrior warrior) {
plugin.debug("processInventoryOnExit() -> null player");
return;
}
if (shouldKeepInventoryOnDeath(warrior)) {
World world = player.getWorld();
if (shouldKeepInventoryOnDeath(warrior) || Boolean.parseBoolean(world.getGameRuleValue("keepInventory"))) {
return;
}
if (shouldClearDropsOnDeath(warrior)) {
return;
}
for (ItemStack item : player.getInventory().getContents()) {
if (item == null) continue;
player.getWorld().dropItemNaturally(player.getLocation(), item.clone());
world.dropItemNaturally(player.getLocation(), item.clone());
}
Kit.clearInventory(player);
}
Expand Down

0 comments on commit 2e303e3

Please sign in to comment.