Skip to content

Commit

Permalink
1.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BenceX100 committed Nov 20, 2024
1 parent cecbedb commit 5f91b62
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.artillexstudios</groupId>
<artifactId>AxGraves</artifactId>
<version>1.15.1</version>
<version>1.16.0</version>
<packaging>jar</packaging>

<name>AxGraves</name>
Expand Down Expand Up @@ -106,7 +106,7 @@
<dependency>
<groupId>com.artillexstudios.axapi</groupId>
<artifactId>axapi</artifactId>
<version>1.4.397</version>
<version>1.4.403</version>
<scope>compile</scope>
<classifier>all</classifier>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -113,4 +117,4 @@ update-notifier:
on-join: true

# do not edit
version: 12
version: 13

0 comments on commit 5f91b62

Please sign in to comment.