Remove drop on death
This commit is contained in:
@@ -3,7 +3,6 @@ package com.drtshock.playervaults.listeners;
|
||||
import com.drtshock.playervaults.PlayerVaults;
|
||||
import com.drtshock.playervaults.vaultmanagement.VaultOperations;
|
||||
import com.drtshock.playervaults.vaultmanagement.VaultViewInfo;
|
||||
import com.drtshock.playervaults.util.DropOnDeath;
|
||||
import com.drtshock.playervaults.util.Lang;
|
||||
import com.drtshock.playervaults.vaultmanagement.VaultManager;
|
||||
|
||||
@@ -85,9 +84,6 @@ public class Listeners implements Listener {
|
||||
public void onDeath(PlayerDeathEvent event) {
|
||||
Player player = event.getEntity();
|
||||
saveVault(player);
|
||||
if (PlayerVaults.DROP_ON_DEATH && (!player.hasPermission("playervaults.ignore.drops"))) {
|
||||
DropOnDeath.drop(event.getEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.drtshock.playervaults.util;
|
||||
|
||||
import com.drtshock.playervaults.PlayerVaults;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* A class that contains a method to drop the contents of a player's vault when
|
||||
* they die.
|
||||
*/
|
||||
public class DropOnDeath {
|
||||
|
||||
/**
|
||||
* Drops all items when a player dies.
|
||||
*
|
||||
* @param player The player to drop the inventory of.
|
||||
*/
|
||||
public static void drop(Player player) {
|
||||
Location loc = player.getLocation();
|
||||
for (int count = 1; count <= PlayerVaults.INVENTORIES_TO_DROP; count++) {
|
||||
Inventory inv = PlayerVaults.VM.getVault(player.getName(), count);
|
||||
ItemStack[] stack = inv.getContents();
|
||||
for (ItemStack is : stack) {
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user