add predicate to getPackageOwnership, add shard purchases to chest page
This commit is contained in:
parent
0cebc6e494
commit
f9263b38be
@ -5,6 +5,7 @@ import java.util.Arrays;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -53,12 +54,17 @@ public class SupportPage extends ShopPageBase<CustomerSupport, SupportShop>
|
|||||||
return (rowIndex * 9) + columnIndex;
|
return (rowIndex * 9) + columnIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String, Integer> getPackageOwnership(List<String> validNames)
|
protected Map<String, Integer> getPackageOwnership(List<String> validNames, Predicate<TransactionToken> allowed)
|
||||||
{
|
{
|
||||||
Map<String, Integer> ownership = new HashMap<>();
|
Map<String, Integer> ownership = new HashMap<>();
|
||||||
|
|
||||||
for (TransactionToken transaction : _donor.getTransactions())
|
for (TransactionToken transaction : _donor.getTransactions())
|
||||||
{
|
{
|
||||||
|
if (!allowed.test(transaction))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (validNames.contains(transaction.SalesPackageName))
|
if (validNames.contains(transaction.SalesPackageName))
|
||||||
{
|
{
|
||||||
ownership.putIfAbsent(transaction.SalesPackageName, 0);
|
ownership.putIfAbsent(transaction.SalesPackageName, 0);
|
||||||
@ -92,6 +98,11 @@ public class SupportPage extends ShopPageBase<CustomerSupport, SupportShop>
|
|||||||
return ownership;
|
return ownership;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Integer> getPackageOwnership(List<String> names)
|
||||||
|
{
|
||||||
|
return getPackageOwnership(names, (transactionToken -> transactionToken.Coins == 0 && transactionToken.Gems == 0));
|
||||||
|
}
|
||||||
|
|
||||||
private List<String> getBasicPlayerInfo()
|
private List<String> getBasicPlayerInfo()
|
||||||
{
|
{
|
||||||
List<String> info = new ArrayList<>();
|
List<String> info = new ArrayList<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user