public final class NmsUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
major |
static int |
minor |
static String |
version |
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
getCraftClass(String path) |
static Class<?> |
getNmsClass(String className,
boolean required)
Use
getNmsClass(String, String, boolean) to make sure of compatibility with mc 1.17+. |
static Class<?> |
getNmsClass(String className,
String post17middlePackage,
boolean required) |
static String |
itemToJson(org.bukkit.inventory.ItemStack item) |
static Object |
nmsCopy(org.bukkit.inventory.ItemStack item)
Creates a NMS copy of the parameter
|
static Object |
toNms(org.bukkit.entity.Player player)
Gets the EntityPlayer handled by the argument
|
public static final String version
public static final int major
public static final int minor
public static String itemToJson(org.bukkit.inventory.ItemStack item)
public static Object toNms(org.bukkit.entity.Player player) throws InvocationTargetException, IllegalAccessException
player - the Player handlerInvocationTargetException - when some problems are found with the
reflectionIllegalAccessException - when some problems are found with the
reflectionpublic static Object nmsCopy(org.bukkit.inventory.ItemStack item) throws InvocationTargetException, IllegalAccessException
item - the ItemStack to be nms-copiedInvocationTargetException - when some problems are found with the
reflectionIllegalAccessException - when some problems are found with the
reflectionpublic static Class<?> getNmsClass(String className, boolean required)
getNmsClass(String, String, boolean) to make sure of compatibility with mc 1.17+.className - The simple name of the classrequired - If true a RuntimeException will be thrown when the class cannot be foundpublic static Class<?> getNmsClass(String className, String post17middlePackage, boolean required)
className - The simple name of the classpost17middlePackage - The package the class have been relocated to after mc 1.17required - If true a RuntimeException will be thrown when the class cannot be foundnet.minecraft.server.$className if pre 1.17 or net.minecraft.$post17middlePackage.$className if v1.17+Copyright © 2021. All rights reserved.