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

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_15_R1;
package com.willfp.ecoenchants.nms.v1_15_R1;
import com.willfp.ecoenchants.nms.api.BlockBreakWrapper;
import net.minecraft.server.v1_15_R1.BlockPosition;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_15_R1;
package com.willfp.ecoenchants.nms.v1_15_R1;
import com.willfp.ecoenchants.nms.api.ChatComponentWrapper;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_15_R1;
package com.willfp.ecoenchants.nms.v1_15_R1;
import com.willfp.ecoenchants.nms.api.CooldownWrapper;
import net.minecraft.server.v1_15_R1.EntityHuman;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_15_R1;
package com.willfp.ecoenchants.nms.v1_15_R1;
import com.willfp.ecoenchants.nms.api.OpenInventoryWrapper;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_15_R1;
package com.willfp.ecoenchants.nms.v1_15_R1;
import com.willfp.ecoenchants.nms.api.RepairCostWrapper;
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_15_R1;
package com.willfp.ecoenchants.nms.v1_15_R1;
import com.willfp.ecoenchants.nms.api.TridentStackWrapper;
import net.minecraft.server.v1_15_R1.EntityThrownTrident;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R1;
package com.willfp.ecoenchants.nms.v1_16_R1;
import com.willfp.ecoenchants.nms.api.BlockBreakWrapper;
import net.minecraft.server.v1_16_R1.BlockPosition;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R1;
package com.willfp.ecoenchants.nms.v1_16_R1;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R1;
package com.willfp.ecoenchants.nms.v1_16_R1;
import com.willfp.ecoenchants.nms.api.CooldownWrapper;
import org.bukkit.entity.Player;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R1;
package com.willfp.ecoenchants.nms.v1_16_R1;
import com.willfp.ecoenchants.nms.api.OpenInventoryWrapper;
import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R1;
package com.willfp.ecoenchants.nms.v1_16_R1;
import com.willfp.ecoenchants.nms.api.RepairCostWrapper;
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R1;
package com.willfp.ecoenchants.nms.v1_16_R1;
import com.willfp.ecoenchants.nms.api.TridentStackWrapper;
import net.minecraft.server.v1_16_R1.EntityThrownTrident;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R2;
package com.willfp.ecoenchants.nms.v1_16_R2;
import com.willfp.ecoenchants.nms.api.BlockBreakWrapper;
import net.minecraft.server.v1_16_R2.BlockPosition;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R2;
package com.willfp.ecoenchants.nms.v1_16_R2;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R2;
package com.willfp.ecoenchants.nms.v1_16_R2;
import com.willfp.ecoenchants.nms.api.CooldownWrapper;
import org.bukkit.entity.Player;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R2;
package com.willfp.ecoenchants.nms.v1_16_R2;
import com.willfp.ecoenchants.nms.api.OpenInventoryWrapper;
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R2;
package com.willfp.ecoenchants.nms.v1_16_R2;
import com.willfp.ecoenchants.nms.api.RepairCostWrapper;
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R2;
package com.willfp.ecoenchants.nms.v1_16_R2;
import com.willfp.ecoenchants.nms.api.TridentStackWrapper;
import net.minecraft.server.v1_16_R2.EntityThrownTrident;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R3;
package com.willfp.ecoenchants.nms.v1_16_R3;
import com.willfp.ecoenchants.nms.api.BlockBreakWrapper;
import net.minecraft.server.v1_16_R3.BlockPosition;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R3;
package com.willfp.ecoenchants.nms.v1_16_R3;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R3;
package com.willfp.ecoenchants.nms.v1_16_R3;
import com.willfp.ecoenchants.nms.api.CooldownWrapper;
import org.bukkit.entity.Player;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R3;
package com.willfp.ecoenchants.nms.v1_16_R3;
import com.willfp.ecoenchants.nms.api.OpenInventoryWrapper;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R3;
package com.willfp.ecoenchants.nms.v1_16_R3;
import com.willfp.ecoenchants.nms.api.RepairCostWrapper;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.v1_16_R3;
package com.willfp.ecoenchants.nms.v1_16_R3;
import com.willfp.ecoenchants.nms.api.TridentStackWrapper;
import net.minecraft.server.v1_16_R3.EntityThrownTrident;

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
*/