From 5f91b62d47c3f542ae938f0f3cd84dddcffbee7e Mon Sep 17 00:00:00 2001 From: BenceX100 Date: Wed, 20 Nov 2024 15:28:17 +0100 Subject: [PATCH] 1.16.0 --- pom.xml | 4 ++-- .../axgraves/listeners/DeathListener.java | 14 ++++++++++---- src/main/resources/config.yml | 6 +++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 43953dd..e273797 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.artillexstudios AxGraves - 1.15.1 + 1.16.0 jar AxGraves @@ -106,7 +106,7 @@ com.artillexstudios.axapi axapi - 1.4.397 + 1.4.403 compile all diff --git a/src/main/java/com/artillexstudios/axgraves/listeners/DeathListener.java b/src/main/java/com/artillexstudios/axgraves/listeners/DeathListener.java index d3cd31b..ab9510d 100644 --- a/src/main/java/com/artillexstudios/axgraves/listeners/DeathListener.java +++ b/src/main/java/com/artillexstudios/axgraves/listeners/DeathListener.java @@ -30,13 +30,18 @@ public void onDeath(@NotNull PlayerDeathEvent event) { Grave grave = null; - final int xp = Math.round(ExperienceUtils.getExp(player) * CONFIG.getFloat("xp-keep-percentage", 1f)); + int xp = 0; + if (CONFIG.getBoolean("store-xp", true)) + xp = Math.round(ExperienceUtils.getExp(player) * CONFIG.getFloat("xp-keep-percentage", 1f)); + if (!event.getKeepInventory()) { grave = new Grave(player.getLocation(), player, event.getDrops().toArray(new ItemStack[0]), xp, System.currentTimeMillis()); } else if (CONFIG.getBoolean("override-keep-inventory", true)) { grave = new Grave(player.getLocation(), player, player.getInventory().getContents(), xp, System.currentTimeMillis()); - player.setLevel(0); - player.setTotalExperience(0); + if (CONFIG.getBoolean("store-xp", true)) { + player.setLevel(0); + player.setTotalExperience(0); + } player.getInventory().clear(); } @@ -46,7 +51,8 @@ public void onDeath(@NotNull PlayerDeathEvent event) { Bukkit.getPluginManager().callEvent(gravePreSpawnEvent); if (gravePreSpawnEvent.isCancelled()) return; - event.setDroppedExp(0); + if (CONFIG.getBoolean("store-xp", true)) + event.setDroppedExp(0); event.getDrops().clear(); SpawnedGraves.addGrave(grave); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 323436a..37245c8 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -54,6 +54,10 @@ interact-only-own: false # this is a percentage, so 0.5 would be 50% xp xp-keep-percentage: 1.0 +# should the plugin store XP in graves? +# if disabled, XP will be dropped on the ground +store-xp: true + # what order should items be put in the grave? # all the other items will be put AFTER these # values: ARMOR, HAND, OFFHAND @@ -113,4 +117,4 @@ update-notifier: on-join: true # do not edit -version: 12 \ No newline at end of file +version: 13 \ No newline at end of file