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
@ -700,4 +700,4 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -194,8 +194,10 @@ 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) {
|
||||
return false;
|
||||
if (moneyReq != 0 && Quests.economy != null) {
|
||||
if (Quests.economy.getBalance(Bukkit.getOfflinePlayer(player.getUniqueId())) < moneyReq) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
int num = 0;
|
||||
@ -334,7 +336,9 @@ public class Quest {
|
||||
player.giveExp(lb.getExp());
|
||||
}
|
||||
if (lb.getMoney() > 0) {
|
||||
Quests.economy.depositPlayer(Bukkit.getOfflinePlayer(player.getUniqueId()), lb.getMoney());
|
||||
if (Quests.economy != null) {
|
||||
Quests.economy.depositPlayer(Bukkit.getOfflinePlayer(player.getUniqueId()), lb.getMoney());
|
||||
}
|
||||
}
|
||||
if (lb.getItemList().isEmpty() == false) {
|
||||
phatLootItems.addAll(lb.getItemList());
|
||||
|
@ -313,7 +313,9 @@ public class Quester {
|
||||
Stage stage = q.getStage(0);
|
||||
if (!override) {
|
||||
if (q.moneyReq > 0) {
|
||||
Quests.economy.withdrawPlayer(getOfflinePlayer(), q.moneyReq);
|
||||
if (Quests.economy != null) {
|
||||
Quests.economy.withdrawPlayer(getOfflinePlayer(), q.moneyReq);
|
||||
}
|
||||
}
|
||||
for (ItemStack is : q.items) {
|
||||
if (q.removeItems.get(q.items.indexOf(is)) == true) {
|
||||
@ -2608,4 +2610,4 @@ public class Quester {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4036,4 +4036,4 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
questerBlacklist.add(id.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -192,7 +192,11 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = Lang.get("reqMoneyPrompt");
|
||||
text = text.replaceAll("<money>", ChatColor.DARK_PURPLE + ((Quests.economy.currencyNamePlural().isEmpty() ? Lang.get("money") : Quests.economy.currencyNamePlural())) + ChatColor.YELLOW);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -901,4 +905,4 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -191,7 +191,12 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = Lang.get("rewMoneyPrompt");
|
||||
text = text.replaceAll("<money>", ChatColor.AQUA + (Quests.economy.currencyNamePlural().isEmpty() ? Lang.get("money") : Quests.economy.currencyNamePlural()) + ChatColor.YELLOW);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -882,4 +887,4 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
return new RewardCustomDataListPrompt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user