Package redempt.redlib.nms
Class NMSClass
java.lang.Object
redempt.redlib.nms.NMSClass
Wraps any class and provides methods for easy reflection
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncallStaticMethod
(String methodName, Object... args) Calls a static method of this classcreateArray
(int size) Creates an array of this class typegetInstance
(Object... args) Calls a constructor of this class with the given argumentsgetName()
getStaticField
(String name) Gets the value of a static field in the wrapped classClass<?>
-
Constructor Details
-
NMSClass
Constructs an NMSClass wrapping the given class- Parameters:
clazz
- The class to wrap
-
-
Method Details
-
getName
- Returns:
- The simple name of the wrapped class
-
getWrappedClass
- Returns:
- The wrapped class
-
getSuperclass
- Returns:
- The wrapped superclass
-
getInstance
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
Creates an array of this class type- Parameters:
size
- The size of the array- Returns:
- An NMSArray wrapping the array
-
callStaticMethod
Calls a static method of this class- Parameters:
methodName
- The name of the static methodargs
- The arguments to pass to the static method- Returns:
- An NMSObject wrapping the returned value from the method
-
getStaticField
Gets the value of a static field in the wrapped class- Parameters:
name
- The name of the field- Returns:
- An NMSObject wrapping the field
-