Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Fix bug where some plugins may see players with an infinite balance.
Browse files Browse the repository at this point in the history
  • Loading branch information
AppleDash committed Jul 22, 2016
1 parent 770536e commit 5158689
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions SaneEconomyCore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,19 @@ public EconomyResponse withdrawPlayer(String playerName, double v) {
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);
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 5158689

Please sign in to comment.