Skip to content

Commit

Permalink
v3.7.3 b701
Browse files Browse the repository at this point in the history
* adjusted preserve-entity to align it with the original intension
  • Loading branch information
stumper66 committed Sep 24, 2022
1 parent 988fd0d commit c35df10
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.lokka30</groupId>
<artifactId>LevelledMobs</artifactId>
<version>3.7.3 b700</version>
<version>3.7.3 b701</version>
<packaging>jar</packaging>
<name>LevelledMobs</name>
<description>The Ultimate RPG Mob Levelling Plugin</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package me.lokka30.levelledmobs.listeners;

import java.time.Instant;
import java.util.HashSet;
import java.util.List;
import me.lokka30.levelledmobs.LevelledMobs;
Expand All @@ -27,6 +28,7 @@
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.persistence.PersistentDataType;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -119,6 +121,8 @@ public void onEntityDamageEvent(@NotNull final EntityDamageEvent event) {
}
}

lmEntity.getPDC().set(main.namespacedKeys.lastDamageTime, PersistentDataType.LONG, Instant.now().toEpochMilli());

// Update their nametag with a 1 tick delay so that their health after the damage is shown
main.levelManager.updateNametagWithDelay(lmEntity);
lmEntity.free();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1061,11 +1061,11 @@ private boolean checkIfReadyForRelevelling(final @NotNull LivingEntityWrapper lm
return true;
}

if (!lmEntity.getPDC().has(main.namespacedKeys.lastLevelledTime)){
if (!lmEntity.getPDC().has(main.namespacedKeys.lastDamageTime)){
return true;
}

final Long lastLevelledTime = lmEntity.getPDC().get(main.namespacedKeys.lastLevelledTime, PersistentDataType.LONG);
final Long lastLevelledTime = lmEntity.getPDC().get(main.namespacedKeys.lastDamageTime, PersistentDataType.LONG);
if (lastLevelledTime == null) {
return true;
}
Expand Down Expand Up @@ -1673,8 +1673,6 @@ public void run() {
main.levelManager.applyCreeperBlastRadius(lmEntity);
}

lmEntity.getPDC().set(main.namespacedKeys.lastLevelledTime, PersistentDataType.LONG, Instant.now().toEpochMilli());

lmEntity.free();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public NamespacedKeys(final LevelledMobs main) {
lockedDropRules = new NamespacedKey(main, "lockedDropRules");
lockedDropRulesOverride = new NamespacedKey(main, "lockedDropRulesOverride");
playerLevellingSourceNumber = new NamespacedKey(main, "playerLevellingSourceNumber");
lastLevelledTime = new NamespacedKey(main, "lastLevelledTime");
lastDamageTime = new NamespacedKey(main, "lastDamageTime");

spawnerEgg = new NamespacedKey(main, "spawnerEgg");
spawnerEggName = new NamespacedKey(main, "spawnerEggName");
Expand Down Expand Up @@ -73,7 +73,7 @@ public NamespacedKeys(final LevelledMobs main) {
public final NamespacedKey playerNetherCoordsIntoWorld;
public final NamespacedKey skyLightLevel;
public final NamespacedKey playerLevellingSourceNumber;
public final NamespacedKey lastLevelledTime;
public final NamespacedKey lastDamageTime;

public final NamespacedKey lockSettings;
public final NamespacedKey lockedNametag;
Expand Down

0 comments on commit c35df10

Please sign in to comment.