mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2025-12-06 06:41:44 +00:00
more config changes
* fixed typo on config updater * handle missing config messages a lot better * only try to update lore if it's enabled, don't try then check if it's enabled
This commit is contained in:
@@ -25,7 +25,6 @@ import lol.hyper.toolstats.tools.*;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@@ -107,11 +107,10 @@ public class BlocksMined implements Listener {
|
||||
blocksMined++;
|
||||
container.set(toolStats.genericMined, PersistentDataType.INTEGER, blocksMined);
|
||||
|
||||
String blocksMinedFormatted = toolStats.numberFormat.formatInt(blocksMined);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{blocks}", blocksMinedFormatted, "blocks-mined");
|
||||
|
||||
// do we add the lore based on the config?
|
||||
if (toolStats.checkConfig(playerTool.getType(), "blocks-mined")) {
|
||||
String blocksMinedFormatted = toolStats.numberFormat.formatInt(blocksMined);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{blocks}", blocksMinedFormatted, "blocks-mined");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
playerTool.setItemMeta(meta);
|
||||
@@ -144,11 +143,10 @@ public class BlocksMined implements Listener {
|
||||
cropsMined++;
|
||||
container.set(toolStats.cropsHarvested, PersistentDataType.INTEGER, cropsMined);
|
||||
|
||||
String cropsMinedFormatted = toolStats.numberFormat.formatInt(cropsMined);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{crops}", cropsMinedFormatted, "crops-harvested");
|
||||
|
||||
// do we add the lore based on the config?
|
||||
if (toolStats.checkConfig(playerTool.getType(), "blocks-mined")) {
|
||||
String cropsMinedFormatted = toolStats.numberFormat.formatInt(cropsMined);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{crops}", cropsMinedFormatted, "crops-harvested");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
playerTool.setItemMeta(meta);
|
||||
|
||||
@@ -113,18 +113,6 @@ public class CraftItem implements Listener {
|
||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 0);
|
||||
|
||||
String createdByRaw = toolStats.getLoreFromConfig("created.created-by", true);
|
||||
String createdOnRaw = toolStats.getLoreFromConfig("created.created-on", true);
|
||||
|
||||
if (createdOnRaw == null) {
|
||||
toolStats.logger.warning("There is no lore message for messages.created.created-on!");
|
||||
return null;
|
||||
}
|
||||
if (createdByRaw == null) {
|
||||
toolStats.logger.warning("There is no lore message for messages.created.created-by!");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> lore;
|
||||
// get the current lore the item
|
||||
if (meta.hasLore()) {
|
||||
@@ -134,12 +122,23 @@ public class CraftItem implements Listener {
|
||||
}
|
||||
// do we add the lore based on the config?
|
||||
if (toolStats.checkConfig(itemStack.getType(), "created-date")) {
|
||||
String createdOnRaw = toolStats.getLoreFromConfig("created.created-on", true);
|
||||
if (createdOnRaw == null) {
|
||||
toolStats.logger.warning("There is no lore message for messages.created.created-on!");
|
||||
return null;
|
||||
}
|
||||
lore.add(createdOnRaw.replace("{date}", toolStats.numberFormat.formatDate(finalDate)));
|
||||
meta.setLore(lore);
|
||||
}
|
||||
if (toolStats.checkConfig(itemStack.getType(), "created-by")) {
|
||||
String createdByRaw = toolStats.getLoreFromConfig("created.created-by", true);
|
||||
if (createdByRaw == null) {
|
||||
toolStats.logger.warning("There is no lore message for messages.created.created-by!");
|
||||
return null;
|
||||
}
|
||||
lore.add(createdByRaw.replace("{player}", owner.getName()));
|
||||
meta.setLore(lore);
|
||||
}
|
||||
meta.setLore(lore);
|
||||
newItem.setItemMeta(meta);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
@@ -97,10 +97,9 @@ public class CreativeEvent implements Listener {
|
||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 6);
|
||||
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
|
||||
if (toolStats.checkConfig(newSpawnedItem.getType(), "spawned-in")) {
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
|
||||
|
||||
@@ -244,11 +244,10 @@ public class EntityDamage implements Listener {
|
||||
playerKills++;
|
||||
container.set(toolStats.swordPlayerKills, PersistentDataType.INTEGER, playerKills);
|
||||
|
||||
String playerKillsFormatted = toolStats.numberFormat.formatInt(playerKills);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{kills}", playerKillsFormatted, "kills.player");
|
||||
|
||||
// do we add the lore based on the config?
|
||||
if (toolStats.checkConfig(itemStack.getType(), "player-kills")) {
|
||||
String playerKillsFormatted = toolStats.numberFormat.formatInt(playerKills);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{kills}", playerKillsFormatted, "kills.player");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
itemStack.setItemMeta(meta);
|
||||
@@ -279,11 +278,10 @@ public class EntityDamage implements Listener {
|
||||
mobKills++;
|
||||
container.set(toolStats.swordMobKills, PersistentDataType.INTEGER, mobKills);
|
||||
|
||||
String mobKillsFormatted = toolStats.numberFormat.formatInt(mobKills);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{kills}", mobKillsFormatted, "kills.mob");
|
||||
|
||||
// do we add the lore based on the config?
|
||||
if (toolStats.checkConfig(itemStack.getType(), "mob-kills")) {
|
||||
String mobKillsFormatted = toolStats.numberFormat.formatInt(mobKills);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{kills}", mobKillsFormatted, "kills.mob");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
itemStack.setItemMeta(meta);
|
||||
@@ -316,10 +314,9 @@ public class EntityDamage implements Listener {
|
||||
container.set(toolStats.armorDamage, PersistentDataType.DOUBLE, damageTaken);
|
||||
container.set(toolStats.armorDamageInt, PersistentDataType.INTEGER, damageTaken.intValue());
|
||||
|
||||
String damageTakenFormatted = toolStats.numberFormat.formatDouble(damageTaken);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{damage}", damageTakenFormatted, "damage-taken");
|
||||
|
||||
if (toolStats.config.getBoolean("enabled.armor-damage")) {
|
||||
String damageTakenFormatted = toolStats.numberFormat.formatDouble(damageTaken);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{damage}", damageTakenFormatted, "damage-taken");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
itemStack.setItemMeta(meta);
|
||||
@@ -351,11 +348,10 @@ public class EntityDamage implements Listener {
|
||||
mobKills++;
|
||||
container.set(toolStats.swordMobKills, PersistentDataType.INTEGER, mobKills);
|
||||
|
||||
String mobKillsFormatted = toolStats.numberFormat.formatInt(mobKills);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{kills}", mobKillsFormatted, "kills.mob");
|
||||
|
||||
// do we add the lore based on the config?
|
||||
if (toolStats.checkConfig(newTrident.getType(), "mob-kills")) {
|
||||
String mobKillsFormatted = toolStats.numberFormat.formatInt(mobKills);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{kills}", mobKillsFormatted, "kills.mob");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
newTrident.setItemMeta(meta);
|
||||
@@ -388,11 +384,10 @@ public class EntityDamage implements Listener {
|
||||
playerKills++;
|
||||
container.set(toolStats.swordPlayerKills, PersistentDataType.INTEGER, playerKills);
|
||||
|
||||
String playerKillsFormatted = toolStats.numberFormat.formatInt(playerKills);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{kills}", playerKillsFormatted, "kills.player");
|
||||
|
||||
// do we add the lore based on the config?
|
||||
if (toolStats.checkConfig(newTrident.getType(), "player-kills")) {
|
||||
String playerKillsFormatted = toolStats.numberFormat.formatInt(playerKills);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{kills}", playerKillsFormatted, "kills.player");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
newTrident.setItemMeta(meta);
|
||||
|
||||
@@ -85,9 +85,8 @@ public class EntityDeath implements Listener {
|
||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 1);
|
||||
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{name}", mob, "dropped-by");
|
||||
|
||||
if (toolStats.config.getBoolean("enabled.dropped-by")) {
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{name}", mob, "dropped-by");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
newItem.setItemMeta(meta);
|
||||
|
||||
@@ -116,10 +116,9 @@ public class GenerateLoot implements Listener {
|
||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 2);
|
||||
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
|
||||
if (toolStats.checkConfig(newItem.getType(), "looted-tag")) {
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
newItem.setItemMeta(meta);
|
||||
|
||||
@@ -101,10 +101,9 @@ public class PickupItem implements Listener {
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 4);
|
||||
container.remove(toolStats.newElytra);
|
||||
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
|
||||
if (toolStats.config.getBoolean("enabled.elytra-tag")) {
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
finalItem.setItemMeta(meta);
|
||||
|
||||
@@ -124,10 +124,9 @@ public class PlayerFish implements Listener {
|
||||
fishCaught++;
|
||||
container.set(toolStats.fishingRodCaught, PersistentDataType.INTEGER, fishCaught);
|
||||
|
||||
String fishCaughtFormatted = toolStats.numberFormat.formatInt(fishCaught);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{fish}", fishCaughtFormatted, "fished.fish-caught");
|
||||
|
||||
if (toolStats.config.getBoolean("enabled.fish-caught")) {
|
||||
String fishCaughtFormatted = toolStats.numberFormat.formatInt(fishCaught);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{fish}", fishCaughtFormatted, "fished.fish-caught");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
fishingRod.setItemMeta(meta);
|
||||
@@ -161,10 +160,9 @@ public class PlayerFish implements Listener {
|
||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 5);
|
||||
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
|
||||
if (toolStats.checkConfig(newItem.getType(), "fished-tag")) {
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
newItem.setItemMeta(meta);
|
||||
|
||||
@@ -117,10 +117,9 @@ public class SheepShear implements Listener {
|
||||
sheepSheared++;
|
||||
container.set(toolStats.shearsSheared, PersistentDataType.INTEGER, sheepSheared);
|
||||
|
||||
String sheepShearedFormatted = toolStats.numberFormat.formatInt(sheepSheared);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{sheep}", sheepShearedFormatted, "sheep-sheared");
|
||||
|
||||
if (toolStats.config.getBoolean("enabled.sheep-sheared")) {
|
||||
String sheepShearedFormatted = toolStats.numberFormat.formatInt(sheepSheared);
|
||||
List<String> newLore = toolStats.itemLore.addItemLore(meta, "{sheep}", sheepShearedFormatted, "sheep-sheared");
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
newShears.setItemMeta(meta);
|
||||
|
||||
@@ -115,10 +115,9 @@ public class VillagerTrade implements Listener {
|
||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 3);
|
||||
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
|
||||
if (toolStats.checkConfig(newItem.getType(), "traded-tag")) {
|
||||
String formattedDate = toolStats.numberFormat.formatDate(finalDate);
|
||||
List<String> newLore = toolStats.itemLore.addNewOwner(meta, owner.getName(), formattedDate);
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
newItem.setItemMeta(meta);
|
||||
|
||||
@@ -61,9 +61,9 @@ public class ConfigUpdater {
|
||||
toolStats.logger.info("Adding enabled.spawned-in.bow to config.yml.");
|
||||
toolStats.config.set("enabled.spawned-in.armor", true);
|
||||
toolStats.logger.info("Adding enabled.spawned-in.armor to config.yml.");
|
||||
toolStats.config.set("messages.spawned.spawned-by", "&7Spawned in by: &8{player}");
|
||||
toolStats.config.set("messages.spawned-in.spawned-by", "&7Spawned in by: &8{player}");
|
||||
toolStats.logger.info("Adding messages.spawned-in.spawned-by to config.yml.");
|
||||
toolStats.config.set("messages.spawned.spawned-on", "&7Spawned on: &8{date}");
|
||||
toolStats.config.set("messages.spawned-in.spawned-on", "&7Spawned on: &8{date}");
|
||||
toolStats.logger.info("Adding messages.spawned-in.spawned-on to config.yml.");
|
||||
toolStats.config.set("generate-hash-for-items", true);
|
||||
toolStats.logger.info("Adding generate-hash-for-items to config.yml.");
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ItemLore {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new lore to an item.
|
||||
* Adds/updates lore for an item.
|
||||
*
|
||||
* @param placeholder The placeholder from the config. ex: {kills}
|
||||
* @param placeholderValue The value to replace the placeholder.
|
||||
@@ -80,7 +80,7 @@ public class ItemLore {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new ownership tag to an item.
|
||||
* Adds new ownership to an item.
|
||||
*
|
||||
* @param itemMeta The item meta.
|
||||
* @param playerName The new owner of item.
|
||||
@@ -88,49 +88,108 @@ public class ItemLore {
|
||||
* @return The item's new lore.
|
||||
*/
|
||||
public List<String> addNewOwner(ItemMeta itemMeta, String playerName, String formattedDate) {
|
||||
String dateCreated = null;
|
||||
String itemOwner = null;
|
||||
String dateCreatedLore;
|
||||
String itemOwnerLore;
|
||||
Integer origin = null;
|
||||
PersistentDataContainer container = itemMeta.getPersistentDataContainer();
|
||||
if (container.has(toolStats.originType, PersistentDataType.INTEGER)) {
|
||||
origin = container.get(toolStats.originType, PersistentDataType.INTEGER);
|
||||
}
|
||||
|
||||
// if the origin is broken, don't try to set the lore
|
||||
if (origin == null) {
|
||||
origin = -1;
|
||||
toolStats.logger.info("Unable to determine origin for item " + itemMeta.getAsString());
|
||||
toolStats.logger.info("This IS a bug, please report this to the GitHub.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
|
||||
// set the lore based on the origin
|
||||
switch (origin) {
|
||||
case 2: {
|
||||
dateCreated = toolStats.getLoreFromConfig("looted.looted-on", true);
|
||||
itemOwner = toolStats.getLoreFromConfig("looted.looted-by", true);
|
||||
dateCreatedLore = toolStats.getLoreFromConfig("looted.looted-on", true);
|
||||
itemOwnerLore = toolStats.getLoreFromConfig("looted.looted-by", true);
|
||||
|
||||
if (dateCreatedLore == null) {
|
||||
toolStats.logger.warning("messages.looted.looted-on is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
if (itemOwnerLore == null) {
|
||||
toolStats.logger.warning("messages.looted.looted-by is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
dateCreated = toolStats.getLoreFromConfig("traded.traded-on", true);
|
||||
itemOwner = toolStats.getLoreFromConfig("traded.traded-by", true);
|
||||
dateCreatedLore = toolStats.getLoreFromConfig("traded.traded-on", true);
|
||||
itemOwnerLore = toolStats.getLoreFromConfig("traded.traded-by", true);
|
||||
|
||||
if (dateCreatedLore == null) {
|
||||
toolStats.logger.warning("messages.traded.traded-on is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
if (itemOwnerLore == null) {
|
||||
toolStats.logger.warning("messages.traded.traded-by is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
dateCreated = toolStats.getLoreFromConfig("looted.found-on", true);
|
||||
itemOwner = toolStats.getLoreFromConfig("looted.found-by", true);
|
||||
dateCreatedLore = toolStats.getLoreFromConfig("looted.found-on", true);
|
||||
itemOwnerLore = toolStats.getLoreFromConfig("looted.found-by", true);
|
||||
|
||||
if (dateCreatedLore == null) {
|
||||
toolStats.logger.warning("messages.looted.found-on is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
if (itemOwnerLore == null) {
|
||||
toolStats.logger.warning("messages.looted.found-by is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
dateCreated = toolStats.getLoreFromConfig("fished.caught-on", true);
|
||||
itemOwner = toolStats.getLoreFromConfig("fished.caught-by", true);
|
||||
dateCreatedLore = toolStats.getLoreFromConfig("fished.caught-on", true);
|
||||
itemOwnerLore = toolStats.getLoreFromConfig("fished.caught-by", true);
|
||||
|
||||
if (dateCreatedLore == null) {
|
||||
toolStats.logger.warning("messages.fished.caught-on is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
if (itemOwnerLore == null) {
|
||||
toolStats.logger.warning("messages.fished.caught-by is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
dateCreated = toolStats.getLoreFromConfig("spawned-in.spawned-on", true);
|
||||
itemOwner = toolStats.getLoreFromConfig("spawned-in.spawned-by", true);
|
||||
dateCreatedLore = toolStats.getLoreFromConfig("spawned-in.spawned-on", true);
|
||||
itemOwnerLore = toolStats.getLoreFromConfig("spawned-in.spawned-by", true);
|
||||
|
||||
if (dateCreatedLore == null) {
|
||||
toolStats.logger.warning("messages.spawned-in.spawned-on is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
if (itemOwnerLore == null) {
|
||||
toolStats.logger.warning("messages.spawned-in.spawned-by is not set in your config!");
|
||||
toolStats.logger.warning("Unable to update lore for item.");
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dateCreated == null || itemOwner == null) {
|
||||
toolStats.logger.info("Unable to determine origin of item for " + itemMeta);
|
||||
return itemMeta.getLore();
|
||||
default: {
|
||||
toolStats.logger.warning("Origin " + origin + " was found. Data was modified OR something REALLY broke.");
|
||||
toolStats.logger.warning(itemMeta.getAsString());
|
||||
return itemMeta.getLore();
|
||||
}
|
||||
}
|
||||
|
||||
List<String> newLore;
|
||||
@@ -140,8 +199,8 @@ public class ItemLore {
|
||||
newLore = new ArrayList<>();
|
||||
}
|
||||
|
||||
newLore.add(dateCreated.replace("{date}", formattedDate));
|
||||
newLore.add(itemOwner.replace("{player}", playerName));
|
||||
newLore.add(dateCreatedLore.replace("{date}", formattedDate));
|
||||
newLore.add(itemOwnerLore.replace("{player}", playerName));
|
||||
return newLore;
|
||||
}
|
||||
|
||||
@@ -160,15 +219,15 @@ public class ItemLore {
|
||||
lore = itemMeta.getLore();
|
||||
Integer origin = null;
|
||||
|
||||
String createdBy = toolStats.getLoreFromConfig("created.created-by", false);
|
||||
String createdOn = toolStats.getLoreFromConfig("created.created-on", false);
|
||||
String caughtBy = toolStats.getLoreFromConfig("fished.caught-by", false);
|
||||
String lootedBy = toolStats.getLoreFromConfig("looted.looted-by", false);
|
||||
String foundBy = toolStats.getLoreFromConfig("looted.found-by", false);
|
||||
String tradedBy = toolStats.getLoreFromConfig("traded.traded-by", false);
|
||||
|
||||
for (String line : lore) {
|
||||
// this is the worst code I have ever written
|
||||
String createdBy = toolStats.getLoreFromConfig("created.created-by", false);
|
||||
String createdOn = toolStats.getLoreFromConfig("created.created-on", false);
|
||||
String caughtBy = toolStats.getLoreFromConfig("fished.caught-by", false);
|
||||
String lootedBy = toolStats.getLoreFromConfig("looted.looted-by", false);
|
||||
String foundBy = toolStats.getLoreFromConfig("looted.found-by", false);
|
||||
String tradedBy = toolStats.getLoreFromConfig("traded.traded-by", false);
|
||||
|
||||
if (createdBy != null && line.contains(createdBy)) {
|
||||
origin = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user