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.PlayerVaults;
|
||||||
import com.drtshock.playervaults.vaultmanagement.VaultOperations;
|
import com.drtshock.playervaults.vaultmanagement.VaultOperations;
|
||||||
import com.drtshock.playervaults.vaultmanagement.VaultViewInfo;
|
import com.drtshock.playervaults.vaultmanagement.VaultViewInfo;
|
||||||
import com.drtshock.playervaults.util.DropOnDeath;
|
|
||||||
import com.drtshock.playervaults.util.Lang;
|
import com.drtshock.playervaults.util.Lang;
|
||||||
import com.drtshock.playervaults.vaultmanagement.VaultManager;
|
import com.drtshock.playervaults.vaultmanagement.VaultManager;
|
||||||
|
|
||||||
@@ -85,9 +84,6 @@ public class Listeners implements Listener {
|
|||||||
public void onDeath(PlayerDeathEvent event) {
|
public void onDeath(PlayerDeathEvent event) {
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
saveVault(player);
|
saveVault(player);
|
||||||
if (PlayerVaults.DROP_ON_DEATH && (!player.hasPermission("playervaults.ignore.drops"))) {
|
|
||||||
DropOnDeath.drop(event.getEntity());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,14 +16,4 @@ economy:
|
|||||||
# Cost to create a vault. You can give players playervaults.free to bypass this.
|
# Cost to create a vault. You can give players playervaults.free to bypass this.
|
||||||
cost-to-create: 100
|
cost-to-create: 100
|
||||||
cost-to-open: 10
|
cost-to-open: 10
|
||||||
refund-on-delete: 50
|
refund-on-delete: 50
|
||||||
|
|
||||||
# Configuration for dropping inventories on death.
|
|
||||||
# Bypass with playervaults.ignore.drop
|
|
||||||
drop-on-death:
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
# Max amount of inventories you want to be dropped.
|
|
||||||
# Set to 99 (or highest amount you give people) if you want all inventories to be dropped.
|
|
||||||
# WARNING: This can cause a lot of items to be dropped on the ground. Use caution :3
|
|
||||||
inventories: 1
|
|
||||||
Reference in New Issue
Block a user