From 387913e1731f64b86a3ebdc81a96d683fd2f1945 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Mon, 9 Jan 2023 02:33:57 -0500 Subject: [PATCH] Remove PhatLoots integration in favor of module --- .../quests/dependencies/IDependencies.java | 3 - core/pom.xml | 6 -- .../me/blackvein/quests/Dependencies.java | 16 ---- .../main/java/me/blackvein/quests/Quest.java | 88 ------------------- .../main/java/me/blackvein/quests/Quests.java | 19 +--- core/src/main/resources/plugin.yml | 2 +- core/src/main/resources/strings.yml | 5 -- 7 files changed, 3 insertions(+), 136 deletions(-) diff --git a/api/src/main/java/me/blackvein/quests/dependencies/IDependencies.java b/api/src/main/java/me/blackvein/quests/dependencies/IDependencies.java index ff0716655..5841a2a74 100644 --- a/api/src/main/java/me/blackvein/quests/dependencies/IDependencies.java +++ b/api/src/main/java/me/blackvein/quests/dependencies/IDependencies.java @@ -13,7 +13,6 @@ package me.blackvein.quests.dependencies; import com.alessiodp.parties.api.interfaces.PartiesAPI; -import com.codisimus.plugins.phatloots.PhatLoots; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.mcMMO; import com.herocraftonline.heroes.Heroes; @@ -48,8 +47,6 @@ public interface IDependencies { Heroes getHeroes(); - PhatLoots getPhatLoots(); - PlaceholderAPIPlugin getPlaceholderApi(); CitizensPlugin getCitizens(); diff --git a/core/pom.xml b/core/pom.xml index b4e967408..a7b2a8501 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -112,12 +112,6 @@ 2.5.5 provided - - com.github.RednedEpic - PhatLoots - e55d0ba1f6 - provided - com.alessiodp.parties parties-api diff --git a/core/src/main/java/me/blackvein/quests/Dependencies.java b/core/src/main/java/me/blackvein/quests/Dependencies.java index 3a67c497f..3e9d5f124 100644 --- a/core/src/main/java/me/blackvein/quests/Dependencies.java +++ b/core/src/main/java/me/blackvein/quests/Dependencies.java @@ -14,7 +14,6 @@ package me.blackvein.quests; import com.alessiodp.parties.api.Parties; import com.alessiodp.parties.api.interfaces.PartiesAPI; -import com.codisimus.plugins.phatloots.PhatLoots; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.mcMMO; @@ -60,7 +59,6 @@ public class Dependencies implements IDependencies { private static WorldGuardAPI worldGuardApi = null; private static mcMMO mcmmo = null; private static Heroes heroes = null; - private static PhatLoots phatLoots = null; public static PlaceholderAPIPlugin placeholder = null; public static CitizensPlugin citizens = null; private static DenizenAPI denizenApi = null; @@ -134,19 +132,6 @@ public class Dependencies implements IDependencies { return heroes; } - public PhatLoots getPhatLoots() { - if (phatLoots == null && isPluginAvailable("PhatLoots")) { - try { - phatLoots = (PhatLoots) plugin.getServer().getPluginManager().getPlugin("PhatLoots"); - plugin.getLogger().info("Sucessfully linked Quests with PhatLoots " - + phatLoots.getDescription().getVersion()); - } catch (final NoClassDefFoundError e) { - plugin.getLogger().warning("Unofficial version of PhatLoots found. PhatLoots in Quests not enabled."); - } - } - return phatLoots; - } - public PlaceholderAPIPlugin getPlaceholderApi() { if (placeholder == null && isPluginAvailable("PlaceholderAPI")) { placeholder = (PlaceholderAPIPlugin) plugin.getServer().getPluginManager().getPlugin("PlaceholderAPI"); @@ -357,7 +342,6 @@ public class Dependencies implements IDependencies { getDenizenApi(); getMcmmoClassic(); getHeroes(); - getPhatLoots(); getPlaceholderApi(); getCitizensBooksApi(); getPartiesApi(); diff --git a/core/src/main/java/me/blackvein/quests/Quest.java b/core/src/main/java/me/blackvein/quests/Quest.java index a06b365d7..472bfc85e 100644 --- a/core/src/main/java/me/blackvein/quests/Quest.java +++ b/core/src/main/java/me/blackvein/quests/Quest.java @@ -14,9 +14,6 @@ package me.blackvein.quests; import com.alessiodp.parties.api.interfaces.Party; import com.alessiodp.parties.api.interfaces.PartyPlayer; -import com.codisimus.plugins.phatloots.PhatLootsAPI; -import com.codisimus.plugins.phatloots.loot.CommandLoot; -import com.codisimus.plugins.phatloots.loot.LootBundle; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.util.player.UserManager; import com.herocraftonline.heroes.characters.Hero; @@ -892,50 +889,6 @@ public class Quest implements IQuest { } } } - final LinkedList phatLootItems = new LinkedList<>(); - int phatLootExp = 0; - final LinkedList phatLootMessages = new LinkedList<>(); - for (final String s : rewards.getPhatLoots()) { - final LootBundle lb = PhatLootsAPI.getPhatLoot(s).rollForLoot(); - if (lb.getExp() > 0) { - phatLootExp += lb.getExp(); - if (player.isOnline()) { - ((Player)player).giveExp(lb.getExp()); - } - } - if (lb.getMoney() > 0) { - if (depends.getVaultEconomy() != null) { - depends.getVaultEconomy().depositPlayer(player, lb.getMoney()); - } - } - if (!lb.getItemList().isEmpty()) { - phatLootItems.addAll(lb.getItemList()); - if (player.isOnline()) { - for (final ItemStack is : lb.getItemList()) { - try { - InventoryUtil.addItem(player.getPlayer(), is); - } catch (final Exception e) { - plugin.getLogger().severe("Unable to add PhatLoots item to inventory of " - + player.getName() + " upon completion of quest " + name); - quester.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. " - + "Please contact an administrator."); - } - } - } - } - if (!lb.getCommandList().isEmpty() && player.isOnline()) { - for (final CommandLoot cl : lb.getCommandList()) { - cl.execute((Player)player); - } - } - if (!lb.getMessageList().isEmpty()) { - phatLootMessages.addAll(lb.getMessageList()); - } - if (plugin.getSettings().getConsoleLogging() > 2) { - plugin.getLogger().info(player.getUniqueId() + " was rewarded loot " + s); - } - issuedReward = true; - } if (rewards.getExp() > 0 && player.isOnline()) { ((Player)player).giveExp(rewards.getExp()); if (plugin.getSettings().getConsoleLogging() > 2) { @@ -1052,46 +1005,10 @@ public class Quest implements IQuest { quester.sendMessage(text.toString().replace("", ItemUtil.getName(i))); } } - for (final ItemStack i : phatLootItems) { - if (i.getItemMeta() != null && i.getItemMeta().hasDisplayName()) { - if (i.getEnchantments().isEmpty()) { - quester.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC - + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " - + i.getAmount()); - } else { - quester.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC - + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " - + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(p, "enchantedItem")); - } - } else if (i.getDurability() != 0) { - if (i.getEnchantments().isEmpty()) { - quester.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" - + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount()); - } else { - quester.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" - + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() - + ChatColor.DARK_PURPLE + " " + Lang.get(p, "enchantedItem")); - } - } else { - if (i.getEnchantments().isEmpty()) { - quester.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY - + " x " + i.getAmount()); - } else { - quester.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY - + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " - + Lang.get(p, "enchantedItem")); - } - } - } if (rewards.getMoney() > 0 && depends.getVaultEconomy() != null) { quester.sendMessage("- " + ChatColor.DARK_GREEN + depends.getVaultEconomy().format(rewards.getMoney())); } - if (rewards.getExp() > 0 || phatLootExp > 0) { - final int tot = rewards.getExp() + phatLootExp; - quester.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " " - + Lang.get(p, "experience")); - } if (!rewards.getCommands().isEmpty()) { int index = 0; for (final String s : rewards.getCommands()) { @@ -1138,11 +1055,6 @@ public class Quest implements IQuest { p.sendMessage("- " + ChatColor.DARK_GREEN + rewards.getPartiesExperience() + ChatColor.DARK_PURPLE + " " + Lang.get(p, "partiesExperience")); } - if (!phatLootMessages.isEmpty()) { - for (final String s : phatLootMessages) { - quester.sendMessage("- " + s); - } - } for (final String s : rewards.getCustomRewards().keySet()) { CustomReward found = null; for (final CustomReward cr : plugin.getCustomRewards()) { diff --git a/core/src/main/java/me/blackvein/quests/Quests.java b/core/src/main/java/me/blackvein/quests/Quests.java index ccca63bf7..dc68fe531 100644 --- a/core/src/main/java/me/blackvein/quests/Quests.java +++ b/core/src/main/java/me/blackvein/quests/Quests.java @@ -12,7 +12,6 @@ package me.blackvein.quests; -import com.codisimus.plugins.phatloots.PhatLootsAPI; import com.gmail.nossr50.datatypes.skills.SkillType; import com.herocraftonline.heroes.characters.classes.HeroClass; import me.blackvein.quests.actions.Action; @@ -2094,22 +2093,8 @@ public class Quests extends JavaPlugin implements QuestsAPI { } } } - if (depends.isPluginAvailable("PhatLoots")) { - if (config.contains("quests." + questKey + ".rewards.phat-loots")) { - if (ConfigUtil.checkList(config.getList("quests." + questKey + ".rewards.phat-loots"), String.class)) { - for (final String loot : config.getStringList("quests." + questKey + ".rewards.phat-loots")) { - if (depends.getPhatLoots() == null) { - throw new QuestFormatException("PhatLoots not found for phat-loots", questKey); - } else if (PhatLootsAPI.getPhatLoot(loot) == null) { - throw new QuestFormatException("Reward phat-loots has invalid PhatLoot name " + loot, - questKey); - } - } - rewards.setPhatLoots(config.getStringList("quests." + questKey + ".rewards.phat-loots")); - } else { - throw new QuestFormatException("Reward phat-loots is not a list of PhatLoots", questKey); - } - } + if (config.contains("quests." + questKey + ".rewards.phat-loots")) { + throw new QuestFormatException("PhatLoots support has been removed. Use the module instead!", questKey); } if (config.contains("quests." + questKey + ".rewards.details-override")) { if (ConfigUtil.checkList(config.getList("quests." + questKey diff --git a/core/src/main/resources/plugin.yml b/core/src/main/resources/plugin.yml index 4aeb42766..c2776be93 100644 --- a/core/src/main/resources/plugin.yml +++ b/core/src/main/resources/plugin.yml @@ -5,7 +5,7 @@ api-version: 1.13 description: An extensive questing system. website: https://github.com/PikaMug/Quests author: PikaMug -softdepend: [Citizens, CitizensBooks, Denizen, DungeonsXL, GPS, Heroes, mcMMO, Parties, PhatLoots, PlaceholderAPI, Unite, Vault, WorldGuard] +softdepend: [Citizens, CitizensBooks, Denizen, DungeonsXL, GPS, Heroes, mcMMO, Parties, PlaceholderAPI, Unite, Vault, WorldGuard] permissions: quests.*: description: Access ALL Quests functionality diff --git a/core/src/main/resources/strings.yml b/core/src/main/resources/strings.yml index 45e64ac89..2b1a8d338 100644 --- a/core/src/main/resources/strings.yml +++ b/core/src/main/resources/strings.yml @@ -501,7 +501,6 @@ rewPermissionsCleared: "Permission rewards cleared." rewSetMcMMO: "Set mcMMO Classic skill rewards" rewSetHeroes: "Set Heroes experience rewards" rewSetPartiesExperience: "Set Parties experience reward" -rewSetPhat: "Set PhatLoot rewards" rewSetCustom: "Set custom rewards" rewSetHeroesClasses: "Set classes" rewSetHeroesAmounts: "Set experience amounts" @@ -515,7 +514,6 @@ rewMcMMOPrompt: "Enter mcMMO Classic skills (or enter 'All' for all skills), , " rewHeroesExperiencePrompt: "Enter experience amounts (numbers, decimals are allowed), , " rewPartiesExperiencePrompt: "Enter amount of Parties experience, , " -rewPhatLootsPrompt: "Enter PhatLoots, , , " rewCustomRewardPrompt: "Enter the name of a custom reward to add, , " rewItemsCleared: "Item rewards cleared." rewNoMcMMOSkills: "No skills set" @@ -525,8 +523,6 @@ rewMcMMOCleared: "mcMMO Classic rewards cleared." rewSetHeroesClassesFirst: "You must set classes first!" rewHeroesCleared: "Heroes rewards cleared." rewHeroesInvalidClass: " is not a valid Heroes class name!" -rewPhatLootsInvalid: " is not a valid PhatLoot name!" -rewPhatLootsCleared: "PhatLoots reward cleared." rewCustomAlreadyAdded: "That custom reward has already been added!" rewCustomNotFound: "Custom reward module not found." rewCustomCleared: "Custom rewards cleared." @@ -608,7 +604,6 @@ heroesClassesTitle: "- Heroes Classes -" heroesExperienceTitle: "- Heroes Experience -" heroesPrimaryTitle: "- Primary Classes -" heroesSecondaryTitle: "- Secondary Classes -" -phatLootsRewardsTitle: "- PhatLoots Rewards -" customRequirementsTitle: "- Custom Requirements -" customRewardsTitle: "- Custom Rewards -" skillListTitle: "- Skill List -"