-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from NextPlugins/uuid-method
UUID method (NOT TESTED)
- Loading branch information
Showing
24 changed files
with
184 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/nextplugins/economy/api/conversor/impl/storm/StormEconomyAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.nextplugins.economy.api.conversor.impl.storm; | ||
|
||
import com.google.gson.Gson; | ||
import com.henryfabio.sqlprovider.executor.adapter.SQLResultAdapter; | ||
import com.henryfabio.sqlprovider.executor.result.SimpleResultSet; | ||
import com.nextplugins.economy.api.model.account.Account; | ||
import lombok.val; | ||
|
||
public class StormEconomyAdapter implements SQLResultAdapter<Account> { | ||
|
||
private final Gson accountParser = new Gson(); | ||
|
||
@Override | ||
public Account adaptResult(SimpleResultSet resultSet) { | ||
val user = accountParser.fromJson((String) resultSet.get("json"), StormEconomyUser.class); | ||
return Account.generate() | ||
.username(user.getJogador()) | ||
.balance(user.getCoins()) | ||
.transactions(user.getTransactions()) | ||
.result(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/nextplugins/economy/api/conversor/impl/storm/StormEconomyConversor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.nextplugins.economy.api.conversor.impl.storm; | ||
|
||
import com.nextplugins.economy.api.conversor.Conversor; | ||
import com.nextplugins.economy.api.model.account.Account; | ||
|
||
import java.util.Set; | ||
|
||
public class StormEconomyConversor extends Conversor { | ||
|
||
@Override | ||
public Set<Account> lookupPlayers() { | ||
return getExecutor().resultManyQuery( | ||
"SELECT * FROM " + getTable(), | ||
statement -> {}, | ||
StormEconomyAdapter.class | ||
); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/nextplugins/economy/api/conversor/impl/storm/StormEconomyUser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.nextplugins.economy.api.conversor.impl.storm; | ||
|
||
import com.google.common.collect.Lists; | ||
import com.nextplugins.economy.api.model.account.historic.AccountBankHistoric; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
import java.util.LinkedList; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class StormEconomyUser { | ||
|
||
private final double coins; | ||
private final String jogador; // cringe | ||
private final LinkedList<AccountBankHistoric> transactions = Lists.newLinkedList(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.