NBT Tags

View the NBT Tag System for CIYFLib.

So, you've created a custom itemstack with NBT using our builder and now want to check this data on interaction? Simply do the below..

    @EventHandler
    public void onInteract(PlayerInteractEvent e) {
        ItemStack item = e.getItem();
        String swordType = ItemUtil.getNBTString(item, "sword-type");

        if (swordType != null && swordType.equalsIgnoreCase("strong"))
            e.getPlayer().sendMessage("You clicked the strong sword.");
    }

I cannot stress enough how easy this library has made plugin development.

Last updated