Class MaterialConverter


  • public class MaterialConverter
    extends java.lang.Object
    A tool for converting values which may be an old type ID to a Material.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @Nullable org.bukkit.Material convertConfigType​(@NotNull org.bukkit.configuration.ConfigurationSection config, @NotNull java.lang.String path)
      Converts the value in the given config at the given path from a numeric id or flattened material name to a Material.
      static @Nullable org.bukkit.Material convertTypeString​(@Nullable java.lang.String value)
      Converts a string representing a numeric id or flattened material name to a Material.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MaterialConverter

        public MaterialConverter()
    • Method Detail

      • convertConfigType

        @Nullable
        public static @Nullable org.bukkit.Material convertConfigType​(@NotNull
                                                                      @NotNull org.bukkit.configuration.ConfigurationSection config,
                                                                      @NotNull
                                                                      @NotNull java.lang.String path)
        Converts the value in the given config at the given path from a numeric id or flattened material name to a Material.
        Parameters:
        config - The config with the value to convert.
        path - The path of the value in the config.
        Returns:
        The converted Material type or null if no matching type.
      • convertTypeString

        @Nullable
        public static @Nullable org.bukkit.Material convertTypeString​(@Nullable
                                                                      @Nullable java.lang.String value)
        Converts a string representing a numeric id or flattened material name to a Material.
        Parameters:
        value - The value to convert.
        Returns:
        The converted Material type or null if no matching type.