OpenRankSystem
Scorpion edited this page 5 years ago
@EventHandler
public void onRankOpen(OpenRankSystem e) {
    boolean isTimed = e.getTimed();
    int slot = e.getSlot();

    if (!isTimed) {
        ItemStack stack = e.getItemStack().clone();
        stack.setType(Material.NAME_TAG);
        e.getInventory().setItem(slot, stack);
    }
}

@EventHandler
public void addRankLore(OpenRankSystem e) {
    boolean isTimed = e.getTimed();
    int slot = e.getSlot();
    ItemStack stack = e.getItemStack().clone();


    if (isTimed) {
        stack.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 3);
        ItemMeta meta = stack.getItemMeta();
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        stack.setItemMeta(meta);
        e.getInventory().setItem(slot, stack);
    }
}

}