mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2025-12-06 06:41:44 +00:00
rename things
This commit is contained in:
@@ -43,7 +43,7 @@ public final class ToolStats extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Stores who created an item.
|
* Stores who created an item.
|
||||||
*/
|
*/
|
||||||
public final NamespacedKey genericOwner = new NamespacedKey(this, "owner");
|
public final NamespacedKey itemOwner = new NamespacedKey(this, "owner");
|
||||||
/**
|
/**
|
||||||
* Stores when the item was created.
|
* Stores when the item was created.
|
||||||
*/
|
*/
|
||||||
@@ -51,15 +51,15 @@ public final class ToolStats extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Stores how many player kills.
|
* Stores how many player kills.
|
||||||
*/
|
*/
|
||||||
public final NamespacedKey swordPlayerKills = new NamespacedKey(this, "player-kills");
|
public final NamespacedKey playerKills = new NamespacedKey(this, "player-kills");
|
||||||
/**
|
/**
|
||||||
* Stores how many mob kills.
|
* Stores how many mob kills.
|
||||||
*/
|
*/
|
||||||
public final NamespacedKey swordMobKills = new NamespacedKey(this, "mob-kills");
|
public final NamespacedKey mobKills = new NamespacedKey(this, "mob-kills");
|
||||||
/**
|
/**
|
||||||
* Stores how many blocks were mined.
|
* Stores how many blocks were mined.
|
||||||
*/
|
*/
|
||||||
public final NamespacedKey genericMined = new NamespacedKey(this, "generic-mined");
|
public final NamespacedKey blocksMined = new NamespacedKey(this, "generic-mined");
|
||||||
/**
|
/**
|
||||||
* Stores how many crops were harvested.
|
* Stores how many crops were harvested.
|
||||||
*/
|
*/
|
||||||
@@ -67,11 +67,11 @@ public final class ToolStats extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Stores how many fish were caught.
|
* Stores how many fish were caught.
|
||||||
*/
|
*/
|
||||||
public final NamespacedKey fishingRodCaught = new NamespacedKey(this, "fish-caught");
|
public final NamespacedKey fishCaught = new NamespacedKey(this, "fish-caught");
|
||||||
/**
|
/**
|
||||||
* Stores how many sheep were sheared.
|
* Stores how many sheep were sheared.
|
||||||
*/
|
*/
|
||||||
public final NamespacedKey shearsSheared = new NamespacedKey(this, "sheared");
|
public final NamespacedKey sheepSheared = new NamespacedKey(this, "sheared");
|
||||||
/**
|
/**
|
||||||
* Stores how much damage an armor piece has taken.
|
* Stores how much damage an armor piece has taken.
|
||||||
*/
|
*/
|
||||||
@@ -118,7 +118,7 @@ public final class ToolStats extends JavaPlugin {
|
|||||||
public boolean tokens = false;
|
public boolean tokens = false;
|
||||||
public Set<NamespacedKey> tokenKeys = new HashSet<>();
|
public Set<NamespacedKey> tokenKeys = new HashSet<>();
|
||||||
|
|
||||||
public BlocksMined blocksMined;
|
public BlockBreak blockBreak;
|
||||||
public ChunkPopulate chunkPopulate;
|
public ChunkPopulate chunkPopulate;
|
||||||
public CraftItem craftItem;
|
public CraftItem craftItem;
|
||||||
public EntityDeath entityDeath;
|
public EntityDeath entityDeath;
|
||||||
@@ -165,7 +165,7 @@ public final class ToolStats extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
hashMaker = new HashMaker(this);
|
hashMaker = new HashMaker(this);
|
||||||
blocksMined = new BlocksMined(this);
|
blockBreak = new BlockBreak(this);
|
||||||
craftItem = new CraftItem(this);
|
craftItem = new CraftItem(this);
|
||||||
chunkPopulate = new ChunkPopulate(this);
|
chunkPopulate = new ChunkPopulate(this);
|
||||||
entityDeath = new EntityDeath(this);
|
entityDeath = new EntityDeath(this);
|
||||||
@@ -190,17 +190,17 @@ public final class ToolStats extends JavaPlugin {
|
|||||||
grindstoneEvent = new GrindstoneEvent(this);
|
grindstoneEvent = new GrindstoneEvent(this);
|
||||||
|
|
||||||
// save which stat can be used by a reset token
|
// save which stat can be used by a reset token
|
||||||
tokenKeys.add(genericMined);
|
tokenKeys.add(blocksMined);
|
||||||
tokenKeys.add(swordPlayerKills);
|
tokenKeys.add(playerKills);
|
||||||
tokenKeys.add(swordMobKills);
|
tokenKeys.add(mobKills);
|
||||||
tokenKeys.add(cropsHarvested);
|
tokenKeys.add(cropsHarvested);
|
||||||
tokenKeys.add(shearsSheared);
|
tokenKeys.add(sheepSheared);
|
||||||
tokenKeys.add(fishingRodCaught);
|
tokenKeys.add(fishCaught);
|
||||||
tokenKeys.add(flightTime);
|
tokenKeys.add(flightTime);
|
||||||
tokenKeys.add(arrowsShot);
|
tokenKeys.add(arrowsShot);
|
||||||
tokenKeys.add(armorDamage);
|
tokenKeys.add(armorDamage);
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(blocksMined, this);
|
Bukkit.getServer().getPluginManager().registerEvents(blockBreak, this);
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(chunkPopulate, this);
|
Bukkit.getServer().getPluginManager().registerEvents(chunkPopulate, this);
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(craftItem, this);
|
Bukkit.getServer().getPluginManager().registerEvents(craftItem, this);
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(entityDeath, this);
|
Bukkit.getServer().getPluginManager().registerEvents(entityDeath, this);
|
||||||
|
|||||||
@@ -227,8 +227,8 @@ public class CommandToolStats implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toolStats.configTools.checkConfig(original.getType(), "created-by")) {
|
if (toolStats.configTools.checkConfig(original.getType(), "created-by")) {
|
||||||
if (container.has(toolStats.genericOwner, new UUIDDataType())) {
|
if (container.has(toolStats.itemOwner, new UUIDDataType())) {
|
||||||
UUID owner = container.get(toolStats.genericOwner, new UUIDDataType());
|
UUID owner = container.get(toolStats.itemOwner, new UUIDDataType());
|
||||||
String ownerName = null;
|
String ownerName = null;
|
||||||
// if we can read the current owner
|
// if we can read the current owner
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
@@ -241,7 +241,7 @@ public class CommandToolStats implements TabExecutor {
|
|||||||
if (ownerName == null) {
|
if (ownerName == null) {
|
||||||
player.sendMessage(Component.text("The owner of this item is null. Setting to " + player.getName() + ".", NamedTextColor.RED));
|
player.sendMessage(Component.text("The owner of this item is null. Setting to " + player.getName() + ".", NamedTextColor.RED));
|
||||||
ownerName = player.getName();
|
ownerName = player.getName();
|
||||||
container.set(toolStats.genericOwner, new UUIDDataType(), player.getUniqueId());
|
container.set(toolStats.itemOwner, new UUIDDataType(), player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// show how the item was created based on the previous lore
|
// show how the item was created based on the previous lore
|
||||||
@@ -309,16 +309,16 @@ public class CommandToolStats implements TabExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toolStats.configTools.checkConfig(original.getType(), "player-kills")) {
|
if (toolStats.configTools.checkConfig(original.getType(), "player-kills")) {
|
||||||
if (container.has(toolStats.swordPlayerKills, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.playerKills, PersistentDataType.INTEGER)) {
|
||||||
Integer kills = container.get(toolStats.swordPlayerKills, PersistentDataType.INTEGER);
|
Integer kills = container.get(toolStats.playerKills, PersistentDataType.INTEGER);
|
||||||
if (kills != null) {
|
if (kills != null) {
|
||||||
lore.add(toolStats.configTools.formatLore("kills.player", "{kills}", toolStats.numberFormat.formatInt(kills)));
|
lore.add(toolStats.configTools.formatLore("kills.player", "{kills}", toolStats.numberFormat.formatInt(kills)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toolStats.configTools.checkConfig(original.getType(), "mob-kills")) {
|
if (toolStats.configTools.checkConfig(original.getType(), "mob-kills")) {
|
||||||
if (container.has(toolStats.swordMobKills, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.mobKills, PersistentDataType.INTEGER)) {
|
||||||
Integer kills = container.get(toolStats.swordMobKills, PersistentDataType.INTEGER);
|
Integer kills = container.get(toolStats.mobKills, PersistentDataType.INTEGER);
|
||||||
if (kills != null) {
|
if (kills != null) {
|
||||||
lore.add(toolStats.configTools.formatLore("kills.mob", "{kills}", toolStats.numberFormat.formatInt(kills)));
|
lore.add(toolStats.configTools.formatLore("kills.mob", "{kills}", toolStats.numberFormat.formatInt(kills)));
|
||||||
}
|
}
|
||||||
@@ -333,24 +333,24 @@ public class CommandToolStats implements TabExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (container.has(toolStats.genericMined, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.blocksMined, PersistentDataType.INTEGER)) {
|
||||||
Integer blocksMined = container.get(toolStats.genericMined, PersistentDataType.INTEGER);
|
Integer blocksMined = container.get(toolStats.blocksMined, PersistentDataType.INTEGER);
|
||||||
if (blocksMined != null) {
|
if (blocksMined != null) {
|
||||||
lore.add(toolStats.configTools.formatLore("blocks-mined", "{blocks}", toolStats.numberFormat.formatInt(blocksMined)));
|
lore.add(toolStats.configTools.formatLore("blocks-mined", "{blocks}", toolStats.numberFormat.formatInt(blocksMined)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toolStats.config.getBoolean("enabled.fish-caught")) {
|
if (toolStats.config.getBoolean("enabled.fish-caught")) {
|
||||||
if (container.has(toolStats.fishingRodCaught, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.fishCaught, PersistentDataType.INTEGER)) {
|
||||||
Integer fish = container.get(toolStats.fishingRodCaught, PersistentDataType.INTEGER);
|
Integer fish = container.get(toolStats.fishCaught, PersistentDataType.INTEGER);
|
||||||
if (fish != null) {
|
if (fish != null) {
|
||||||
lore.add(toolStats.configTools.formatLore("fished.fish-caught", "{fish}", toolStats.numberFormat.formatInt(fish)));
|
lore.add(toolStats.configTools.formatLore("fished.fish-caught", "{fish}", toolStats.numberFormat.formatInt(fish)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toolStats.config.getBoolean("enabled.sheep-sheared")) {
|
if (toolStats.config.getBoolean("enabled.sheep-sheared")) {
|
||||||
if (container.has(toolStats.shearsSheared, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.sheepSheared, PersistentDataType.INTEGER)) {
|
||||||
Integer sheep = container.get(toolStats.shearsSheared, PersistentDataType.INTEGER);
|
Integer sheep = container.get(toolStats.sheepSheared, PersistentDataType.INTEGER);
|
||||||
if (sheep != null) {
|
if (sheep != null) {
|
||||||
lore.add(toolStats.configTools.formatLore("sheep-sheared", "{sheep}", toolStats.numberFormat.formatInt(sheep)));
|
lore.add(toolStats.configTools.formatLore("sheep-sheared", "{sheep}", toolStats.numberFormat.formatInt(sheep)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class BlocksMined implements Listener {
|
public class BlockBreak implements Listener {
|
||||||
|
|
||||||
private final ToolStats toolStats;
|
private final ToolStats toolStats;
|
||||||
|
|
||||||
public BlocksMined(ToolStats toolStats) {
|
public BlockBreak(ToolStats toolStats) {
|
||||||
this.toolStats = toolStats;
|
this.toolStats = toolStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ public class CraftItem implements Listener {
|
|||||||
|
|
||||||
// if the item already has the tag
|
// if the item already has the tag
|
||||||
// this is to prevent duplicate tags
|
// this is to prevent duplicate tags
|
||||||
if (container.has(toolStats.timeCreated, PersistentDataType.LONG) || container.has(toolStats.genericOwner, PersistentDataType.LONG)) {
|
if (container.has(toolStats.timeCreated, PersistentDataType.LONG) || container.has(toolStats.itemOwner, PersistentDataType.LONG)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ public class CraftItem implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
||||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
container.set(toolStats.itemOwner, new UUIDDataType(), owner.getUniqueId());
|
||||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 0);
|
container.set(toolStats.originType, PersistentDataType.INTEGER, 0);
|
||||||
|
|
||||||
List<Component> lore;
|
List<Component> lore;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class CreativeEvent implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
||||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
container.set(toolStats.itemOwner, new UUIDDataType(), owner.getUniqueId());
|
||||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 6);
|
container.set(toolStats.originType, PersistentDataType.INTEGER, 6);
|
||||||
|
|
||||||
if (toolStats.configTools.checkConfig(newSpawnedItem.getType(), "spawned-in")) {
|
if (toolStats.configTools.checkConfig(newSpawnedItem.getType(), "spawned-in")) {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class GenerateLoot implements Listener {
|
|||||||
Date finalDate = new Date(timeCreated);
|
Date finalDate = new Date(timeCreated);
|
||||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||||
|
|
||||||
if (container.has(toolStats.timeCreated, PersistentDataType.LONG) || container.has(toolStats.genericOwner, PersistentDataType.LONG)) {
|
if (container.has(toolStats.timeCreated, PersistentDataType.LONG) || container.has(toolStats.itemOwner, PersistentDataType.LONG)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ public class GenerateLoot implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
||||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
container.set(toolStats.itemOwner, new UUIDDataType(), owner.getUniqueId());
|
||||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 2);
|
container.set(toolStats.originType, PersistentDataType.INTEGER, 2);
|
||||||
|
|
||||||
if (toolStats.configTools.checkConfig(newItem.getType(), "looted-tag")) {
|
if (toolStats.configTools.checkConfig(newItem.getType(), "looted-tag")) {
|
||||||
|
|||||||
@@ -108,17 +108,17 @@ public class GrindstoneEvent implements Listener {
|
|||||||
for (String token : tokens) {
|
for (String token : tokens) {
|
||||||
switch (appliedTokens) {
|
switch (appliedTokens) {
|
||||||
case "player-kills": {
|
case "player-kills": {
|
||||||
container.set(toolStats.swordPlayerKills, PersistentDataType.INTEGER, 0);
|
container.set(toolStats.playerKills, PersistentDataType.INTEGER, 0);
|
||||||
finalMeta = toolStats.itemLore.updatePlayerKills(inputItem, 0);
|
finalMeta = toolStats.itemLore.updatePlayerKills(inputItem, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "mob-kills": {
|
case "mob-kills": {
|
||||||
container.set(toolStats.swordMobKills, PersistentDataType.INTEGER, 0);
|
container.set(toolStats.mobKills, PersistentDataType.INTEGER, 0);
|
||||||
finalMeta = toolStats.itemLore.updateMobKills(inputItem, 0);
|
finalMeta = toolStats.itemLore.updateMobKills(inputItem, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "blocks-mined": {
|
case "blocks-mined": {
|
||||||
container.set(toolStats.genericMined, PersistentDataType.INTEGER, 0);
|
container.set(toolStats.blocksMined, PersistentDataType.INTEGER, 0);
|
||||||
finalMeta = toolStats.itemLore.updateBlocksMined(inputItem, 0);
|
finalMeta = toolStats.itemLore.updateBlocksMined(inputItem, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -128,12 +128,12 @@ public class GrindstoneEvent implements Listener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "fish-caught": {
|
case "fish-caught": {
|
||||||
container.set(toolStats.fishingRodCaught, PersistentDataType.INTEGER, 0);
|
container.set(toolStats.fishCaught, PersistentDataType.INTEGER, 0);
|
||||||
finalMeta = toolStats.itemLore.updateFishCaught(inputItem, 0);
|
finalMeta = toolStats.itemLore.updateFishCaught(inputItem, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "sheep-sheared": {
|
case "sheep-sheared": {
|
||||||
container.set(toolStats.shearsSheared, PersistentDataType.INTEGER, 0);
|
container.set(toolStats.sheepSheared, PersistentDataType.INTEGER, 0);
|
||||||
finalMeta = toolStats.itemLore.updateSheepSheared(inputItem, 0);
|
finalMeta = toolStats.itemLore.updateSheepSheared(inputItem, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,10 +66,10 @@ public class InventoryOpen implements Listener {
|
|||||||
if (toolStats.config.getBoolean("generate-hash-for-items")) {
|
if (toolStats.config.getBoolean("generate-hash-for-items")) {
|
||||||
if (!container.has(toolStats.hash, PersistentDataType.STRING)) {
|
if (!container.has(toolStats.hash, PersistentDataType.STRING)) {
|
||||||
// make sure the item has an owner
|
// make sure the item has an owner
|
||||||
if (!container.has(toolStats.genericOwner, new UUIDDataType())) {
|
if (!container.has(toolStats.itemOwner, new UUIDDataType())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UUID owner = container.get(toolStats.genericOwner, new UUIDDataType());
|
UUID owner = container.get(toolStats.itemOwner, new UUIDDataType());
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class PickupItem implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
||||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
container.set(toolStats.itemOwner, new UUIDDataType(), owner.getUniqueId());
|
||||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 4);
|
container.set(toolStats.originType, PersistentDataType.INTEGER, 4);
|
||||||
container.remove(toolStats.newElytra);
|
container.remove(toolStats.newElytra);
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class PlayerFish implements Listener {
|
|||||||
Date finalDate = new Date(timeCreated);
|
Date finalDate = new Date(timeCreated);
|
||||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||||
|
|
||||||
if (container.has(toolStats.timeCreated, PersistentDataType.LONG) || container.has(toolStats.genericOwner, PersistentDataType.LONG)) {
|
if (container.has(toolStats.timeCreated, PersistentDataType.LONG) || container.has(toolStats.itemOwner, PersistentDataType.LONG)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ public class PlayerFish implements Listener {
|
|||||||
|
|
||||||
container.set(toolStats.hash, PersistentDataType.STRING, hash);
|
container.set(toolStats.hash, PersistentDataType.STRING, hash);
|
||||||
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
||||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
container.set(toolStats.itemOwner, new UUIDDataType(), owner.getUniqueId());
|
||||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 5);
|
container.set(toolStats.originType, PersistentDataType.INTEGER, 5);
|
||||||
|
|
||||||
if (toolStats.configTools.checkConfig(newItem.getType(), "fished-tag")) {
|
if (toolStats.configTools.checkConfig(newItem.getType(), "fished-tag")) {
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ public class PlayerJoin implements Listener {
|
|||||||
// generate a hash if the item doesn't have one
|
// generate a hash if the item doesn't have one
|
||||||
if (!container.has(toolStats.hash, PersistentDataType.STRING)) {
|
if (!container.has(toolStats.hash, PersistentDataType.STRING)) {
|
||||||
// make sure the item has an owner
|
// make sure the item has an owner
|
||||||
if (!container.has(toolStats.genericOwner, new UUIDDataType())) {
|
if (!container.has(toolStats.itemOwner, new UUIDDataType())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UUID owner = container.get(toolStats.genericOwner, new UUIDDataType());
|
UUID owner = container.get(toolStats.itemOwner, new UUIDDataType());
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class VillagerTrade implements Listener {
|
|||||||
Date finalDate = new Date(timeCreated);
|
Date finalDate = new Date(timeCreated);
|
||||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||||
|
|
||||||
if (container.has(toolStats.timeCreated, PersistentDataType.LONG) || container.has(toolStats.genericOwner, PersistentDataType.LONG)) {
|
if (container.has(toolStats.timeCreated, PersistentDataType.LONG) || container.has(toolStats.itemOwner, PersistentDataType.LONG)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ public class VillagerTrade implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
container.set(toolStats.timeCreated, PersistentDataType.LONG, timeCreated);
|
||||||
container.set(toolStats.genericOwner, new UUIDDataType(), owner.getUniqueId());
|
container.set(toolStats.itemOwner, new UUIDDataType(), owner.getUniqueId());
|
||||||
container.set(toolStats.originType, PersistentDataType.INTEGER, 3);
|
container.set(toolStats.originType, PersistentDataType.INTEGER, 3);
|
||||||
|
|
||||||
if (toolStats.configTools.checkConfig(newItem.getType(), "traded-tag")) {
|
if (toolStats.configTools.checkConfig(newItem.getType(), "traded-tag")) {
|
||||||
|
|||||||
@@ -293,8 +293,8 @@ public class ItemLore {
|
|||||||
// read the current stats from the item
|
// read the current stats from the item
|
||||||
// if they don't exist, then start from 0
|
// if they don't exist, then start from 0
|
||||||
Integer blocksMined = 0;
|
Integer blocksMined = 0;
|
||||||
if (container.has(toolStats.genericMined, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.blocksMined, PersistentDataType.INTEGER)) {
|
||||||
blocksMined = container.get(toolStats.genericMined, PersistentDataType.INTEGER);
|
blocksMined = container.get(toolStats.blocksMined, PersistentDataType.INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blocksMined == null) {
|
if (blocksMined == null) {
|
||||||
@@ -302,7 +302,7 @@ public class ItemLore {
|
|||||||
toolStats.logger.warning(clone + " does not have valid generic-mined set! Resting to zero. This should NEVER happen.");
|
toolStats.logger.warning(clone + " does not have valid generic-mined set! Resting to zero. This should NEVER happen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.genericMined, PersistentDataType.INTEGER, blocksMined + add);
|
container.set(toolStats.blocksMined, PersistentDataType.INTEGER, blocksMined + add);
|
||||||
|
|
||||||
// do we add the lore based on the config?
|
// do we add the lore based on the config?
|
||||||
if (toolStats.configTools.checkConfig(clone.getType(), "blocks-mined")) {
|
if (toolStats.configTools.checkConfig(clone.getType(), "blocks-mined")) {
|
||||||
@@ -344,8 +344,8 @@ public class ItemLore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Integer playerKills = 0;
|
Integer playerKills = 0;
|
||||||
if (container.has(toolStats.swordPlayerKills, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.playerKills, PersistentDataType.INTEGER)) {
|
||||||
playerKills = container.get(toolStats.swordPlayerKills, PersistentDataType.INTEGER);
|
playerKills = container.get(toolStats.playerKills, PersistentDataType.INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerKills == null) {
|
if (playerKills == null) {
|
||||||
@@ -353,7 +353,7 @@ public class ItemLore {
|
|||||||
toolStats.logger.warning(clone + " does not have valid player-kills set! Resting to zero. This should NEVER happen.");
|
toolStats.logger.warning(clone + " does not have valid player-kills set! Resting to zero. This should NEVER happen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.swordPlayerKills, PersistentDataType.INTEGER, playerKills + add);
|
container.set(toolStats.playerKills, PersistentDataType.INTEGER, playerKills + add);
|
||||||
|
|
||||||
// do we add the lore based on the config?
|
// do we add the lore based on the config?
|
||||||
if (toolStats.configTools.checkConfig(clone.getType(), "player-kills")) {
|
if (toolStats.configTools.checkConfig(clone.getType(), "player-kills")) {
|
||||||
@@ -395,8 +395,8 @@ public class ItemLore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Integer mobKills = 0;
|
Integer mobKills = 0;
|
||||||
if (container.has(toolStats.swordMobKills, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.mobKills, PersistentDataType.INTEGER)) {
|
||||||
mobKills = container.get(toolStats.swordMobKills, PersistentDataType.INTEGER);
|
mobKills = container.get(toolStats.mobKills, PersistentDataType.INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mobKills == null) {
|
if (mobKills == null) {
|
||||||
@@ -404,7 +404,7 @@ public class ItemLore {
|
|||||||
toolStats.logger.warning(clone + " does not have valid mob-kills set! Resting to zero. This should NEVER happen.");
|
toolStats.logger.warning(clone + " does not have valid mob-kills set! Resting to zero. This should NEVER happen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.swordMobKills, PersistentDataType.INTEGER, mobKills + add);
|
container.set(toolStats.mobKills, PersistentDataType.INTEGER, mobKills + add);
|
||||||
|
|
||||||
// do we add the lore based on the config?
|
// do we add the lore based on the config?
|
||||||
if (toolStats.configTools.checkConfig(clone.getType(), "mob-kills")) {
|
if (toolStats.configTools.checkConfig(clone.getType(), "mob-kills")) {
|
||||||
@@ -553,8 +553,8 @@ public class ItemLore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Integer sheepSheared = 0;
|
Integer sheepSheared = 0;
|
||||||
if (container.has(toolStats.shearsSheared, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.sheepSheared, PersistentDataType.INTEGER)) {
|
||||||
sheepSheared = container.get(toolStats.shearsSheared, PersistentDataType.INTEGER);
|
sheepSheared = container.get(toolStats.sheepSheared, PersistentDataType.INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sheepSheared == null) {
|
if (sheepSheared == null) {
|
||||||
@@ -562,7 +562,7 @@ public class ItemLore {
|
|||||||
toolStats.logger.warning(clone + " does not have valid sheared set! Resting to zero. This should NEVER happen.");
|
toolStats.logger.warning(clone + " does not have valid sheared set! Resting to zero. This should NEVER happen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.shearsSheared, PersistentDataType.INTEGER, sheepSheared + add);
|
container.set(toolStats.sheepSheared, PersistentDataType.INTEGER, sheepSheared + add);
|
||||||
|
|
||||||
if (toolStats.config.getBoolean("enabled.sheep-sheared")) {
|
if (toolStats.config.getBoolean("enabled.sheep-sheared")) {
|
||||||
String oldSheepFormatted = toolStats.numberFormat.formatInt(sheepSheared);
|
String oldSheepFormatted = toolStats.numberFormat.formatInt(sheepSheared);
|
||||||
@@ -656,8 +656,8 @@ public class ItemLore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Integer fishCaught = 0;
|
Integer fishCaught = 0;
|
||||||
if (container.has(toolStats.fishingRodCaught, PersistentDataType.INTEGER)) {
|
if (container.has(toolStats.fishCaught, PersistentDataType.INTEGER)) {
|
||||||
fishCaught = container.get(toolStats.fishingRodCaught, PersistentDataType.INTEGER);
|
fishCaught = container.get(toolStats.fishCaught, PersistentDataType.INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fishCaught == null) {
|
if (fishCaught == null) {
|
||||||
@@ -665,7 +665,7 @@ public class ItemLore {
|
|||||||
toolStats.logger.warning(clone + " does not have valid fish-caught set! Resting to zero. This should NEVER happen.");
|
toolStats.logger.warning(clone + " does not have valid fish-caught set! Resting to zero. This should NEVER happen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
container.set(toolStats.fishingRodCaught, PersistentDataType.INTEGER, fishCaught + add);
|
container.set(toolStats.fishCaught, PersistentDataType.INTEGER, fishCaught + add);
|
||||||
|
|
||||||
if (toolStats.config.getBoolean("enabled.fish-caught")) {
|
if (toolStats.config.getBoolean("enabled.fish-caught")) {
|
||||||
String oldFishFormatted = toolStats.numberFormat.formatInt(fishCaught);
|
String oldFishFormatted = toolStats.numberFormat.formatInt(fishCaught);
|
||||||
|
|||||||
Reference in New Issue
Block a user