Search in sources :

Example 1 with CraftDisplay

use of io.github.bananapuncher714.crafters.display.CraftDisplay in project PublicCrafters by BananaPuncher714.

the class CustomInventoryCrafting method move.

@Override
public PublicCraftingInventory move(Location location) {
    display.stop();
    if (manager.get(bloc) == this) {
        manager.benches.remove(bloc);
    }
    bloc = location;
    CustomInventoryCrafting whatsHere = manager.put(location, this);
    display = new CraftDisplay(this);
    display.update();
    return whatsHere;
}
Also used : CraftDisplay(io.github.bananapuncher714.crafters.display.CraftDisplay)

Example 2 with CraftDisplay

use of io.github.bananapuncher714.crafters.display.CraftDisplay in project PublicCrafters by BananaPuncher714.

the class CustomInventoryCrafting method move.

@Override
public PublicCraftingInventory move(Location location) {
    display.stop();
    if (manager.get(bloc) == this) {
        manager.benches.remove(bloc);
    }
    bloc = location;
    CustomInventoryCrafting whatsHere = manager.put(location, this);
    display = new CraftDisplay(this);
    display.update();
    return whatsHere;
}
Also used : CraftDisplay(io.github.bananapuncher714.crafters.display.CraftDisplay)

Example 3 with CraftDisplay

use of io.github.bananapuncher714.crafters.display.CraftDisplay in project PublicCrafters by BananaPuncher714.

the class CustomInventoryCrafting method move.

@Override
public PublicCraftingInventory move(Location location) {
    display.stop();
    if (manager.get(bloc) == this) {
        manager.benches.remove(bloc);
    }
    bloc = location;
    CustomInventoryCrafting whatsHere = manager.put(location, this);
    display = new CraftDisplay(this);
    display.update();
    return whatsHere;
}
Also used : CraftDisplay(io.github.bananapuncher714.crafters.display.CraftDisplay)

Example 4 with CraftDisplay

use of io.github.bananapuncher714.crafters.display.CraftDisplay in project PublicCrafters by BananaPuncher714.

the class CustomInventoryCrafting method move.

@Override
public PublicCraftingInventory move(Location location) {
    display.stop();
    if (manager.get(bloc) == this) {
        manager.benches.remove(bloc);
    }
    bloc = location;
    CustomInventoryCrafting whatsHere = manager.put(location, this);
    display = new CraftDisplay(this);
    display.update();
    return whatsHere;
}
Also used : CraftDisplay(io.github.bananapuncher714.crafters.display.CraftDisplay)

Example 5 with CraftDisplay

use of io.github.bananapuncher714.crafters.display.CraftDisplay 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)18 EventHandler (org.bukkit.event.EventHandler)2 ItemDisplay (io.github.bananapuncher714.crafters.display.ItemDisplay)1 CustomItemDisplay (io.github.bananapuncher714.crafters.example.objects.CustomItemDisplay)1 Material (org.bukkit.Material)1