diff --git a/Minepacks/resources/config.yml b/Minepacks/resources/config.yml index 84f9cae..a44bf43 100644 --- a/Minepacks/resources/config.yml +++ b/Minepacks/resources/config.yml @@ -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 \ No newline at end of file +Version: 32 \ No newline at end of file diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java index 1961c17..2b69867 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java @@ -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); diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DropOnDeath.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DropOnDeath.java index cfa1caa..78b75e3 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DropOnDeath.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DropOnDeath.java @@ -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)) diff --git a/pom.xml b/pom.xml index 51292b5..bc852e5 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ pom - 2.3.8 + 2.3.9-RC1 UTF-8 UTF-8