From 89413057ccc4df58326eb927873116a684aa383c Mon Sep 17 00:00:00 2001 From: DroppingAnvil Date: Mon, 16 Sep 2019 12:51:58 -0500 Subject: [PATCH 1/3] Fixed some default Faction Upgrades materials not being compatible with 1.14 --- src/main/java/com/massivecraft/factions/FactionsPlugin.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/FactionsPlugin.java b/src/main/java/com/massivecraft/factions/FactionsPlugin.java index 637a81b4..86b27fca 100755 --- a/src/main/java/com/massivecraft/factions/FactionsPlugin.java +++ b/src/main/java/com/massivecraft/factions/FactionsPlugin.java @@ -182,6 +182,12 @@ public class FactionsPlugin extends MPlugin { this.loadSuccessful = false; saveDefaultConfig(); + if (mc114) { + if (getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Type").equals("EXP_BOTTLE")) getConfig().set("fupgrades.MainMenu.EXP.EXPItem.Type", "EXPERIENCE_BOTTLE"); + if (getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Type").equals("MOB_SPAWNER")) getConfig().set("fupgrades.MainMenu.Spawners.SpawnerItem.Type", "SPAWNER"); + if (getConfig().getString("fupgrades.MainMenu.DamageReduct.ReduceItem.Type").equals("GOLD_CHESTPLATE")) getConfig().set("fupgrades.MainMenu.DamageReduct.ReduceItem.Type", "GOLDEN_CHESTPLATE"); + if (getConfig().getString("fupgrades.MainMenu.Warps.WarpItem.Type").equals("EYE_OF_ENDER")) getConfig().set("fupgrades.MainMenu.Warps.WarpItem.Type", "ENDER_EYE"); + } // Load Conf from disk Conf.load(); From bc00a5ebd7bd0b60e886d1f9708614dc539e945d Mon Sep 17 00:00:00 2001 From: DroppingAnvil Date: Mon, 16 Sep 2019 13:37:25 -0500 Subject: [PATCH 2/3] Changed Faction Upgrades GUI to XMaterial --- .../zcore/fupgrades/FUpgradesGUI.java | 51 +++++++++---------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java index f2e990aa..7a2ed263 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java @@ -337,9 +337,9 @@ public class FUpgradesGUI implements Listener { expItem.setAmount(expLevel); } - Material spawnerMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Type")); + byte spawnerData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Damage")); + Material spawnerMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Type"), spawnerData); int spawnerAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Amount"); - short spawnerData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Damage") + ""); String spawnerName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Name")); List spawnerLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.Spawners.SpawnerItem.Lore")); int spawnerLevel = fme.getFaction().getUpgrade(UpgradeType.SPAWNER); @@ -349,9 +349,9 @@ public class FUpgradesGUI implements Listener { } - Material cropMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Type")); + byte cropData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Damage")); + Material cropMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Type"), cropData); int cropAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Amount"); - short cropData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Damage") + ""); String cropName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Name")); List cropLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.Crops.CropItem.Lore")); int cropLevel = fme.getFaction().getUpgrade(UpgradeType.CROP); @@ -388,10 +388,9 @@ public class FUpgradesGUI implements Listener { spawnerItem.setItemMeta(itemMeta); spawnerItem.setAmount(spawnerLevel); } - - Material chestMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Type")); - int chesttAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Amount"); - short chestData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Damage") + ""); + byte chestData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Damage")); + Material chestMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Type"), chestData); + int chestAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Amount"); String chestName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Name", "&e&lUpgrade Chest Size")); List chestLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.Chest.ChestItem.Lore")); int chestlevel = fme.getFaction().getUpgrade(UpgradeType.CHEST); @@ -402,7 +401,7 @@ public class FUpgradesGUI implements Listener { chestLore.set(i, line); } - ItemStack chestItem = FactionsPlugin.getInstance().createItem(chestMaterial, chesttAmt, chestData, chestName, chestLore); + ItemStack chestItem = FactionsPlugin.getInstance().createItem(chestMaterial, chestAmt, chestData, chestName, chestLore); if (chestlevel >= 1) { ItemMeta itemMeta = chestItem.getItemMeta(); @@ -415,9 +414,9 @@ public class FUpgradesGUI implements Listener { chestItem.setAmount(chestlevel); } - Material memberMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Members.MembersItem.Type")); + byte memberData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Members.MembersItem.Damage")); + Material memberMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Members.MembersItem.Type"), memberData); int memberAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Members.MembersItem.Amount"); - short memberData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Members.MembersItem.Damage") + ""); String memberName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Members.MembersItem.Name", "&e&lUpgrade Member Size")); List memberLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.Members.MembersItem.Lore")); int memberlevel = fme.getFaction().getUpgrade(UpgradeType.MEMBERS); @@ -441,9 +440,9 @@ public class FUpgradesGUI implements Listener { memberItem.setAmount(memberlevel); } - Material powerMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Power.PowerItem.Type")); + byte powerData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Power.PowerItem.Damage")); + Material powerMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Power.PowerItem.Type"), powerData); int powerAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Power.PowerItem.Amount"); - short powerData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Power.PowerItem.Damage") + ""); String powerName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Power.PowerItem.Name")); List powerLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.Power.PowerItem.Lore")); int powerLevel = fme.getFaction().getUpgrade(UpgradeType.POWER); @@ -468,9 +467,9 @@ public class FUpgradesGUI implements Listener { powerItem.setAmount(powerLevel); } - Material redMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Redstone.RedstoneItem.Type")); + byte redData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.RedstoneItem.Damage")); + Material redMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Redstone.RedstoneItem.Type"), redData); int redAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.RedstoneItem.Amount"); - short redData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.RedstoneItem.Damage") + ""); String redName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Redstone.RedstoneItem.Name")); List redLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.Redstone.RedstoneItem.Lore")); int redLevel = fme.getFaction().getUpgrade(UpgradeType.REDSTONE); @@ -494,9 +493,9 @@ public class FUpgradesGUI implements Listener { redItem.setAmount(redLevel); } - Material reduceMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageReduct.ReduceItem.Type")); + byte reduceData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageReduct.ReduceItem.Damage")); + Material reduceMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageReduct.ReduceItem.Type"), reduceData); int reduceAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageReduct.ReduceItem.Amount"); - short reduceData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageReduct.ReduceItem.Damage") + ""); String reduceName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageReduct.ReduceItem.Name")); List reduceLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.DamageReduct.ReduceItem.Lore")); int reduceLevel = fme.getFaction().getUpgrade(UpgradeType.DAMAGEDECREASE); @@ -521,9 +520,9 @@ public class FUpgradesGUI implements Listener { reduceItem.setAmount(reduceLevel); } - Material increaseMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Type")); + byte increaseData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Damage")); + Material increaseMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Type"), increaseData); int increaseAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Amount"); - short increaseData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Damage") + ""); String increaseName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Name")); List increaseLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Lore")); int increaseLevel = fme.getFaction().getUpgrade(UpgradeType.DAMAGEINCREASE); @@ -547,10 +546,9 @@ public class FUpgradesGUI implements Listener { increaseItem.setAmount(increaseLevel); } - - Material tntMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.TNT.TntItem.Type")); + byte tntData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.TNT.TntItem.Damage")); + Material tntMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.TNT.TntItem.Type"), tntData); int tntAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.TNT.TntItem.Amount"); - short tntData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.TNT.TntItem.Damage") + ""); String tntName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.TNT.TntItem.Name")); List tntLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.TNT.TntItem.Lore")); int tntLevel = fme.getFaction().getUpgrade(UpgradeType.TNT); @@ -574,10 +572,9 @@ public class FUpgradesGUI implements Listener { tntItem.setAmount(tntLevel); } - - Material warpMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Warps.WarpItem.Type")); + byte warpData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Warps.WarpItem.Damage")); + Material warpMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Warps.WarpItem.Type"), warpData); int warpAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Warps.WarpItem.Amount"); - short warpData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Warps.WarpItem.Damage") + ""); String warpName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Warps.WarpItem.Name")); List warpLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.Warps.WarpItem.Lore")); int warpLevel = fme.getFaction().getUpgrade(UpgradeType.WARP); @@ -602,9 +599,9 @@ public class FUpgradesGUI implements Listener { warpItem.setAmount(warpLevel); } - Material armorMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Armor.ArmorItem.Type")); + byte armorData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Armor.ArmorItem.Damage")); + Material armorMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Armor.ArmorItem.Type"), warpData); int armorAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Armor.ArmorItem.Amount"); - short armorData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Armor.ArmorItem.Damage") + ""); String armorName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Armor.ArmorItem.Name")); List armorLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.Armor.ArmorItem.Lore")); int armorLevel = fme.getFaction().getUpgrade(UpgradeType.REINFORCEDARMOR); From b29dd6458133dcbce83b3ae930c5196fdc1351eb Mon Sep 17 00:00:00 2001 From: DroppingAnvil Date: Mon, 16 Sep 2019 13:45:41 -0500 Subject: [PATCH 3/3] Removed my old conversion code for 1.14 since transitioned to XMaterial. XMaterial support added for EXP upgrade --- src/main/java/com/massivecraft/factions/FactionsPlugin.java | 6 ------ .../massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/FactionsPlugin.java b/src/main/java/com/massivecraft/factions/FactionsPlugin.java index 86b27fca..637a81b4 100755 --- a/src/main/java/com/massivecraft/factions/FactionsPlugin.java +++ b/src/main/java/com/massivecraft/factions/FactionsPlugin.java @@ -182,12 +182,6 @@ public class FactionsPlugin extends MPlugin { this.loadSuccessful = false; saveDefaultConfig(); - if (mc114) { - if (getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Type").equals("EXP_BOTTLE")) getConfig().set("fupgrades.MainMenu.EXP.EXPItem.Type", "EXPERIENCE_BOTTLE"); - if (getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Type").equals("MOB_SPAWNER")) getConfig().set("fupgrades.MainMenu.Spawners.SpawnerItem.Type", "SPAWNER"); - if (getConfig().getString("fupgrades.MainMenu.DamageReduct.ReduceItem.Type").equals("GOLD_CHESTPLATE")) getConfig().set("fupgrades.MainMenu.DamageReduct.ReduceItem.Type", "GOLDEN_CHESTPLATE"); - if (getConfig().getString("fupgrades.MainMenu.Warps.WarpItem.Type").equals("EYE_OF_ENDER")) getConfig().set("fupgrades.MainMenu.Warps.WarpItem.Type", "ENDER_EYE"); - } // Load Conf from disk Conf.load(); diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java index 7a2ed263..ec68a21a 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java @@ -314,9 +314,9 @@ public class FUpgradesGUI implements Listener { @SuppressWarnings("Duplicates") private ItemStack[] buildItems(FPlayer fme) { - Material expMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Type")); + byte expData = (byte) (FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Damage")); + Material expMaterial = XMaterial.parseMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Type"), expData); int expAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Amount"); - short expData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.EXP.EXPItem.Damage") + ""); String expName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.EXP.EXPItem.Name")); List expLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.EXP.EXPItem.Lore")); int expLevel = fme.getFaction().getUpgrade(UpgradeType.EXP);