Package ch.njol.skript.aliases
Class AliasesProvider
java.lang.Object
ch.njol.skript.aliases.AliasesProvider
Provides aliases on Bukkit/Spigot platform.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Name of an alias used byaddAlias(AliasName, String, Map, Map)
for registration.static class
Represents a variation of material.static class
-
Constructor Summary
ConstructorDescriptionAliasesProvider
(int expectedCount, @Nullable AliasesProvider parent) Constructs a new aliases provider with no data. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAlias
(AliasesProvider.AliasName name, String id, @Nullable Map<String, Object> tags, Map<String, String> blockStates) Adds an alias to this provider.void
addVariationGroup
(String name, AliasesProvider.VariationGroup group) int
Applies given tags to an item stack.void
@Nullable ItemType
int
@Nullable AliasesMap.AliasData
getAliasData
(ItemData item) @Nullable ch.njol.skript.aliases.MaterialName
getMaterialName
(ItemData item) @Nullable String
getMinecraftId
(ItemData item) @Nullable EntityData
<?> getRelatedEntity
(ItemData item) @Nullable AliasesProvider.VariationGroup
getVariationGroup
(String name) boolean
hasAliasForMaterial
(org.bukkit.Material material) Check if this provider has an alias for the given material.parseMojangson
(String raw) Uses GSON to parse Mojang's JSON format to a map.
-
Constructor Details
-
AliasesProvider
Constructs a new aliases provider with no data.
-
-
Method Details
-
parseMojangson
Uses GSON to parse Mojang's JSON format to a map.- Parameters:
raw
- Raw JSON.- Returns:
- String,Object map.
-
applyTags
Applies given tags to an item stack.- Parameters:
stack
- Item stack.tags
- Tags.- Returns:
- Additional flags for the item.
-
addAlias
public void addAlias(AliasesProvider.AliasName name, String id, @Nullable @Nullable Map<String, Object> tags, Map<String, String> blockStates) Adds an alias to this provider.- Parameters:
name
- Name of alias without any patterns or variation blocks.id
- Id of material.tags
- Tags for material.blockStates
- Block states.
-
addVariationGroup
-
getVariationGroup
-
getAlias
-
getAliasData
-
getMinecraftId
-
getMaterialName
-
getRelatedEntity
-
clearAliases
public void clearAliases() -
getAliasCount
public int getAliasCount() -
hasAliasForMaterial
public boolean hasAliasForMaterial(org.bukkit.Material material) Check if this provider has an alias for the given material.- Parameters:
material
- Material to check alias for- Returns:
- True if this material has an alias
-