This commit is contained in:
Auxilor 2020-11-06 11:30:16 +00:00
parent 97f7fe8198
commit 0454d25008
4 changed files with 4 additions and 7 deletions

View File

@ -24,7 +24,7 @@ public class EcoEnchantsPlugin extends JavaPlugin {
/**
* NMS version
*/
public static final String nmsVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
public static final String NMS_VERSION = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
/**
* ProtocolLib

View File

@ -54,7 +54,7 @@ public final class PacketOpenWindowMerchant extends AbstractPacketAdapter {
modifiersField.setInt(fSelling, fSelling.getModifiers() & ~Modifier.FINAL);
// Reflectively access CraftItemStack.class for respective version
Class<?> craftItemStack = Class.forName("org.bukkit.craftbukkit." + EcoEnchantsPlugin.nmsVersion + ".inventory.CraftItemStack");
Class<?> craftItemStack = Class.forName("org.bukkit.craftbukkit." + EcoEnchantsPlugin.NMS_VERSION + ".inventory.CraftItemStack");
// Bukkit Result ItemStack from NMS Result ItemStack
ItemStack nmsSelling = (ItemStack) craftItemStack.getMethod("asBukkitCopy", selling.getClass()).invoke(null, selling);

View File

@ -10,7 +10,7 @@ public class BlockBreak {
public static boolean init() {
try {
final Class<?> class2 = Class.forName("com.willfp.ecoenchants." + EcoEnchantsPlugin.nmsVersion + ".BlockBreak");
final Class<?> class2 = Class.forName("com.willfp.ecoenchants." + EcoEnchantsPlugin.NMS_VERSION + ".BlockBreak");
if (BlockBreakWrapper.class.isAssignableFrom(class2)) {
blockBreakWrapper = (BlockBreakWrapper) class2.getConstructor().newInstance();
}

View File

@ -1,10 +1,7 @@
package com.willfp.ecoenchants.nms;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.nms.API.BlockBreakWrapper;
import com.willfp.ecoenchants.nms.API.RepairCostWrapper;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class RepairCost {
@ -12,7 +9,7 @@ public class RepairCost {
public static boolean init() {
try {
final Class<?> class2 = Class.forName("com.willfp.ecoenchants." + EcoEnchantsPlugin.nmsVersion + ".RepairCost");
final Class<?> class2 = Class.forName("com.willfp.ecoenchants." + EcoEnchantsPlugin.NMS_VERSION + ".RepairCost");
if (RepairCostWrapper.class.isAssignableFrom(class2)) {
repairCostWrapper = (RepairCostWrapper) class2.getConstructor().newInstance();
}