diff --git a/README.md b/README.md index a676922..afc7b6c 100644 --- a/README.md +++ b/README.md @@ -12,5 +12,9 @@ This plugin made by me.Please do not claim this plugin as yours, because i put a * English(UK) en-UK * English(US) en-US (default) +# Supported Minecraft Server Version +* Spigot / PaperSpigot 1.14.x +* Spigot / PaperSpigot 1.15.x + # Translate -Want to translate this plugin to other languages?Just start an issue and a pull request and I will check and merge it. +Want to translate this plugin to other languages?Just start an issue and a pull request and I will check and merge it. \ No newline at end of file diff --git a/src/main/java/club/claycoffee/ClayTech/ClayTech.java b/src/main/java/club/claycoffee/ClayTech/ClayTech.java index fc19eda..b10f440 100644 --- a/src/main/java/club/claycoffee/ClayTech/ClayTech.java +++ b/src/main/java/club/claycoffee/ClayTech/ClayTech.java @@ -28,6 +28,9 @@ public class ClayTech extends JavaPlugin implements SlimefunAddon{ public static DataYML currentLangYML; public static FileConfiguration currentLang; public static String highrailspeed; + private static String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; + public static boolean is115 = true; + public static boolean compatible = true; @SuppressWarnings({ "unused", "static-access" }) @Override @@ -93,6 +96,18 @@ public void onEnable() { } currentLangYML.saveCustomConfig(); currentLangYML.reloadCustomConfig(); + switch(version) { + case "v1_15_R1" : break; + case "v1_14_R1" : is115=false;break; + default: compatible=false;break; + } + if(!compatible) { + Utils.info(Lang.readGeneralText("Not_compatible")); + this.getServer().getPluginManager().disablePlugin(this); + } + if(!is115) { + Utils.info(Lang.readGeneralText("Before_115")); + } Utils.info(Lang.readGeneralText("startTip")); Config cfg = new Config(this); Utils.info(Lang.readGeneralText("registeringItems")); diff --git a/src/main/java/club/claycoffee/ClayTech/Defines.java b/src/main/java/club/claycoffee/ClayTech/Defines.java index ba062d3..0ba9346 100644 --- a/src/main/java/club/claycoffee/ClayTech/Defines.java +++ b/src/main/java/club/claycoffee/ClayTech/Defines.java @@ -103,8 +103,6 @@ public class Defines { Lang.readItemLore("SNAIL_HEALTHY")); public static final ItemStack SNAIL_BAD = Utils.setLore(Utils.newItemD(Material.NAUTILUS_SHELL, Lang.readItemText("SNAIL_BAD")), Lang.readItemLore("SNAIL_BAD")); - public static final ItemStack HONEY_SWEET = Utils.setLore(Utils.newItemD(Material.HONEYCOMB, Lang.readItemText("HONEY_SWEET")), - Lang.readItemLore("HONEY_SWEET")); public static final ItemStack HIGHSPEED_RAILWAY = Utils.setLore(Utils.newItemD(Material.POWERED_RAIL, Lang.readItemText("HIGHSPEED_RAILWAY")), Lang.readItemLore("HIGHSPEED_RAILWAY")); public static final ItemStack ELECTRIC_MOTOR_8 = Utils.newItemD(Material.FEATHER, Lang.readItemText("ELECTRIC_MOTOR_8")); @@ -191,4 +189,11 @@ public class Defines { "http://textures.minecraft.net/texture/c74170c66bf3140f234b322add724c5df6949a9209f807ebf86d4f9c8c1e178"), Lang.readItemText("CLAY_ELEMENT_EXTRACTER")), Utils.replaceList(Utils.replaceList(Lang.readItemLore("CLAY_ELEMENT_EXTRACTER"),"%TIER%",LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE).replaceAll("&", "§")),"%POWER%",LoreBuilder.powerBuffer(1024).replaceAll("&", "§"))); + public static ItemStack HONEY_SWEET; + static { + if(ClayTech.is115) { + HONEY_SWEET = Utils.setLore(Utils.newItemD(Material.HONEYCOMB, Lang.readItemText("HONEY_SWEET")), + Lang.readItemLore("HONEY_SWEET")); + } + } } diff --git a/src/main/java/club/claycoffee/ClayTech/Recipes.java b/src/main/java/club/claycoffee/ClayTech/Recipes.java index 96b2c16..cb8d525 100644 --- a/src/main/java/club/claycoffee/ClayTech/Recipes.java +++ b/src/main/java/club/claycoffee/ClayTech/Recipes.java @@ -85,7 +85,12 @@ Defines.ADVANCED_POISON_CORE, Defines.ADVANCED_POISON_CORE, new ItemStack(Materi Defines.TEA_POWDER, Defines.LEMON_POWDER, null, Defines.DRINK_BOTTLE, null }; public final static ItemStack[] TEA_POWDER = {null,null,null,null,Defines.RAW_TEA,null,null,null,null}; public final static ItemStack[] LEMON_POWDER = {null,null,null,null,Defines.LEMON,null,null,null,null}; - public final static ItemStack[] HONEY_SWEET = {new ItemStack(Material.SWEET_BERRIES),new ItemStack(Material.SWEET_BERRIES),new ItemStack(Material.SWEET_BERRIES),new ItemStack(Material.SUGAR),new ItemStack(Material.HONEY_BOTTLE),new ItemStack(Material.SUGAR),new ItemStack(Material.SUGAR),new ItemStack(Material.SUGAR),new ItemStack(Material.SUGAR)}; + public static ItemStack[] HONEY_SWEET; + static { + if(ClayTech.is115) { + HONEY_SWEET = new ItemStack[]{new ItemStack(Material.SWEET_BERRIES),new ItemStack(Material.SWEET_BERRIES),new ItemStack(Material.SWEET_BERRIES),new ItemStack(Material.SUGAR),new ItemStack(Material.HONEY_BOTTLE),new ItemStack(Material.SUGAR),new ItemStack(Material.SUGAR),new ItemStack(Material.SUGAR),new ItemStack(Material.SUGAR)}; + } + } public final static ItemStack[] ELEMENT_CARBON = {null,null,null,null,new ItemStack(Material.COAL,8),null,null,null,null}; public final static ItemStack[] ELEMENT_OXYGEN = { null, null, null, null, new ItemStack(Material.GRASS_BLOCK,3), null, null, null, null }; public final static ItemStack[] ELEMENT_SILICON = {null,null,null,null,new ItemStack(Material.SAND,10),null,null,null,null}; diff --git a/src/main/java/club/claycoffee/ClayTech/items/Foods.java b/src/main/java/club/claycoffee/ClayTech/items/Foods.java index 1459220..4b60588 100644 --- a/src/main/java/club/claycoffee/ClayTech/items/Foods.java +++ b/src/main/java/club/claycoffee/ClayTech/items/Foods.java @@ -34,15 +34,17 @@ public Foods() { RecipeType.NULL, Defines.NORECIPE, false); Slimefunutils.registerItem(Defines.C_FOOD, "SNAIL_FOOD", Defines.SNAIL_FOOD, "notresearch", 10, TRecipe.CLAY_FOOD_CAULDRON, recipef, false); - Slimefunutils.registerItem(Defines.C_FOOD, "HONEY_SWEET", Defines.HONEY_SWEET, "notresearch", 10, - TRecipe.CLAY_FOOD_CAULDRON, Recipes.HONEY_SWEET, false); + if(ClayTech.is115) { + Slimefunutils.registerItem(Defines.C_FOOD, "HONEY_SWEET", Defines.HONEY_SWEET, "notresearch", 10, + TRecipe.CLAY_FOOD_CAULDRON, Recipes.HONEY_SWEET, false); + Research foodII = new Research(new NamespacedKey(ClayTech.plugin, "CLAYTECH_FOODBASIC2"), 9916, Lang.readResearchesText("CLAYTECH_FOOD_II"), 50); + foodII.addItems(SlimefunItem.getByItem(Defines.HONEY_SWEET)); + foodII.register(); + } Research foodI = new Research(new NamespacedKey(ClayTech.plugin, "CLAYTECH_FOODBASIC"), 9911, Lang.readResearchesText("CLAYTECH_FOOD_I"), 50); foodI.addItems(SlimefunItem.getByItem(Defines.CHICKEN_FOOT),SlimefunItem.getByItem(Defines.SPICY_CHICKEN_BURGER),SlimefunItem.getByItem(Defines.BABA_BURGER),SlimefunItem.getByItem(Defines.CHOCOLATE),SlimefunItem.getByItem(Defines.SNAIL_BAD),SlimefunItem.getByItem(Defines.SNAIL_FOOD)); foodI.register(); - Research foodII = new Research(new NamespacedKey(ClayTech.plugin, "CLAYTECH_FOODBASIC2"), 9916, Lang.readResearchesText("CLAYTECH_FOOD_II"), 50); - foodII.addItems(SlimefunItem.getByItem(Defines.HONEY_SWEET)); - foodII.register(); } } diff --git a/src/main/resources/en-UK.yml b/src/main/resources/en-UK.yml index ea1d781..a0f3a5b 100644 --- a/src/main/resources/en-UK.yml +++ b/src/main/resources/en-UK.yml @@ -15,6 +15,8 @@ General: Cant_Eat_Message: "&cYou're already full!" Wash_Message: "&6Completed!" Cant_Wash_Message: "&cYou need a water bucket to do this." + Before_115: "&cYour server api version is before 1.15,the plugin also can run, but might cause some items can't register." + Not_compatible: "&cSorry.The plugin doesn't compatible your server version.Supported Server Version: 1.14.x, 1.15.x.Please upgrade your server!" Categories: Basic: "&bClayTech - Basic" Weapons: "&bClayTech - Weapons" diff --git a/src/main/resources/en-US.yml b/src/main/resources/en-US.yml index ea1d781..a0f3a5b 100644 --- a/src/main/resources/en-US.yml +++ b/src/main/resources/en-US.yml @@ -15,6 +15,8 @@ General: Cant_Eat_Message: "&cYou're already full!" Wash_Message: "&6Completed!" Cant_Wash_Message: "&cYou need a water bucket to do this." + Before_115: "&cYour server api version is before 1.15,the plugin also can run, but might cause some items can't register." + Not_compatible: "&cSorry.The plugin doesn't compatible your server version.Supported Server Version: 1.14.x, 1.15.x.Please upgrade your server!" Categories: Basic: "&bClayTech - Basic" Weapons: "&bClayTech - Weapons" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 29546d3..ede8f8f 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ClayTech main: club.claycoffee.ClayTech.ClayTech version: nightly-20200310 -api-version: 1.15 +api-version: 1.14 depend: [CS-CoreLib, Slimefun] \ No newline at end of file diff --git a/src/main/resources/zh-CN.yml b/src/main/resources/zh-CN.yml index 997e3d0..9ac045c 100644 --- a/src/main/resources/zh-CN.yml +++ b/src/main/resources/zh-CN.yml @@ -15,6 +15,8 @@ General: Cant_Eat_Message: "&c您已经饱了,不用再吃东西了!" Wash_Message: "&6清洗完毕!!" Cant_Wash_Message: "&c无法清洗!你没有水桶!" + Before_115: "&c检测到您的服务器运行在1.15版本以下,可能导致有的物品无法注册,但仍可正常运行本插件." + Not_compatible: "&c对不起,本插件仅限1.14.x,1.15.x的服务器使用!请尽快升级您的服务器.." Categories: Basic: "&b粘土科技 - 基础" Weapons: "&b粘土科技 - 武器" diff --git a/src/main/resources/zh-TW.yml b/src/main/resources/zh-TW.yml index 4eeb26e..c672430 100644 --- a/src/main/resources/zh-TW.yml +++ b/src/main/resources/zh-TW.yml @@ -15,6 +15,8 @@ General: Cant_Eat_Message: "&c您已經飽了,不用再吃東西了!" Wash_Message: "&6清洗完畢!!" Cant_Wash_Message: "&c無法清洗!妳沒有水桶!" + Before_115: "&c檢測到您的伺服器運行在1.15版本以下,可能導致有的物品無法註冊,但仍可正常運行本插件." + Not_compatible: "&c對不起,本挿件僅限1.14.x,1.15.x的伺服器使用!請儘快陞級您的伺服器.." Categories: Basic: "&b粘土科技 - 基礎" Weapons: "&b粘土科技 - 武器"