Package ch.njol.skript.aliases
Class AliasesParser
java.lang.Object
ch.njol.skript.aliases.AliasesParser
Parses aliases.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected AliasesProvider
Aliases provider, which takes the aliases and variations we parse. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
Fixes an alias name by trimming it and removing all extraneous spaces between the words.protected NonNullPair<String,String>
getAliasPlural(String name)
Gets singular and plural forms for given name.void
load(SectionNode root)
Loads aliases from a section node.protected void
Loads an alias with given name (key pattern) and data (material id and tags).protected void
loadSingleAlias(Map<String,AliasesProvider.Variation> variations, String item)
protected @Nullable AliasesProvider.VariationGroup
loadVariations(SectionNode root)
Loads variations from a section node.parseBlockStates(String input)
Parses block states from string input to a map.parseKeyPattern(String name)
Parses alias key pattern using some black magic.protected Map<String,AliasesProvider.Variation>
parseKeyVariations(String name)
Parses all possible variations from given name.protected AliasesProvider.Variation
parseVariation(String item)
Parses a single variation from a string.void
registerCondition(String name, Function<String,Boolean> condition)
-
Field Details
-
provider
Aliases provider, which takes the aliases and variations we parse.
-
-
Constructor Details
-
AliasesParser
-
-
Method Details
-
load
Loads aliases from a section node.- Parameters:
root
- Root section node for us to load.
-
parseBlockStates
Parses block states from string input to a map.- Parameters:
input
- Block states as used in Vanilla commands.- Returns:
- Them put to a map.
-
loadVariations
Loads variations from a section node.- Parameters:
root
- Root node for this variation.- Returns:
- Group of variations.
-
parseVariation
Parses a single variation from a string.- Parameters:
item
- Raw variation info.- Returns:
- Variation instance.
-
parseKeyPattern
Parses alias key pattern using some black magic.- Parameters:
name
- Key/name of alias.- Returns:
- All strings that match aliases with this pattern.
-
parseKeyVariations
Parses all possible variations from given name.- Parameters:
name
- Name which might contain variations.- Returns:
- Map of variations.
-
loadAlias
Loads an alias with given name (key pattern) and data (material id and tags).- Parameters:
name
- Name of alias.data
- Data of alias.
-
getAliasPlural
Gets singular and plural forms for given name. This might work slightly differently fromNoun.getPlural(String)
, to ensure it meets specification of aliases.- Parameters:
name
- Name to get forms from.- Returns:
- Singular form, plural form.
-
loadSingleAlias
-
fixName
Fixes an alias name by trimming it and removing all extraneous spaces between the words.- Parameters:
name
- Name to be fixed.- Returns:
- Name fixed.
-
registerCondition
-