fix for permission and not enough money being mixed up.

This commit is contained in:
Brianna O'Keefe 2018-11-08 12:17:42 -05:00
parent 3d9f03b2aa
commit 521d7d2452
3 changed files with 16 additions and 16 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>UltimateKits</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>2.0.1</version>
<version>2.0.2</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>

View File

@ -595,33 +595,33 @@ public class Kit {
}
}
public void buyWithEconomy(Player p) {
public void buyWithEconomy(Player player) {
try {
if (plugin.getServer().getPluginManager().getPlugin("Vault") == null) return;
RegisteredServiceProvider<Economy> rsp = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
net.milkbowl.vault.economy.Economy econ = rsp.getProvider();
if (!econ.has(p, price) && !hasPermission(p)) {
if (!hasPermission(p))
p.sendMessage(plugin.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText(Lang.NO_PERM.getConfigValue(showableName)));
else
p.sendMessage(plugin.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText(Lang.CANNOT_AFFORD.getConfigValue(showableName)));
if (!hasPermission(player)) {
player.sendMessage(plugin.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText(Lang.NO_PERM.getConfigValue(showableName)));
return;
} else if (!econ.has(player, price)) {
player.sendMessage(plugin.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText(Lang.CANNOT_AFFORD.getConfigValue(showableName)));
return;
}
if (this.delay > 0) {
if (getNextUse(p) == -1) {
p.sendMessage(plugin.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText(Lang.NOT_TWICE.getConfigValue(showableName)));
} else if (getNextUse(p) != 0) {
p.sendMessage(plugin.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText(Lang.DELAY.getConfigValue(Arconix.pl().getApi().format().readableTime(getNextUse(p)))));
if (getNextUse(player) == -1) {
player.sendMessage(plugin.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText(Lang.NOT_TWICE.getConfigValue(showableName)));
} else if (getNextUse(player) != 0) {
player.sendMessage(plugin.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText(Lang.DELAY.getConfigValue(Arconix.pl().getApi().format().readableTime(getNextUse(player)))));
return;
}
}
if (delay != 0) {
updateDelay(p); //updates delay on buy
updateDelay(player); //updates delay on buy
}
econ.withdrawPlayer(p, price);
give(p, false, true, false);
econ.withdrawPlayer(player, price);
give(player, false, true, false);
} catch (Exception ex) {
Debugger.runReport(ex);

View File

@ -1,6 +1,6 @@
name: UltimateKits
main: com.songoda.ultimatekits.UltimateKits
version: 2.0.1
version: 2.0.2
depend: [Arconix]
softdepend: [PlaceholderAPI, Vault, UltimateCore, Essentials, MiniKitPvP]
description: View a kit before you purchase it!