QuotaMatchModule.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:ProjectAres 作者:
Collection<BaseComponent> format() {
    final ImmutableList.Builder<BaseComponent> lines = ImmutableList.builder();

    lines.add(new TranslatableComponent(
        "matchQuota.matchCounts",
        new Component(String.valueOf(matchesPlayed), ChatColor.AQUA),
        new Component(String.valueOf(quota.maximum()), ChatColor.AQUA)
    ));

    if(matchesRemaining() == 0) {
        lines.add(new TranslatableComponent(
            "matchQuota.nextMatch",
            new Component(PeriodFormats.briefNaturalApproximate(now, earliestJoinTime), ChatColor.AQUA)
        ));
    }

    if(!quota.premium()) {
        Range<Integer> premiumRange = getConfig().getPremiumMaximum();
        if(premiumRange != null) {
            if(premiumRange.upperEndpoint() == Integer.MAX_VALUE) {
                lines.add(Links.shopPlug("shop.plug.rankedMatches.unlimited"));
            } else {
                BaseComponent premiumLimit = new Component(String.valueOf(premiumRange.upperEndpoint()), ChatColor.AQUA);
                if(premiumRange.upperEndpoint().equals(premiumRange.lowerEndpoint())) {
                    lines.add(Links.shopPlug("shop.plug.rankedMatches.uniform", premiumLimit));
                } else {
                    lines.add(Links.shopPlug("shop.plug.rankedMatches.upto", premiumLimit));
                }
            }
        }
    }

    return lines.build();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号