Readd trial rank handling code
This commit is contained in:
parent
2067e56aeb
commit
3adaaba5bc
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue