Refactored NMS packages

This commit is contained in:
Auxilor
2020-12-11 18:34:36 +00:00
parent 1f958e5eb9
commit f2c100538b
31 changed files with 44 additions and 30 deletions

View File

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

View File

@@ -27,7 +27,7 @@ public class ChatComponent {
static {
try {
final Class<?> class2 = Class.forName("com.willfp.ecoenchants." + EcoEnchantsPlugin.NMS_VERSION + ".ChatComponent");
final Class<?> class2 = Class.forName("com.willfp.ecoenchants.nms." + EcoEnchantsPlugin.NMS_VERSION + ".ChatComponent");
if (ChatComponentWrapper.class.isAssignableFrom(class2)) {
chatComponentWrapper = (ChatComponentWrapper) class2.getConstructor().newInstance();
}

View File

@@ -25,7 +25,7 @@ public class Cooldown {
static {
try {
final Class<?> class2 = Class.forName("com.willfp.ecoenchants." + EcoEnchantsPlugin.NMS_VERSION + ".Cooldown");
final Class<?> class2 = Class.forName("com.willfp.ecoenchants.nms." + EcoEnchantsPlugin.NMS_VERSION + ".Cooldown");
if (CooldownWrapper.class.isAssignableFrom(class2)) {
cooldown = (CooldownWrapper) class2.getConstructor().newInstance();
}

View File

@@ -24,7 +24,7 @@ public class OpenInventory {
static {
try {
final Class<?> class2 = Class.forName("com.willfp.ecoenchants." + EcoEnchantsPlugin.NMS_VERSION + ".OpenInventory");
final Class<?> class2 = Class.forName("com.willfp.ecoenchants.nms." + EcoEnchantsPlugin.NMS_VERSION + ".OpenInventory");
if (OpenInventoryWrapper.class.isAssignableFrom(class2)) {
openInventoryWrapper = (OpenInventoryWrapper) class2.getConstructor().newInstance();
}

View File

@@ -35,7 +35,7 @@ public class RepairCost {
static {
try {
final Class<?> class2 = Class.forName("com.willfp.ecoenchants." + EcoEnchantsPlugin.NMS_VERSION + ".RepairCost");
final Class<?> class2 = Class.forName("com.willfp.ecoenchants.nms." + EcoEnchantsPlugin.NMS_VERSION + ".RepairCost");
if (RepairCostWrapper.class.isAssignableFrom(class2)) {
repairCostWrapper = (RepairCostWrapper) class2.getConstructor().newInstance();
}

View File

@@ -26,7 +26,7 @@ public class TridentStack {
static {
try {
final Class<?> class2 = Class.forName("com.willfp.ecoenchants." + EcoEnchantsPlugin.NMS_VERSION + ".TridentStack");
final Class<?> class2 = Class.forName("com.willfp.ecoenchants.nms." + EcoEnchantsPlugin.NMS_VERSION + ".TridentStack");
if (TridentStackWrapper.class.isAssignableFrom(class2)) {
tridentStackWrapper = (TridentStackWrapper) class2.getConstructor().newInstance();
}

View File

@@ -80,6 +80,20 @@ public class Loader {
Logger.info("");
Logger.info("==========================================");
/*
Check server version is supported
*/
if(!Arrays.asList(
"v1_15_R1",
"v1_16_R1",
"v1_16_R2",
"v1_16_R3"
).contains(EcoEnchantsPlugin.NMS_VERSION)) {
Logger.error("Your server version (" + EcoEnchantsPlugin.NMS_VERSION + ") is not supported!");
Bukkit.getPluginManager().disablePlugin(EcoEnchantsPlugin.getInstance());
}
/*
Load Configs
*/