mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 02:25:42 +01:00
Remove PhatLoots integration in favor of module
This commit is contained in:
parent
2b2fdc69b0
commit
387913e173
@ -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();
|
||||
|
@ -112,12 +112,6 @@
|
||||
<version>2.5.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.RednedEpic</groupId>
|
||||
<artifactId>PhatLoots</artifactId>
|
||||
<version>e55d0ba1f6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alessiodp.parties</groupId>
|
||||
<artifactId>parties-api</artifactId>
|
||||
|
@ -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();
|
||||
|
@ -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<ItemStack> phatLootItems = new LinkedList<>();
|
||||
int phatLootExp = 0;
|
||||
final LinkedList<String> 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("<item>", 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()) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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), <sp
|
||||
rewHeroesClassesPrompt: "Enter Heroes classes, <space>, <cancel>"
|
||||
rewHeroesExperiencePrompt: "Enter experience amounts (numbers, decimals are allowed), <space>, <cancel>"
|
||||
rewPartiesExperiencePrompt: "Enter amount of Parties experience, <clear>, <cancel>"
|
||||
rewPhatLootsPrompt: "Enter PhatLoots, <space>, <clear>, <cancel>"
|
||||
rewCustomRewardPrompt: "Enter the name of a custom reward to add, <clear>, <cancel>"
|
||||
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: "<input> is not a valid Heroes class name!"
|
||||
rewPhatLootsInvalid: "<input> 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 -"
|
||||
|
Loading…
Reference in New Issue
Block a user