Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HimaJyun committed Feb 15, 2019
1 parent dc7dbbe commit 4ce6752
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<author>true</author>
<source>${java.version}</source>
<encoding>UTF-8</encoding>
<charset>UTF-8</charset>
<docencoding>UTF-8</docencoding>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
25 changes: 10 additions & 15 deletions src/main/java/jp/jyn/jecon/VaultEconomy.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import java.util.OptionalDouble;
import java.util.UUID;

@PackagePrivate class VaultEconomy implements Economy {
@PackagePrivate
class VaultEconomy implements Economy {
private final UUIDRegistry registry;
private final MainConfig config;
private final BalanceRepository repository;
Expand Down Expand Up @@ -150,13 +151,10 @@ private EconomyResponse withdrawPlayer(UUID uuid, double value) {
return new EconomyResponse(0, 0, EconomyResponse.ResponseType.FAILURE, "Cannot withdraw negative funds");
}

switch (repository.withdraw(uuid, value)) {
case SUCCESS:
return new EconomyResponse(0, repository.getDouble(uuid).orElse(0), EconomyResponse.ResponseType.SUCCESS, "OK");
case ACCOUNT_NOT_FOUND:
return new EconomyResponse(0, 0, EconomyResponse.ResponseType.FAILURE, "Account does not exist");
default:
return new EconomyResponse(0, 0, EconomyResponse.ResponseType.FAILURE, "Unknown error");
if (repository.withdraw(uuid, value)) {
return new EconomyResponse(0, repository.getDouble(uuid).orElse(0), EconomyResponse.ResponseType.SUCCESS, "OK");
} else {
return new EconomyResponse(0, 0, EconomyResponse.ResponseType.FAILURE, "Account does not exist");
}
}

Expand Down Expand Up @@ -187,13 +185,10 @@ private EconomyResponse depositPlayer(UUID uuid, double value) {
return new EconomyResponse(0, 0, EconomyResponse.ResponseType.FAILURE, "Cannot deposit negative funds");
}

switch (repository.deposit(uuid, value)) {
case SUCCESS:
return new EconomyResponse(0, repository.getDouble(uuid).orElse(0), EconomyResponse.ResponseType.SUCCESS, "OK");
case ACCOUNT_NOT_FOUND:
return new EconomyResponse(0, 0, EconomyResponse.ResponseType.FAILURE, "Account does not exist");
default:
return new EconomyResponse(0, 0, EconomyResponse.ResponseType.FAILURE, "Unknown error");
if (repository.deposit(uuid, value)) {
return new EconomyResponse(0, repository.getDouble(uuid).orElse(0), EconomyResponse.ResponseType.SUCCESS, "OK");
} else {
return new EconomyResponse(0, 0, EconomyResponse.ResponseType.FAILURE, "Account does not exist");
}
}

Expand Down

0 comments on commit 4ce6752

Please sign in to comment.