All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xyz.upperlevel.spigot.gui.GuiSize Maven / Gradle / Ivy

There is a newer version: 1.2
Show newest version
package xyz.upperlevel.spigot.gui;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.experimental.Accessors;

@RequiredArgsConstructor
@Accessors(fluent = true)
@Getter
public enum GuiSize {
    SMALLEST(9), SMALL(9*2), NORMAL(9*3), BIG(9*4), BIGGER(9*5), DOUBLE(9*6);
    private final int size;

    /**
     * returns the minimum acceptable size for an inventory
     * @param needed the spaces needed in the inventory
     * @return the smallest inventory size that has at least the spaces passed as argument
     */
    public static int min(int needed) {
        return (int) (Math.ceil(needed / 9.0) * 9);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy