java.lang.Object
tech.guilhermekaua.spigotboot.core.spigot.utils.TypeUtil

public final class TypeUtil extends Object
Author:
Yuhtin Github: https://github.com/Yuhtin
  • Constructor Details

    • TypeUtil

      public TypeUtil()
  • Method Details

    • swapLegacy

      public static org.bukkit.Material swapLegacy(String material, String legacy)
    • convertFromLegacy

      public static org.bukkit.inventory.ItemStack convertFromLegacy(String materialName, int damage)
    • getMaterialFromLegacy

      public static org.bukkit.Material getMaterialFromLegacy(String materialName)
      Resolves a Material from a config name, preferring the modern (non-legacy) material.

      The modern name is tried first so that names such as BEDROCK resolve to Material.BEDROCK instead of LEGACY_BEDROCK on post-flattening servers (1.13+). Only when no modern material matches is a LEGACY_-prefixed lookup attempted, so that pre-1.13 names still resolve. On 1.8.8 (no LEGACY_* constants exist) the first lookup already returns the native material.

      Parameters:
      materialName - the material name from config, may be null or empty
      Returns:
      the resolved material, or null if the name is null, empty, or unknown