Search in sources :

Example 1 with CustomItemDisplay

use of io.github.bananapuncher714.crafters.example.objects.CustomItemDisplay in project PublicCrafters by BananaPuncher714.

the class CraftingListener method onCraftDisplayUpdateEvent.

@EventHandler
public void onCraftDisplayUpdateEvent(CraftDisplayUpdateEvent event) {
    CraftDisplay craftDisplay = event.getDisplay();
    ItemDisplay display = craftDisplay.getItemDisplays().get(4);
    if (display == null) {
        return;
    }
    Material result = craftDisplay.getInventory().getResult().getType();
    if ((result != Material.DIAMOND_CHESTPLATE && display instanceof CustomItemDisplay) || (!(display instanceof CustomItemDisplay) && display.getItem().getType() == Material.DIAMOND && result == Material.DIAMOND_CHESTPLATE)) {
        event.getDisplay().update(1, 1, true);
    }
}
Also used : CustomItemDisplay(io.github.bananapuncher714.crafters.example.objects.CustomItemDisplay) CraftDisplay(io.github.bananapuncher714.crafters.display.CraftDisplay) ItemDisplay(io.github.bananapuncher714.crafters.display.ItemDisplay) CustomItemDisplay(io.github.bananapuncher714.crafters.example.objects.CustomItemDisplay) Material(org.bukkit.Material) EventHandler(org.bukkit.event.EventHandler)

Aggregations

CraftDisplay (io.github.bananapuncher714.crafters.display.CraftDisplay)1 ItemDisplay (io.github.bananapuncher714.crafters.display.ItemDisplay)1 CustomItemDisplay (io.github.bananapuncher714.crafters.example.objects.CustomItemDisplay)1 Material (org.bukkit.Material)1 EventHandler (org.bukkit.event.EventHandler)1