add predicate to getPackageOwnership, add shard purchases to chest page

This commit is contained in:
Spencer 2018-01-05 20:40:27 -05:00 committed by Alexander Meech
parent 0cebc6e494
commit f9263b38be

View File

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.bukkit.Material;
@ -53,12 +54,17 @@ public class SupportPage extends ShopPageBase<CustomerSupport, SupportShop>
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<>();
for (TransactionToken transaction : _donor.getTransactions())
{
if (!allowed.test(transaction))
{
continue;
}
if (validNames.contains(transaction.SalesPackageName))
{
ownership.putIfAbsent(transaction.SalesPackageName, 0);
@ -92,6 +98,11 @@ public class SupportPage extends ShopPageBase<CustomerSupport, SupportShop>
return ownership;
}
public Map<String, Integer> getPackageOwnership(List<String> names)
{
return getPackageOwnership(names, (transactionToken -> transactionToken.Coins == 0 && transactionToken.Gems == 0));
}
private List<String> getBasicPlayerInfo()
{
List<String> info = new ArrayList<>();