Update support server to accommodate power play changes
This commit is contained in:
parent
6e2512e0cf
commit
e867a09b5c
@ -137,13 +137,16 @@ public class PowerPlayClubRepository implements Listener {
|
|||||||
|
|
||||||
public CompletableFuture<PowerPlayData> loadData(Player player)
|
public CompletableFuture<PowerPlayData> loadData(Player player)
|
||||||
{
|
{
|
||||||
return loadSubscriptions(player).thenCombine(loadClaimMonths(player), PowerPlayData::fromSubsAndClaims);
|
return loadData(_clientManager.Get(player).getAccountId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<List<YearMonth>> loadClaimMonths(Player player)
|
public CompletableFuture<PowerPlayData> loadData(int accountId)
|
||||||
{
|
{
|
||||||
int accountId = _clientManager.Get(player).getAccountId();
|
return loadSubscriptions(accountId).thenCombine(loadClaimMonths(accountId), PowerPlayData::fromSubsAndClaims);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<List<YearMonth>> loadClaimMonths(int accountId)
|
||||||
|
{
|
||||||
return CompletableFuture.supplyAsync(() ->
|
return CompletableFuture.supplyAsync(() ->
|
||||||
{
|
{
|
||||||
try (Connection connection = DBPool.getAccount().getConnection())
|
try (Connection connection = DBPool.getAccount().getConnection())
|
||||||
@ -166,10 +169,8 @@ public class PowerPlayClubRepository implements Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<List<PowerPlayData.Subscription>> loadSubscriptions(Player player)
|
public CompletableFuture<List<PowerPlayData.Subscription>> loadSubscriptions(int accountId)
|
||||||
{
|
{
|
||||||
int accountId = _clientManager.Get(player).getAccountId();
|
|
||||||
|
|
||||||
return CompletableFuture.supplyAsync(() ->
|
return CompletableFuture.supplyAsync(() ->
|
||||||
{
|
{
|
||||||
try (Connection connection = DBPool.getAccount().getConnection())
|
try (Connection connection = DBPool.getAccount().getConnection())
|
||||||
|
@ -2,6 +2,7 @@ package mineplex.staffServer.customerSupport;
|
|||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.time.YearMonth;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -9,6 +10,7 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mineplex.core.powerplayclub.PowerPlayData;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -118,8 +120,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
|
|||||||
{
|
{
|
||||||
_repository.loadBonusLogForAccountId(client.getAccountId(), instance);
|
_repository.loadBonusLogForAccountId(client.getAccountId(), instance);
|
||||||
|
|
||||||
boolean powerPlaySub = _powerPlayRepo.hasSubscription(client.getAccountId()).join();
|
PowerPlayData powerPlayData = _powerPlayRepo.loadData(client.getAccountId()).join();
|
||||||
boolean powerPlayClaim = _powerPlayRepo.hasClaimed(client.getAccountId()).join();
|
boolean powerPlaySub = powerPlayData.isSubscribed();
|
||||||
|
boolean powerPlayClaim = powerPlaySub && !powerPlayData.getUnclaimedMonths().contains(YearMonth.now());
|
||||||
|
|
||||||
runSync(new Runnable()
|
runSync(new Runnable()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user