Class PersistentDataUtils

java.lang.Object
net.paulem.arcana.utils.PersistentDataUtils

public class PersistentDataUtils extends Object
Utility methods for working with Bukkit's PersistentDataType system.
  • Constructor Details

    • PersistentDataUtils

      public PersistentDataUtils()
  • Method Details

    • getCorrespondType

      public static <P, C> org.bukkit.persistence.PersistentDataType<P,C> getCorrespondType(C constable)
      Resolves the built-in PersistentDataType that corresponds to the runtime type of the given value. Supports Byte, Short, Integer, Long, Float, Double, Boolean, String, byte[], int[] and long[].
      Type Parameters:
      P - the primitive persistent data type
      C - the complex/runtime type of the value
      Parameters:
      constable - a sample value whose type determines the returned PersistentDataType
      Returns:
      the PersistentDataType matching the runtime type of constable
      Throws:
      IllegalArgumentException - if constable is null or its type is not supported