manager

 avatar
unknown
java
2 years ago
923 B
12
Indexable
public class HubManager {

    @Getter private final ItemStack hubItem = createHub();

    public ItemStack createHub() {
        ItemStack item = new ItemStack(Material.BLACK_SHULKER_BOX);
        ItemMeta meta = item.getItemMeta();

        List<Component> lore = new ArrayList<>();
        lore.add(Component.text("Place me!"));
        lore.add(Component.text("I will scan the chests around me!"));

        if (meta != null) {
            meta.displayName(Component.text("Storage Scanner"));
            meta.lore(lore);

            PersistentDataContainer container = item.getItemMeta().getPersistentDataContainer();

            if (!container.has(StorageScanner.getInstance().getKey(), PersistentDataType.STRING)) {
                container.set(StorageScanner.getInstance().getKey(), PersistentDataType.STRING, "SCANNER");
            }

            item.setItemMeta(meta);
        }

        return item;
    }
}
Editor is loading...