Skip to content

Commit e45a044

Browse files
committed
Reset a player's ender chest when appropriate
1 parent 361a421 commit e45a044

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main/java/org/mctourney/autoreferee/util/PlayerUtil.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import org.bukkit.GameMode;
66
import org.bukkit.entity.Player;
7+
import org.bukkit.inventory.Inventory;
78
import org.bukkit.inventory.PlayerInventory;
89
import org.bukkit.potion.PotionEffect;
910
import org.bukkit.potion.PotionEffectType;
@@ -78,6 +79,16 @@ public static void removeStatusEffects(Player player)
7879
for (PotionEffect effect : player.getActivePotionEffects())
7980
player.removePotionEffect(effect.getType());
8081
}
82+
83+
/**
84+
* Clears player's ender chest
85+
*/
86+
public static void clearEnderChest(Player player)
87+
{
88+
// clear the ender chest
89+
Inventory enderChest = player.getEnderChest();
90+
enderChest.clear();
91+
}
8192

8293
/**
8394
* Performs all PlayerUtil actions on this player.
@@ -95,6 +106,9 @@ public static void reset(Player player)
95106

96107
// remove potion and beacon effects
97108
removeStatusEffects(player);
109+
110+
// clear their ender chest
111+
clearEnderChest(player);
98112
}
99113

100114
private static class BufferedGameModeChangeTask extends BukkitRunnable

0 commit comments

Comments
 (0)