mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-08 11:41:28 +01:00
fix for permission and not enough money being mixed up.
This commit is contained in:
parent
3d9f03b2aa
commit
521d7d2452
2
pom.xml
2
pom.xml
@ -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>
|
||||
|
@ -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);
|
||||
|
@ -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!
|
||||
|
Loading…
Reference in New Issue
Block a user