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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user