mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-13 06:05:46 +01:00
Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error.
This commit is contained in:
parent
ee8eaf8e84
commit
431aaf46fc
@ -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
|
||||
{
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user