mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2026-01-27 16:06:04 +00:00
move keys to own class
this took forever
This commit is contained in:
@@ -107,7 +107,7 @@ public class GenerateLoot implements Listener {
|
||||
}
|
||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||
|
||||
if (container.has(toolStats.timeCreated, PersistentDataType.LONG) || container.has(toolStats.itemOwner, PersistentDataType.LONG)) {
|
||||
if (container.has(toolStats.toolStatsKeys.getTimeCreated(), PersistentDataType.LONG) || container.has(toolStats.toolStatsKeys.getItemOwner(), new UUIDDataType())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -122,8 +122,8 @@ public class GenerateLoot implements Listener {
|
||||
// if creation date is enabled, add it
|
||||
Component creationDate = toolStats.itemLore.formatCreationTime(timeCreated, 2, newItem);
|
||||
if (creationDate != null) {
|
||||
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 2);
|
||||
container.set(toolStats.toolStatsKeys.getTimeCreated(), PersistentDataType.LONG, timeCreated);
|
||||
container.set(toolStats.toolStatsKeys.getOriginType(), PersistentDataType.INTEGER, 2);
|
||||
lore.add(creationDate);
|
||||
meta.lore(lore);
|
||||
}
|
||||
@@ -131,8 +131,8 @@ public class GenerateLoot implements Listener {
|
||||
// if ownership is enabled, add it
|
||||
Component itemOwner = toolStats.itemLore.formatOwner(owner.getName(), 2, newItem);
|
||||
if (itemOwner != null) {
|
||||
container.set(toolStats.itemOwner, new UUIDDataType(), owner.getUniqueId());
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 2);
|
||||
container.set(toolStats.toolStatsKeys.getItemOwner(), new UUIDDataType(), owner.getUniqueId());
|
||||
container.set(toolStats.toolStatsKeys.getOriginType(), PersistentDataType.INTEGER, 2);
|
||||
lore.add(itemOwner);
|
||||
meta.lore(lore);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class GenerateLoot implements Listener {
|
||||
// if hash is enabled, add it
|
||||
if (toolStats.config.getBoolean("generate-hash-for-items")) {
|
||||
String hash = toolStats.hashMaker.makeHash(newItem.getType(), owner.getUniqueId(), timeCreated);
|
||||
container.set(toolStats.hash, PersistentDataType.STRING, hash);
|
||||
container.set(toolStats.toolStatsKeys.getHash(), PersistentDataType.STRING, hash);
|
||||
}
|
||||
|
||||
newItem.setItemMeta(meta);
|
||||
|
||||
Reference in New Issue
Block a user