mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-04 15:37:46 +01:00
Ensure economy plugin is present when checking money reqs, fixes #185
This commit is contained in:
parent
f98f48ace5
commit
bcd1d7ecb0
@ -194,9 +194,11 @@ public class Quest {
|
||||
|
||||
public boolean testRequirements(Player player) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (moneyReq != 0 && Quests.economy.getBalance(Bukkit.getOfflinePlayer(player.getUniqueId())) < moneyReq) {
|
||||
if (moneyReq != 0 && Quests.economy != null) {
|
||||
if (Quests.economy.getBalance(Bukkit.getOfflinePlayer(player.getUniqueId())) < moneyReq) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
int num = 0;
|
||||
for (ItemStack is : items) {
|
||||
@ -334,8 +336,10 @@ public class Quest {
|
||||
player.giveExp(lb.getExp());
|
||||
}
|
||||
if (lb.getMoney() > 0) {
|
||||
if (Quests.economy != null) {
|
||||
Quests.economy.depositPlayer(Bukkit.getOfflinePlayer(player.getUniqueId()), lb.getMoney());
|
||||
}
|
||||
}
|
||||
if (lb.getItemList().isEmpty() == false) {
|
||||
phatLootItems.addAll(lb.getItemList());
|
||||
for (ItemStack is : lb.getItemList()) {
|
||||
|
@ -313,8 +313,10 @@ public class Quester {
|
||||
Stage stage = q.getStage(0);
|
||||
if (!override) {
|
||||
if (q.moneyReq > 0) {
|
||||
if (Quests.economy != null) {
|
||||
Quests.economy.withdrawPlayer(getOfflinePlayer(), q.moneyReq);
|
||||
}
|
||||
}
|
||||
for (ItemStack is : q.items) {
|
||||
if (q.removeItems.get(q.items.indexOf(is)) == true) {
|
||||
Quests.removeItem(player.getInventory(), is);
|
||||
|
@ -192,7 +192,11 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = Lang.get("reqMoneyPrompt");
|
||||
if (Quests.economy != null) {
|
||||
text = text.replaceAll("<money>", ChatColor.DARK_PURPLE + ((Quests.economy.currencyNamePlural().isEmpty() ? Lang.get("money") : Quests.economy.currencyNamePlural())) + ChatColor.YELLOW);
|
||||
} else {
|
||||
text = text.replaceAll("<money>", ChatColor.DARK_PURPLE + Lang.get("money") + ChatColor.YELLOW);
|
||||
}
|
||||
return ChatColor.YELLOW + text;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,12 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = Lang.get("rewMoneyPrompt");
|
||||
if (Quests.economy != null) {
|
||||
text = text.replaceAll("<money>", ChatColor.AQUA + (Quests.economy.currencyNamePlural().isEmpty() ? Lang.get("money") : Quests.economy.currencyNamePlural()) + ChatColor.YELLOW);
|
||||
} else {
|
||||
text = text.replaceAll("<money>", ChatColor.AQUA + Lang.get("money") + ChatColor.YELLOW);
|
||||
|
||||
}
|
||||
return ChatColor.YELLOW + text;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user