DevNatan / inventory-framework

Minecraft Inventory API framework
MIT License
127 stars 22 forks source link

more detailed error message #590

Open github-actions[bot] opened 11 months ago

github-actions[bot] commented 11 months ago

https://github.com/DevNatan/inventory-framework/blob/09ee0f14910ea3ab906136bea558806762b8af3e/inventory-framework-core/src/main/java/me/devnatan/inventoryframework/component/PaginationImpl.java#L249


        return pagesCount;
    }

    private LayoutSlot getLayoutSlotForCurrentTarget(IFRenderContext context) {
        if (currentLayoutSlot != null) return currentLayoutSlot;

        final Optional<LayoutSlot> layoutSlotOptional = context.getLayoutSlots().stream()
                .filter(layoutSlot -> layoutSlot.getCharacter() == getLayoutTarget())
                .findFirst();

        if (!layoutSlotOptional.isPresent())
            // TODO more detailed error message
            throw new IllegalArgumentException(String.format("Layout slot target not found: %c", getLayoutTarget()));

        return (currentLayoutSlot = layoutSlotOptional.get());
    }

    /**
     * Calculates the number of pages available based on a given source.
     *