Class NMSClass

java.lang.Object
redempt.redlib.nms.NMSClass

public class NMSClass extends Object
Wraps any class and provides methods for easy reflection
  • Constructor Details

    • NMSClass

      public NMSClass(Class<?> clazz)
      Constructs an NMSClass wrapping the given class
      Parameters:
      clazz - The class to wrap
  • Method Details

    • getName

      public String getName()
      Returns:
      The simple name of the wrapped class
    • getWrappedClass

      public Class<?> getWrappedClass()
      Returns:
      The wrapped class
    • getSuperclass

      public NMSClass getSuperclass()
      Returns:
      The wrapped superclass
    • getInstance

      public NMSObject getInstance(Object... args)
      Calls a constructor of this class with the given arguments
      Parameters:
      args - The arguments to pass to the constructor
      Returns:
      An NMSObject wrapping the returned value
    • createArray

      public NMSArray createArray(int size)
      Creates an array of this class type
      Parameters:
      size - The size of the array
      Returns:
      An NMSArray wrapping the array
    • callStaticMethod

      public NMSObject callStaticMethod(String methodName, Object... args)
      Calls a static method of this class
      Parameters:
      methodName - The name of the static method
      args - The arguments to pass to the static method
      Returns:
      An NMSObject wrapping the returned value from the method
    • getStaticField

      public NMSObject getStaticField(String name)
      Gets the value of a static field in the wrapped class
      Parameters:
      name - The name of the field
      Returns:
      An NMSObject wrapping the field