unify owner and timestamp creation

This commit is contained in:
hyperdefined
2025-07-23 10:53:22 -04:00
parent 70ed50ce9e
commit 27a89fd67c
9 changed files with 191 additions and 204 deletions

View File

@@ -18,6 +18,7 @@
package lol.hyper.toolstats.events;
import lol.hyper.toolstats.ToolStats;
import lol.hyper.toolstats.tools.UUIDDataType;
import net.kyori.adventure.text.Component;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -91,8 +92,6 @@ public class EntityDeath implements Listener {
if (toolStats.config.getBoolean("normalize-time-creation")) {
finalDate = toolStats.numberFormat.normalizeTime(timeCreated);
timeCreated = finalDate.getTime();
} else {
finalDate = new Date(timeCreated);
}
PersistentDataContainer container = meta.getPersistentDataContainer();
@@ -108,12 +107,13 @@ public class EntityDeath implements Listener {
lore = new ArrayList<>();
}
if (toolStats.config.getBoolean("enabled.dropped-on")) {
container.set(toolStats.originType, PersistentDataType.INTEGER, 1);
// if creation date is enabled, add it
Component creationDate = toolStats.itemLore.formatCreationTime(timeCreated, 1, newItem);
if (creationDate != null) {
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
String date = toolStats.numberFormat.formatDate(finalDate);
Component droppedOn = toolStats.configTools.formatLore("dropped-on", "{date}", date);
lore.add(droppedOn);
container.set(toolStats.originType, PersistentDataType.INTEGER, 1);
lore.add(creationDate);
meta.lore(lore);
}
if (toolStats.config.getBoolean("enabled.dropped-by")) {