Readd trial rank handling code

This commit is contained in:
cswhite2000 2018-02-27 12:24:38 -08:00 committed by Ashcon Partovi
parent 2067e56aeb
commit 3adaaba5bc
1 changed files with 36 additions and 0 deletions

View File

@ -189,6 +189,42 @@ public class PlayerListener implements PluginFacet, Listener {
)
);
if(user.trial_expires_at() != null) {
final Instant expires = TimeUtils.toInstant(user.trial_expires_at());
final Instant now = Instant.now();
if(expires.isAfter(now)) {
long days = TimeUtils.daysRoundingUp(Duration.between(now, expires));
final String key;
if(days <= 1) {
key = "trial.remaining.singular";
days = 1;
} else {
key = "trial.remaining.plural";
}
audience.sendMessage(
new Component(DARK_PURPLE)
.translate(
key,
new Component(LIGHT_PURPLE).translate("trial.freeTrial"),
new Component(days, LIGHT_PURPLE)
)
.extra(" ")
.translate(
"trial.details",
new Component(LIGHT_PURPLE).translate("trial.joinFull"),
new Component(LIGHT_PURPLE).translate("trial.chooseTeam")
)
.extra(" ")
.translate(
"trial.upgrade",
Links.shopLink()
)
);
}
}
audience.sendMessage(new HeaderComponent(
new Component(ChatColor.GREEN)
.translate(