mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-02-23 02:52:38 +01:00
Add new config option (HonorKeepInventoryOnDeath)
This commit is contained in:
parent
daa98edb6d
commit
34b1aa9cb2
@ -17,6 +17,9 @@ BackpackTitle: "&bBackpack"
|
||||
# Defines if the content of the backpack get dropped on the death of a player.
|
||||
# If enabled, it can be disabled for individual players with the "backpack.keepOnDeath" permission.
|
||||
DropOnDeath: true
|
||||
# If this option is enabled the backpack will not drop if the keepInventory flag for the death event is set.
|
||||
# This should add compatibility with plugins protecting the players inventory on death (like SaveRod). But might prevent the backpack form dropping on death with some plugins.
|
||||
HonorKeepInventoryOnDeath: false
|
||||
# Defines the max amount of columns for a backpack.
|
||||
# The size of the user's backpack will be defined by the permission, permissions for bigger backpacks than this value will be ignored.
|
||||
# Can be set to anything > 0. Backpacks with more than 6 columns will have a broken UI! Sizes bigger than 9 may not work with all permission plugins.
|
||||
@ -212,4 +215,4 @@ Misc:
|
||||
UseBungeeCord: false
|
||||
|
||||
# Config file version. Don't touch it!
|
||||
Version: 31
|
||||
Version: 32
|
@ -36,7 +36,7 @@
|
||||
|
||||
public class Config extends Configuration implements DatabaseConnectionConfiguration
|
||||
{
|
||||
private static final int CONFIG_VERSION = 31, UPGRADE_THRESHOLD = CONFIG_VERSION, PRE_V2_VERSION = 20;
|
||||
private static final int CONFIG_VERSION = 32, UPGRADE_THRESHOLD = CONFIG_VERSION, PRE_V2_VERSION = 20;
|
||||
|
||||
public Config(JavaPlugin plugin)
|
||||
{
|
||||
@ -165,6 +165,11 @@ public boolean getDropOnDeath()
|
||||
return getConfigE().getBoolean("DropOnDeath", true);
|
||||
}
|
||||
|
||||
public boolean getHonorKeepInventoryOnDeath()
|
||||
{
|
||||
return getConfigE().getBoolean("HonorKeepInventoryOnDeath", false);
|
||||
}
|
||||
|
||||
public int getBackpackMaxSize()
|
||||
{
|
||||
int size = getConfigE().getInt("MaxSize", 6);
|
||||
|
@ -26,18 +26,23 @@
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
public class DropOnDeath extends MinepacksListener
|
||||
{
|
||||
private final boolean honorKeepOnDeath;
|
||||
|
||||
public DropOnDeath(Minepacks plugin)
|
||||
{
|
||||
super(plugin);
|
||||
honorKeepOnDeath = plugin.getConfiguration().getHonorKeepInventoryOnDeath();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if(honorKeepOnDeath && event.getKeepInventory()) return;
|
||||
final Player player = event.getEntity();
|
||||
if(plugin.isDisabled(player) != WorldBlacklistMode.None) return;
|
||||
if (!player.hasPermission(Permissions.KEEP_ON_DEATH))
|
||||
|
Loading…
Reference in New Issue
Block a user