mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2026-03-08 01:11:59 +00:00
fix #119
This commit is contained in:
@@ -113,6 +113,29 @@ public class BlockDispenseEvent implements Listener {
|
|||||||
lore = new ArrayList<>();
|
lore = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// by request
|
||||||
|
if (newItem.getType() == Material.ELYTRA) {
|
||||||
|
if (!toolStats.config.getBoolean("enabled.elytra-tag")) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Component creationDate = toolStats.itemLore.formatCreationTime(timeCreated, 4, newItem);
|
||||||
|
if (creationDate != null) {
|
||||||
|
container.set(toolStats.toolStatsKeys.getTimeCreated(), PersistentDataType.LONG, timeCreated);
|
||||||
|
container.set(toolStats.toolStatsKeys.getOriginType(), PersistentDataType.INTEGER, 4);
|
||||||
|
lore.add(creationDate);
|
||||||
|
meta.lore(lore);
|
||||||
|
}
|
||||||
|
|
||||||
|
Component itemOwner = toolStats.itemLore.formatOwner(owner.getName(), 4, newItem);
|
||||||
|
if (itemOwner != null) {
|
||||||
|
container.set(toolStats.toolStatsKeys.getItemOwner(), new UUIDDataType(), owner.getUniqueId());
|
||||||
|
container.set(toolStats.toolStatsKeys.getOriginType(), PersistentDataType.INTEGER, 4);
|
||||||
|
lore.add(itemOwner);
|
||||||
|
meta.lore(lore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if creation date is enabled, add it
|
// if creation date is enabled, add it
|
||||||
Component creationDate = toolStats.itemLore.formatCreationTime(timeCreated, 2, newItem);
|
Component creationDate = toolStats.itemLore.formatCreationTime(timeCreated, 2, newItem);
|
||||||
if (creationDate != null) {
|
if (creationDate != null) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class ConfigTools {
|
|||||||
String itemName = material.toString().toLowerCase();
|
String itemName = material.toString().toLowerCase();
|
||||||
String itemType = null;
|
String itemType = null;
|
||||||
// hardcode these
|
// hardcode these
|
||||||
if (material == Material.BOW || material == Material.CROSSBOW || material == Material.SHEARS || material == Material.TRIDENT || material == Material.FISHING_ROD) {
|
if (material == Material.BOW || material == Material.CROSSBOW || material == Material.SHEARS || material == Material.TRIDENT || material == Material.FISHING_ROD || material == Material.SHIELD) {
|
||||||
switch (material) {
|
switch (material) {
|
||||||
case CROSSBOW:
|
case CROSSBOW:
|
||||||
case BOW: {
|
case BOW: {
|
||||||
@@ -72,6 +72,10 @@ public class ConfigTools {
|
|||||||
itemType = "fishing-rod";
|
itemType = "fishing-rod";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SHIELD: {
|
||||||
|
itemType = "shield";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
itemType = itemName.substring(itemName.indexOf('_') + 1);
|
itemType = itemName.substring(itemName.indexOf('_') + 1);
|
||||||
@@ -88,6 +92,7 @@ public class ConfigTools {
|
|||||||
case "fishing-rod" -> toolStats.config.getBoolean("enabled." + configName + ".fishing-rod");
|
case "fishing-rod" -> toolStats.config.getBoolean("enabled." + configName + ".fishing-rod");
|
||||||
case "mace" -> toolStats.config.getBoolean("enabled." + configName + ".mace");
|
case "mace" -> toolStats.config.getBoolean("enabled." + configName + ".mace");
|
||||||
case "spear" -> toolStats.config.getBoolean("enabled." + configName + ".spear");
|
case "spear" -> toolStats.config.getBoolean("enabled." + configName + ".spear");
|
||||||
|
case "shield" -> toolStats.config.getBoolean("enabled." + configName + ".shield");
|
||||||
case "helmet", "chestplate", "leggings", "boots" ->
|
case "helmet", "chestplate", "leggings", "boots" ->
|
||||||
toolStats.config.getBoolean("enabled." + configName + ".armor");
|
toolStats.config.getBoolean("enabled." + configName + ".armor");
|
||||||
default -> false;
|
default -> false;
|
||||||
|
|||||||
@@ -242,6 +242,8 @@ enabled:
|
|||||||
armor: true
|
armor: true
|
||||||
fishing-rod: true
|
fishing-rod: true
|
||||||
spear: true
|
spear: true
|
||||||
|
shield: true
|
||||||
|
elytra: true
|
||||||
# Will show "Found on <date>"
|
# Will show "Found on <date>"
|
||||||
looted-on:
|
looted-on:
|
||||||
pickaxe: true
|
pickaxe: true
|
||||||
@@ -254,6 +256,8 @@ enabled:
|
|||||||
armor: true
|
armor: true
|
||||||
fishing-rod: true
|
fishing-rod: true
|
||||||
spear: true
|
spear: true
|
||||||
|
shield: true
|
||||||
|
elytra: true
|
||||||
# Will show "Traded by <player>"
|
# Will show "Traded by <player>"
|
||||||
traded-by:
|
traded-by:
|
||||||
pickaxe: true
|
pickaxe: true
|
||||||
|
|||||||
Reference in New Issue
Block a user