Java Code Examples for org.bukkit.block.banner.PatternType#values()

The following examples show how to use org.bukkit.block.banner.PatternType#values() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemBuilder.java    From Crazy-Crates with MIT License 6 votes vote down vote up
public ItemBuilder addPattern(String stringPattern) {
    try {
        String[] split = stringPattern.split(":");
        for (PatternType pattern : PatternType.values()) {
            if (split[0].equalsIgnoreCase(pattern.name()) || split[0].equalsIgnoreCase(pattern.getIdentifier())) {
                DyeColor color = getDyeColor(split[1]);
                if (color != null) {
                    addPattern(new Pattern(color, pattern));
                }
                break;
            }
        }
    } catch (Exception e) {
    }
    return this;
}
 
Example 2
Source File: BannerUtils.java    From NovaGuilds with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Gets random pattern type
 *
 * @return pattern type
 */
protected static PatternType randomPatternType() {
	return PatternType.values()[NumberUtils.randInt(0, PatternType.values().length - 1)];
}