mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2026-03-10 18:32:01 +00:00
move keys to own class
this took forever
This commit is contained in:
@@ -61,7 +61,7 @@ public class CreativeEvent implements Listener {
|
||||
// if the item already has an origin set, don't add it again
|
||||
// this is needed since you can spam click an item and the event will fire again
|
||||
PersistentDataContainer container = spawnedItemMeta.getPersistentDataContainer();
|
||||
if (container.has(toolStats.originType, PersistentDataType.INTEGER)) {
|
||||
if (container.has(toolStats.toolStatsKeys.getOriginType(), PersistentDataType.INTEGER)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class CreativeEvent implements Listener {
|
||||
|
||||
// if the item already has the tag
|
||||
// this is to prevent duplicate tags
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -112,8 +112,8 @@ public class CreativeEvent implements Listener {
|
||||
// if creation date is enabled, add it
|
||||
Component creationDate = toolStats.itemLore.formatCreationTime(timeCreated, 6, newSpawnedItem);
|
||||
if (creationDate != null) {
|
||||
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 6);
|
||||
container.set(toolStats.toolStatsKeys.getTimeCreated(), PersistentDataType.LONG, timeCreated);
|
||||
container.set(toolStats.toolStatsKeys.getOriginType(), PersistentDataType.INTEGER, 6);
|
||||
lore.add(creationDate);
|
||||
meta.lore(lore);
|
||||
}
|
||||
@@ -121,8 +121,8 @@ public class CreativeEvent implements Listener {
|
||||
// if ownership is enabled, add it
|
||||
Component itemOwner = toolStats.itemLore.formatOwner(owner.getName(), 6, newSpawnedItem);
|
||||
if (itemOwner != null) {
|
||||
container.set(toolStats.itemOwner, new UUIDDataType(), owner.getUniqueId());
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 6);
|
||||
container.set(toolStats.toolStatsKeys.getItemOwner(), new UUIDDataType(), owner.getUniqueId());
|
||||
container.set(toolStats.toolStatsKeys.getOriginType(), PersistentDataType.INTEGER, 6);
|
||||
lore.add(itemOwner);
|
||||
meta.lore(lore);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class CreativeEvent implements Listener {
|
||||
// if hash is enabled, add it
|
||||
if (toolStats.config.getBoolean("generate-hash-for-items")) {
|
||||
String hash = toolStats.hashMaker.makeHash(newSpawnedItem.getType(), owner.getUniqueId(), timeCreated);
|
||||
container.set(toolStats.hash, PersistentDataType.STRING, hash);
|
||||
container.set(toolStats.toolStatsKeys.getHash(), PersistentDataType.STRING, hash);
|
||||
}
|
||||
|
||||
newSpawnedItem.setItemMeta(meta);
|
||||
|
||||
Reference in New Issue
Block a user