src/main/java/me/hyfe/simplespigot/menu/service/MenuService.java
/**
     * Parses the slots a user has specified in a single string (slot,slot,slot,slot)
     *
     * @param menu   The menu to get slots for.
     * @param config The config to get the slots from.
     * @param prefix The location before the "slots" section, e.g menu.items.
     * @param id     The ID of the specific item, e.g menu-item (from example resulting in menu.items.menu-item.slots after code).
     * @return The slots specified after parsing is done.
     */
Parses the slots a user has specified in a single string (slot,slot,slot,slot)
@param menu   The menu to get slots for.
@param config The config to get the slots from.
@param prefix The location before the "slots" section, e.g menu.items.
@param id     The ID of the specific item, e.g menu-item (from example resulting in menu.items.menu-item.slots after code).
@return The slots specified after parsing is done.
Parses the slots a user has specified in a single string ( slot slot slot slot ) @param menu The menu to get slots for . @param config The config to get the slots from . @param prefix The location before the " slots " section e . g menu . items . @param id The ID of the specific item e . g menu - item ( from example resulting in menu . items . menu - item . slots after code ) . @return The slots specified after parsing is done .
public static Set<Integer> parseSlots(Menu menu, Config config, String prefix, String id) {
        Stack<Integer> slots = new Stack<>();
        if (StringUtils.isNumeric(id)) {
            return Sets.newHashSet(Integer.parseInt(id));
        }
        String subParse = config.string(String.format("%s.slots", prefix.concat(id))).replace(" ", "");
        Set<Integer> parsedSlots = parseSlots(menu, subParse);
        if (parsedSlots != null) {
            return parsedSlots;
        }
        List<String> commaSplit = Splitter.on(",").omitEmptyStrings().splitToList(subParse);
        if (commaSplit.size() > 0) {
            for (String toParse : commaSplit) {
                if (StringUtils.isNumeric(toParse)) {
                    slots.add(Integer.parseInt(toParse));
                }
                Set<Integer> wrappedParsedSlots = parseSlots(menu, toParse);
                if (wrappedParsedSlots != null) {
                    slots.addAll(wrappedParsedSlots);
                }
            }
            return Sets.newLinkedHashSet(slots);
        }
        return Sets.newHashSet(slots);
    }
public static Set < Integer > parseSlots ( Menu menu , Config config , String prefix , String id ) { Stack < Integer > slots = new Stack < > ( ) ; if ( StringUtils . isNumeric ( id ) ) { return Sets . newHashSet ( Integer . parseInt ( id ) ) ; } String subParse = config . string ( String . format ( "%s.slots" , prefix . concat ( id ) ) ) . replace ( " " , "" ) ; Set < Integer > parsedSlots = parseSlots ( menu , subParse ) ; if ( parsedSlots != null ) { return parsedSlots ; } List < String > commaSplit = Splitter . on ( "," ) . omitEmptyStrings ( ) . splitToList ( subParse ) ; if ( commaSplit . size ( ) > 0 ) { for ( String toParse : commaSplit ) { if ( StringUtils . isNumeric ( toParse ) ) { slots . add ( Integer . parseInt ( toParse ) ) ; } Set < Integer > wrappedParsedSlots = parseSlots ( menu , toParse ) ; if ( wrappedParsedSlots != null ) { slots . addAll ( wrappedParsedSlots ) ; } } return Sets . newLinkedHashSet ( slots ) ; } return Sets . newHashSet ( slots ) ; }
Parses the slots a user has specified in a single string (slot,slot,slot,slot)
 @param menu   The menu to get slots for.
Parses the slots a user has specified in a single string ( slot slot slot slot ) @param menu The menu to get slots for .