Fix bug where some plugins may see players with an infinite balance.

This commit is contained in:
AppleDash 2016-07-22 13:12:57 -04:00
parent 770536e514
commit 5158689a2a
3 changed files with 11 additions and 3 deletions

View File

@ -6,10 +6,10 @@
<parent>
<groupId>org.appledash</groupId>
<artifactId>SaneEconomy</artifactId>
<version>0.6.1-SNAPSHOT</version>
<version>0.6.2-SNAPSHOT</version>
</parent>
<artifactId>SaneEconomyCore</artifactId>
<version>0.6.1-SNAPSHOT</version>
<version>0.6.2-SNAPSHOT</version>
<dependencies>
<dependency>

View File

@ -141,11 +141,19 @@ public class EconomySaneEconomy implements Economy {
economable = Economable.wrap(playerName);
}
if (!has(playerName, v)) {
return new EconomyResponse(v, getBalance(playerName), EconomyResponse.ResponseType.FAILURE, "Insufficient funds.");
}
return new EconomyResponse(v, SaneEconomy.getInstance().getEconomyManager().subtractBalance(economable, v), EconomyResponse.ResponseType.SUCCESS, null);
}
@Override
public EconomyResponse withdrawPlayer(OfflinePlayer offlinePlayer, double v) {
if (!has(offlinePlayer, v)) {
return new EconomyResponse(v, getBalance(offlinePlayer), EconomyResponse.ResponseType.FAILURE, "Insufficient funds.");
}
return new EconomyResponse(v, SaneEconomy.getInstance().getEconomyManager().subtractBalance(Economable.wrap(offlinePlayer), v), EconomyResponse.ResponseType.SUCCESS, null);
}

View File

@ -6,7 +6,7 @@
<groupId>org.appledash</groupId>
<artifactId>SaneEconomy</artifactId>
<version>0.6.1-SNAPSHOT</version>
<version>0.6.2-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>