/** Basically handles when a user dropes a label onto a written disc. */ public void onInventoryClick(InventoryClickEvent event) { // only on right click. if (!event.isLeftClick()) { // only if a Label is on the cursor. is it even a custom item? if (event.getCursor() != null && new SpoutItemStack(event.getCursor()).isCustomItem()) { CustomItem itemOnCursor = (CustomItem) new SpoutItemStack(event.getCursor()).getMaterial(); if (itemOnCursor instanceof ItemLabel) { // yep, its a label. let see what were clicking on. if (new SpoutItemStack(event.getItem()).isCustomItem()) { // its custom could be a disc... CustomItem itemClickedOn = (CustomItem) new SpoutItemStack(event.getItem()).getMaterial(); if (itemClickedOn instanceof ItemBurnedObsidyisc) { // its a burned disc! we can do stuff to it. String label = plugin.getLabelManager().get(itemOnCursor.getCustomId()); plugin.getDiscsManager().setTitle(itemClickedOn.getCustomId(), label); plugin.getDiscsManager().save(); itemClickedOn.setName(label); // remove the item on the cursor. event.setResult(Result.ALLOW); event.setCursor(null); event.setCancelled(true); // return true; } } } } } }