Class Aliases

java.lang.Object
ch.njol.skript.aliases.Aliases

public abstract class Aliases extends Object
  • Constructor Details

    • Aliases

      public Aliases()
  • Method Details

    • getMaterialName

      public static String getMaterialName(ItemData type, boolean plural)
    • getGender

      public static int getGender(ItemData item)
      Returns:
      The item's gender or -1 if no name is found
    • parseAlias

      public static @Nullable ItemType parseAlias(String s)
      Parses an ItemType to be used as an alias, i.e. it doesn't parse 'all'/'every' and the amount.
      Parameters:
      s - mixed case string
      Returns:
      A new ItemType representing the given value
    • parseItemType

      public static @Nullable ItemType parseItemType(String s)
      Parses an ItemType.

      Prints errors.

      Parameters:
      s -
      Returns:
      The parsed ItemType or null if the input is invalid.
    • clear

      public static void clear()
      Clears aliases. Make sure to load them after this!
    • load

      public static void load()
      Loads aliases from Skript's standard locations. Exceptions will be logged, but not thrown.
    • loadDirectory

      public static void loadDirectory(Path dir) throws IOException
      Loads aliases from given directory.
      Parameters:
      dir - Directory of aliases.
      Throws:
      IOException - If something goes wrong with loading.
    • load

      public static void load(Path f) throws IOException
      Loads aliases from given path.
      Parameters:
      f - Path of alias file.
      Throws:
      IOException - If something goes wrong with loading.
    • load

      public static void load(Config config)
      Loads aliases from configuration.
      Parameters:
      config - Configuration containing the aliases.
    • getMinecraftId

      public static @Nullable String getMinecraftId(ItemData data)
      Gets a Vanilla Minecraft material id for given item data.
      Parameters:
      data - Item data.
      Returns:
      Minecraft item id or null.
    • getRelatedEntity

      public static @Nullable EntityData<?> getRelatedEntity(ItemData data)
      Gets an entity type related to given item. For example, an armor stand item is related with armor stand entity.
      Parameters:
      data - Item data.
      Returns:
      Entity type or null.
    • javaItemType

      public static ItemType javaItemType(String name)
      Gets an item type that matches the given name. If it doesn't exist, an exception is thrown instead.

      Item types provided by this method are updated when aliases are reloaded. However, this also means they are tracked by aliases system and NOT necessarily garbage-collected.

      Parameters:
      name - Name of item to search from aliases.
      Returns:
      An item.
      Throws:
      IllegalArgumentException - When item is not found.
    • getAddonProvider

      public static AliasesProvider getAddonProvider(@Nullable SkriptAddon addon)
      Creates an aliases provider to be used by given addon. It can be used to register aliases and variations to be used in scripts.
      Parameters:
      addon - Skript addon.
      Returns:
      Aliases provider.
    • createScriptAliases

      public static ScriptAliases createScriptAliases(Script script)
      Creates script aliases for the provided Script.
      Returns:
      Script aliases that are ready to be added to.
    • getScriptAliases

      public static @Nullable ScriptAliases getScriptAliases(Script script)
      Method for obtaining the ScriptAliases instance of a Script.
      Parameters:
      script - The script to obtain aliases from.
      Returns:
      The obtained aliases, or null if the script has no custom aliases.