Deprecate the method NMSUtils#getCraftClass in favor of ClassMapping

This commit is contained in:
Christian Koop 2021-12-07 16:41:31 +01:00
parent d7010d7483
commit de06070dac
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
3 changed files with 9 additions and 5 deletions

View File

@ -194,10 +194,10 @@ public class ItemUtils {
return tool.getDurability() + requiredAmount <= tool.getType().getMaxDurability();
}
static Class cb_ItemStack = NMSUtils.getCraftClass("inventory.CraftItemStack");
static Class mc_ItemStack = ClassMapping.ITEM_STACK.getClazz();
static Class mc_NBTTagCompound = ClassMapping.NBT_TAG_COMPOUND.getClazz();
static Class mc_NBTTagList = ClassMapping.NBT_TAG_LIST.getClazz();
static Class<?> cb_ItemStack = ClassMapping.CRAFT_ITEM_STACK.getClazz();
static Class<?> mc_ItemStack = ClassMapping.ITEM_STACK.getClazz();
static Class<?> mc_NBTTagCompound = ClassMapping.NBT_TAG_COMPOUND.getClazz();
static Class<?> mc_NBTTagList = ClassMapping.NBT_TAG_LIST.getClazz();
static Method mc_ItemStack_getTag;
static Method mc_ItemStack_setTag;
static Method mc_NBTTagCompound_set;

View File

@ -8,6 +8,10 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class NMSUtils {
/**
* @deprecated Use {@link ClassMapping} instead
*/
@Deprecated
public static Class<?> getCraftClass(String className) {
try {
String fullName = "org.bukkit.craftbukkit." + ServerVersion.getServerVersionString() + "." + className;

View File

@ -22,7 +22,7 @@ public class SWorldBorder {
static {
try {
worldBorderClass = ClassMapping.WORLD_BORDER.getClazz();
craftWorldClass = NMSUtils.getCraftClass("CraftWorld");
craftWorldClass = ClassMapping.CRAFT_WORLD.getClazz();
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_17)) {
Class<?> clientboundInitializeBorderPacketClass = ClassMapping.CLIENTBOUND_INITIALIZE_BORDER_PACKET.getClazz();