src/main/java/me/hyfe/simplespigot/menu/service/MenuService.java
/**
     * Parses slots from other formats other than slot, slot, slot and can take slot...slot or fill
     *
     * @param menu  The menu to get slots from.
     * @param input The string to parse the slots from.
     * @return The slots specified after parsing is done.
     */
Parses slots from other formats other than slot, slot, slot and can take slot...slot or fill
@param menu  The menu to get slots from.
@param input The string to parse the slots from.
@return The slots specified after parsing is done.
Parses slots from other formats other than slot slot slot and can take slot ... slot or fill @param menu The menu to get slots from . @param input The string to parse the slots from . @return The slots specified after parsing is done .
public static Set<Integer> parseSlots(Menu menu, String input) {
        BiFunction<Menu, String, String> converter = (fMenu, entry) -> entry.equalsIgnoreCase("end") || entry.equalsIgnoreCase("start") ? Integer.toString(entry.equalsIgnoreCase("end") ? menu.getRows() * 9 - 1 : 0) : entry;
        BiFunction<Menu, Integer, Integer> slotLimiter = (fMenu, slot) -> slot < 0 ? 0 : Math.min(slot, menu.getRows() * 9 - 1);
        Set<Integer> slots = Sets.newLinkedHashSet();
        String toParse = input.replace(" ", "");
        if (toParse.equalsIgnoreCase("fill")) {
            for (int slot = 0; slot < menu.getInventory().getSize(); slot++) {
                ItemStack itemStack = menu.getInventory().getItem(slot);
                if (itemStack == null || itemStack.getType().equals(Material.AIR)) {
                    slots.add(slot);
                }
            }
            return slots;
        }
        if (toParse.equalsIgnoreCase("border")) {
            slots.addAll(getBorderSlots(menu));
            return slots;
        }
        List<String> dotSplit = Splitter.on("...").omitEmptyStrings().splitToList(toParse);
        if (dotSplit.size() == 2) {
            String x = converter.apply(menu, dotSplit.get(0));
            String y = converter.apply(menu, dotSplit.get(1));
            if (StringUtils.isNumeric(x) && StringUtils.isNumeric(y)) {
                for (int slot = slotLimiter.apply(menu, Integer.parseInt(x)); slot <= slotLimiter.apply(menu, Integer.parseInt(y)); slot++) {
                    slots.add(slot);
                }
                return slots;
            }
        }
        return null;
    }
public static Set < Integer > parseSlots ( Menu menu , String input ) { BiFunction < Menu , String , String > converter = ( fMenu , entry ) -> entry . equalsIgnoreCase ( "end" ) || entry . equalsIgnoreCase ( "start" ) ? Integer . toString ( entry . equalsIgnoreCase ( "end" ) ? menu . getRows ( ) * 9 - 1 : 0 ) : entry ; BiFunction < Menu , Integer , Integer > slotLimiter = ( fMenu , slot ) -> slot < 0 ? 0 : Math . min ( slot , menu . getRows ( ) * 9 - 1 ) ; Set < Integer > slots = Sets . newLinkedHashSet ( ) ; String toParse = input . replace ( " " , "" ) ; if ( toParse . equalsIgnoreCase ( "fill" ) ) { for ( int slot = 0 ; slot < menu . getInventory ( ) . getSize ( ) ; slot ++ ) { ItemStack itemStack = menu . getInventory ( ) . getItem ( slot ) ; if ( itemStack == null || itemStack . getType ( ) . equals ( Material . AIR ) ) { slots . add ( slot ) ; } } return slots ; } if ( toParse . equalsIgnoreCase ( "border" ) ) { slots . addAll ( getBorderSlots ( menu ) ) ; return slots ; } List < String > dotSplit = Splitter . on ( "..." ) . omitEmptyStrings ( ) . splitToList ( toParse ) ; if ( dotSplit . size ( ) == 2 ) { String x = converter . apply ( menu , dotSplit . get ( 0 ) ) ; String y = converter . apply ( menu , dotSplit . get ( 1 ) ) ; if ( StringUtils . isNumeric ( x ) && StringUtils . isNumeric ( y ) ) { for ( int slot = slotLimiter . apply ( menu , Integer . parseInt ( x ) ) ; slot <= slotLimiter . apply ( menu , Integer . parseInt ( y ) ) ; slot ++ ) { slots . add ( slot ) ; } return slots ; } } return null ; }
Parses slots from other formats other than slot, slot, slot and can take slot...slot or fill
 @param menu  The menu to get slots from.
Parses slots from other formats other than slot slot slot and can take slot ... slot or fill @param menu The menu to get slots from .