Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Fix items not dropping on death
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablete1234 committed Jun 6, 2016
1 parent 0e0de0c commit 236258c
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ private JsonObject translateJson(JsonObject object, String locale) {
}

private void dropInventory(Player player) {
dropInventory(player, false);
}

private void dropInventory(Player player, boolean force) {
Optional<TeamModule> team = Teams.getTeamByPlayer(player);
if (!team.get().isObserver() && !isDeadUUID(player.getUniqueId()) && GameHandler.getGameHandler().getMatch().isRunning()) {
if (GameHandler.getGameHandler().getMatch().isRunning() && (force || (!team.get().isObserver() && !isDeadUUID(player.getUniqueId())))) {
for (ItemStack stack : player.getInventory().getContents()) {
if (stack != null && stack.getType() != Material.AIR) {
player.getWorld().dropItemNaturally(player.getLocation().add(0, 0.5, 0), stack);
Expand Down Expand Up @@ -359,7 +363,7 @@ private void killPlayer(final Player player, Player killer, EntityDamageEvent.Da
CardinalDeathEvent cardinalDeathEvent = new CardinalDeathEvent(player, killer, cause);
Bukkit.getServer().getPluginManager().callEvent(cardinalDeathEvent);

dropInventory(player);
dropInventory(player, true);

PlayerDeathEvent deathEvent = new PlayerDeathEvent(player, new ArrayList<ItemStack>(), player.getExpToLevel(), 0, 0, 0, null);
deathEvent.setDeathMessage(null);
Expand Down

0 comments on commit 236258c

Please sign in to comment.