Search in sources :

Example 1 with SourceTag

use of com.archyx.aureliumskills.source.SourceTag in project AureliumSkills by Archy-X.

the class LootParser method parseSources.

@NotNull
protected Set<Source> parseSources(Map<?, ?> map) {
    if (map.containsKey("sources")) {
        Set<Source> sources = new HashSet<>();
        for (String entry : getStringList(map, "sources")) {
            // Try get source name
            Source source = plugin.getSourceRegistry().valueOf(entry);
            if (source != null) {
                sources.add(source);
            } else {
                // Try to get tag if not found
                SourceTag tag = SourceTag.valueOf(entry.toUpperCase(Locale.ROOT));
                // All all sources in tag
                sources.addAll(plugin.getSourceManager().getTag(tag));
            }
        }
        return sources;
    } else {
        return new HashSet<>();
    }
}
Also used : SourceTag(com.archyx.aureliumskills.source.SourceTag) Source(com.archyx.aureliumskills.source.Source) HashSet(java.util.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Source (com.archyx.aureliumskills.source.Source)1 SourceTag (com.archyx.aureliumskills.source.SourceTag)1 HashSet (java.util.HashSet)1 NotNull (org.jetbrains.annotations.NotNull)1