9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-30 04:19:28 +00:00

feat: add cosmetics containing who they were generated for

This commit is contained in:
LoJoSho
2023-04-23 10:38:43 -05:00
parent d9551f2827
commit dd805f1860
2 changed files with 8 additions and 3 deletions

View File

@@ -210,7 +210,8 @@ public class CosmeticUser {
mapMeta.setColor(color);
}
}
itemMeta.getPersistentDataContainer().set(InventoryUtils.getKey(), PersistentDataType.STRING, "true");
itemMeta.getPersistentDataContainer().set(InventoryUtils.getCosmeticKey(), PersistentDataType.STRING, "true");
itemMeta.getPersistentDataContainer().set(InventoryUtils.getOwnerKey(), PersistentDataType.STRING, getPlayer().getUniqueId().toString());
item.setItemMeta(itemMeta);
}

View File

@@ -145,10 +145,14 @@ public class InventoryUtils {
public static boolean isCosmeticItem(ItemStack itemStack) {
itemStack = itemStack.clone();
if (!itemStack.hasItemMeta()) return false;
return itemStack.getItemMeta().getPersistentDataContainer().has(getKey(), PersistentDataType.STRING);
return itemStack.getItemMeta().getPersistentDataContainer().has(getCosmeticKey(), PersistentDataType.STRING);
}
public static NamespacedKey getKey() {
public static NamespacedKey getCosmeticKey() {
return new NamespacedKey(HMCCosmeticsPlugin.getInstance(), "cosmetic");
}
public static NamespacedKey getOwnerKey() {
return new NamespacedKey(HMCCosmeticsPlugin.getInstance(), "owner");
}
}