Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error.

This commit is contained in:
BONNe 2023-02-02 23:29:06 +02:00
parent ee8eaf8e84
commit 431aaf46fc
2 changed files with 25 additions and 4 deletions

View File

@ -1461,10 +1461,29 @@ public class TryToComplete
if (currentValue < requirements.getAmount())
{
Utils.sendMessage(this.user, this.user.getTranslation("challenges.errors.requirement-not-met",
TextVariables.NUMBER, String.valueOf(requirements.getAmount()),
"[statistic]", Utils.prettifyObject(requirements.getStatistic(), this.user),
"[value]", String.valueOf(currentValue)));
switch (Objects.requireNonNull(requirements.getStatistic()).getType())
{
case ITEM, BLOCK -> {
Utils.sendMessage(this.user, this.user.getTranslation("challenges.errors.requirement-not-met-material",
TextVariables.NUMBER, String.valueOf(requirements.getAmount()),
"[statistic]", Utils.prettifyObject(requirements.getStatistic(), this.user),
"[material]", Utils.prettifyObject(requirements.getMaterial(), this.user),
"[value]", String.valueOf(currentValue)));
}
case ENTITY -> {
Utils.sendMessage(this.user, this.user.getTranslation("challenges.errors.requirement-not-met-entity",
TextVariables.NUMBER, String.valueOf(requirements.getAmount()),
"[statistic]", Utils.prettifyObject(requirements.getStatistic(), this.user),
"[entity]", Utils.prettifyObject(requirements.getEntity(), this.user),
"[value]", String.valueOf(currentValue)));
}
default -> {
Utils.sendMessage(this.user, this.user.getTranslation("challenges.errors.requirement-not-met",
TextVariables.NUMBER, String.valueOf(requirements.getAmount()),
"[statistic]", Utils.prettifyObject(requirements.getStatistic(), this.user),
"[value]", String.valueOf(currentValue)));
}
}
}
else
{

View File

@ -1204,6 +1204,8 @@ challenges:
not-hooked: "&c Challenges Addon could not find any GameMode."
timeout: "&c This challenge requires to wait [timeout] between completions. You must wait [wait-time] till complete it again."
requirement-not-met: "&c This challenge requires [statistic] to have [number]. You have only [value]. "
requirement-not-met-entity: "&c This challenge requires [statistic] [entity] to have [number]. You have only [value]. "
requirement-not-met-material: "&c This challenge requires [statistic] [material] to have [number]. You have only [value]. "
# # Showcase for manual material translation
# materials:
# # Names should be lowercase.