mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-31 21:48:00 +01:00
Rewards lore (#248)
* Ignore failing test because method now doesn't do anything. * Add spaces after color codes to make gitLocalize more accurate. * Added a rewards title and made the lore prettier.
This commit is contained in:
parent
dfeef0ab8c
commit
7060799bcc
@ -36,6 +36,7 @@ import world.bentobox.bentobox.BentoBox;
|
|||||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
import world.bentobox.bentobox.util.Util;
|
||||||
import world.bentobox.challenges.ChallengesAddon;
|
import world.bentobox.challenges.ChallengesAddon;
|
||||||
import world.bentobox.challenges.ChallengesManager;
|
import world.bentobox.challenges.ChallengesManager;
|
||||||
import world.bentobox.challenges.database.object.Challenge;
|
import world.bentobox.challenges.database.object.Challenge;
|
||||||
@ -231,19 +232,19 @@ public abstract class CommonGUI
|
|||||||
this.pageIndex = 0;
|
this.pageIndex = 0;
|
||||||
|
|
||||||
this.returnButton = new PanelItemBuilder().
|
this.returnButton = new PanelItemBuilder().
|
||||||
name(this.user.getTranslation("challenges.gui.buttons.return")).
|
name(this.user.getTranslation("challenges.gui.buttons.return")).
|
||||||
icon(Material.OAK_DOOR).
|
icon(Material.OAK_DOOR).
|
||||||
clickHandler((panel, user1, clickType, i) -> {
|
clickHandler((panel, user1, clickType, i) -> {
|
||||||
|
|
||||||
if (this.parentGUI == null)
|
if (this.parentGUI == null)
|
||||||
{
|
{
|
||||||
this.user.closeInventory();
|
this.user.closeInventory();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.parentGUI.build();
|
||||||
return true;
|
return true;
|
||||||
}
|
}).build();
|
||||||
|
|
||||||
this.parentGUI.build();
|
|
||||||
return true;
|
|
||||||
}).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -263,7 +264,6 @@ public abstract class CommonGUI
|
|||||||
* @param button Button that must be returned.
|
* @param button Button that must be returned.
|
||||||
* @return PanelItem with requested functionality.
|
* @return PanelItem with requested functionality.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
protected PanelItem getButton(CommonButtons button)
|
protected PanelItem getButton(CommonButtons button)
|
||||||
{
|
{
|
||||||
ItemStack icon;
|
ItemStack icon;
|
||||||
@ -344,213 +344,215 @@ public abstract class CommonGUI
|
|||||||
ChallengesManager manager = this.addon.getChallengesManager();
|
ChallengesManager manager = this.addon.getChallengesManager();
|
||||||
|
|
||||||
final boolean isCompletedOnce =
|
final boolean isCompletedOnce =
|
||||||
manager.isChallengeComplete(user.getUniqueId(), world, challenge);
|
manager.isChallengeComplete(user.getUniqueId(), world, challenge);
|
||||||
final long doneTimes = challenge.isRepeatable() ?
|
final long doneTimes = challenge.isRepeatable() ?
|
||||||
manager.getChallengeTimes(this.user, this.world, challenge) : isCompletedOnce ? 0 : 1;
|
manager.getChallengeTimes(this.user, this.world, challenge) : isCompletedOnce ? 0 : 1;
|
||||||
|
|
||||||
boolean isCompletedAll = isCompletedOnce && challenge.isRepeatable() &&
|
boolean isCompletedAll = isCompletedOnce && challenge.isRepeatable() &&
|
||||||
challenge.getMaxTimes() > 0 &&
|
challenge.getMaxTimes() > 0 &&
|
||||||
doneTimes >= challenge.getMaxTimes();
|
doneTimes >= challenge.getMaxTimes();
|
||||||
|
|
||||||
this.addon.getChallengesSettings().getChallengeLoreMessage().forEach(messagePart -> {
|
this.addon.getChallengesSettings().getChallengeLoreMessage().forEach(messagePart -> {
|
||||||
switch (messagePart)
|
switch (messagePart)
|
||||||
{
|
|
||||||
case LEVEL:
|
|
||||||
{
|
|
||||||
ChallengeLevel level = manager.getLevel(challenge);
|
|
||||||
|
|
||||||
if (level == null)
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.errors.missing-level",
|
|
||||||
"[level]", challenge.getLevel()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result.add(this.user
|
|
||||||
.getTranslation("challenges.gui.challenge-description.level",
|
|
||||||
"[level]", level.getFriendlyName()));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STATUS:
|
|
||||||
{
|
|
||||||
if (isCompletedOnce)
|
|
||||||
{
|
|
||||||
result.add(this.user
|
|
||||||
.getTranslation("challenges.gui.challenge-description.completed"));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case COUNT:
|
|
||||||
{
|
|
||||||
if (challenge.isRepeatable())
|
|
||||||
{
|
|
||||||
if (challenge.getMaxTimes() > 0)
|
|
||||||
{
|
|
||||||
if (isCompletedAll)
|
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation(
|
case LEVEL:
|
||||||
"challenges.gui.challenge-description.maxed-reached",
|
|
||||||
"[donetimes]",
|
|
||||||
String.valueOf(doneTimes),
|
|
||||||
"[maxtimes]",
|
|
||||||
String.valueOf(challenge.getMaxTimes())));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation(
|
ChallengeLevel level = manager.getLevel(challenge);
|
||||||
"challenges.gui.challenge-description.completed-times-of",
|
|
||||||
"[donetimes]",
|
|
||||||
String.valueOf(doneTimes),
|
|
||||||
"[maxtimes]",
|
|
||||||
String.valueOf(challenge.getMaxTimes())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation(
|
|
||||||
"challenges.gui.challenge-description.completed-times",
|
|
||||||
"[donetimes]",
|
|
||||||
String.valueOf(doneTimes)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DESCRIPTION:
|
|
||||||
{
|
|
||||||
result.addAll(challenge.getDescription());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WARNINGS:
|
|
||||||
{
|
|
||||||
if (!isCompletedAll)
|
|
||||||
{
|
|
||||||
if (challenge.getChallengeType().equals(Challenge.ChallengeType.INVENTORY))
|
|
||||||
{
|
|
||||||
if (challenge.<InventoryRequirements>getRequirements().isTakeItems())
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation(
|
|
||||||
"challenges.gui.challenge-description.warning-items-take"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (challenge.getChallengeType().equals(Challenge.ChallengeType.ISLAND))
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation(
|
|
||||||
"challenges.gui.challenge-description.objects-close-by"));
|
|
||||||
|
|
||||||
IslandRequirements requirements = challenge.getRequirements();
|
if (level == null)
|
||||||
|
{
|
||||||
if (requirements.isRemoveEntities() && !requirements.getRequiredEntities().isEmpty())
|
result.add(this.user.getTranslation("challenges.errors.missing-level",
|
||||||
{
|
"[level]", challenge.getLevel()));
|
||||||
result.add(this.user.getTranslation(
|
}
|
||||||
"challenges.gui.challenge-description.warning-entities-kill"));
|
else
|
||||||
}
|
{
|
||||||
|
result.add(this.user
|
||||||
if (requirements.isRemoveBlocks() && !requirements.getRequiredBlocks().isEmpty())
|
.getTranslation("challenges.gui.challenge-description.level",
|
||||||
{
|
"[level]", level.getFriendlyName()));
|
||||||
result.add(this.user.getTranslation(
|
}
|
||||||
"challenges.gui.challenge-description.warning-blocks-remove"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ENVIRONMENT:
|
|
||||||
{
|
|
||||||
// Display only if there are limited environments
|
|
||||||
|
|
||||||
if (!isCompletedAll &&
|
|
||||||
!challenge.getEnvironment().isEmpty() &&
|
|
||||||
challenge.getEnvironment().size() != 3)
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.challenge-description.environment"));
|
|
||||||
|
|
||||||
if (challenge.getEnvironment().contains(World.Environment.NORMAL))
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.descriptions.normal"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (challenge.getEnvironment().contains(World.Environment.NETHER))
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.descriptions.nether"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (challenge.getEnvironment().contains(World.Environment.THE_END))
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.descriptions.the-end"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case REQUIREMENTS:
|
|
||||||
{
|
|
||||||
if (!isCompletedAll)
|
|
||||||
{
|
|
||||||
switch (challenge.getChallengeType())
|
|
||||||
{
|
|
||||||
case INVENTORY:
|
|
||||||
result.addAll(this.getInventoryRequirements(challenge.getRequirements()));
|
|
||||||
break;
|
break;
|
||||||
case ISLAND:
|
}
|
||||||
result.addAll(this.getIslandRequirements(challenge.getRequirements()));
|
case STATUS:
|
||||||
|
{
|
||||||
|
if (isCompletedOnce)
|
||||||
|
{
|
||||||
|
result.add(this.user
|
||||||
|
.getTranslation("challenges.gui.challenge-description.completed"));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case OTHER:
|
}
|
||||||
result.addAll(this.getOtherRequirements(challenge.getRequirements()));
|
case COUNT:
|
||||||
|
{
|
||||||
|
if (challenge.isRepeatable())
|
||||||
|
{
|
||||||
|
if (challenge.getMaxTimes() > 0)
|
||||||
|
{
|
||||||
|
if (isCompletedAll)
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation(
|
||||||
|
"challenges.gui.challenge-description.maxed-reached",
|
||||||
|
"[donetimes]",
|
||||||
|
String.valueOf(doneTimes),
|
||||||
|
"[maxtimes]",
|
||||||
|
String.valueOf(challenge.getMaxTimes())));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation(
|
||||||
|
"challenges.gui.challenge-description.completed-times-of",
|
||||||
|
"[donetimes]",
|
||||||
|
String.valueOf(doneTimes),
|
||||||
|
"[maxtimes]",
|
||||||
|
String.valueOf(challenge.getMaxTimes())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation(
|
||||||
|
"challenges.gui.challenge-description.completed-times",
|
||||||
|
"[donetimes]",
|
||||||
|
String.valueOf(doneTimes)));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
case DESCRIPTION:
|
||||||
|
{
|
||||||
|
result.addAll(challenge.getDescription());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WARNINGS:
|
||||||
|
{
|
||||||
|
if (!isCompletedAll)
|
||||||
|
{
|
||||||
|
if (challenge.getChallengeType().equals(Challenge.ChallengeType.INVENTORY))
|
||||||
|
{
|
||||||
|
if (challenge.<InventoryRequirements>getRequirements().isTakeItems())
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation(
|
||||||
|
"challenges.gui.challenge-description.warning-items-take"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (challenge.getChallengeType().equals(Challenge.ChallengeType.ISLAND))
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation(
|
||||||
|
"challenges.gui.challenge-description.objects-close-by"));
|
||||||
|
|
||||||
break;
|
IslandRequirements requirements = challenge.getRequirements();
|
||||||
}
|
|
||||||
case REWARD_TEXT:
|
|
||||||
{
|
|
||||||
if (isCompletedAll)
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.challenge-description.not-repeatable"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isCompletedOnce)
|
|
||||||
{
|
|
||||||
result.add(challenge.getRepeatRewardText());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result.add(challenge.getRewardText());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case REWARD_OTHER:
|
|
||||||
{
|
|
||||||
if (!isCompletedAll)
|
|
||||||
{
|
|
||||||
result.addAll(this.getChallengeRewardOthers(challenge, isCompletedOnce));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case REWARD_ITEMS:
|
|
||||||
{
|
|
||||||
if (!isCompletedAll)
|
|
||||||
{
|
|
||||||
result.addAll(this.getChallengeRewardItems(challenge, isCompletedOnce));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case REWARD_COMMANDS:
|
|
||||||
{
|
|
||||||
if (!isCompletedAll)
|
|
||||||
{
|
|
||||||
result.addAll(this.getChallengeRewardCommands(challenge, isCompletedOnce, user));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
result.replaceAll(x -> x.replace("[label]", this.topLabel));
|
if (requirements.isRemoveEntities() && !requirements.getRequiredEntities().isEmpty())
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation(
|
||||||
|
"challenges.gui.challenge-description.warning-entities-kill"));
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
if (requirements.isRemoveBlocks() && !requirements.getRequiredBlocks().isEmpty())
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation(
|
||||||
|
"challenges.gui.challenge-description.warning-blocks-remove"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ENVIRONMENT:
|
||||||
|
{
|
||||||
|
// Display only if there are limited environments
|
||||||
|
|
||||||
|
if (!isCompletedAll &&
|
||||||
|
!challenge.getEnvironment().isEmpty() &&
|
||||||
|
challenge.getEnvironment().size() != 3)
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation("challenges.gui.challenge-description.environment"));
|
||||||
|
|
||||||
|
if (challenge.getEnvironment().contains(World.Environment.NORMAL))
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation("challenges.gui.descriptions.normal"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (challenge.getEnvironment().contains(World.Environment.NETHER))
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation("challenges.gui.descriptions.nether"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (challenge.getEnvironment().contains(World.Environment.THE_END))
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation("challenges.gui.descriptions.the-end"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REQUIREMENTS:
|
||||||
|
{
|
||||||
|
if (!isCompletedAll)
|
||||||
|
{
|
||||||
|
switch (challenge.getChallengeType())
|
||||||
|
{
|
||||||
|
case INVENTORY:
|
||||||
|
result.addAll(this.getInventoryRequirements(challenge.getRequirements()));
|
||||||
|
break;
|
||||||
|
case ISLAND:
|
||||||
|
result.addAll(this.getIslandRequirements(challenge.getRequirements()));
|
||||||
|
break;
|
||||||
|
case OTHER:
|
||||||
|
result.addAll(this.getOtherRequirements(challenge.getRequirements()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REWARD_TEXT:
|
||||||
|
{
|
||||||
|
if (isCompletedAll)
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation("challenges.gui.challenge-description.not-repeatable"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Show a title to the rewards
|
||||||
|
result.add(this.user.getTranslation("challenges.gui.challenge-description.rewards-title"));
|
||||||
|
if (isCompletedOnce)
|
||||||
|
{
|
||||||
|
result.add(challenge.getRepeatRewardText());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.add(challenge.getRewardText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REWARD_OTHER:
|
||||||
|
{
|
||||||
|
if (!isCompletedAll)
|
||||||
|
{
|
||||||
|
result.addAll(this.getChallengeRewardOthers(challenge, isCompletedOnce));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REWARD_ITEMS:
|
||||||
|
{
|
||||||
|
if (!isCompletedAll)
|
||||||
|
{
|
||||||
|
result.addAll(this.getChallengeRewardItems(challenge, isCompletedOnce));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REWARD_COMMANDS:
|
||||||
|
{
|
||||||
|
if (!isCompletedAll)
|
||||||
|
{
|
||||||
|
result.addAll(this.getChallengeRewardCommands(challenge, isCompletedOnce, user));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
result.replaceAll(x -> x.replace("[label]", this.topLabel));
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -661,7 +663,7 @@ public abstract class CommonGUI
|
|||||||
for (String command : rewardCommands)
|
for (String command : rewardCommands)
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.descriptions.command",
|
result.add(this.user.getTranslation("challenges.gui.descriptions.command",
|
||||||
"[command]", command.replace("[player]", user.getName()).replace("[SELF]", "")));
|
"[command]", command.replace("[player]", user.getName()).replace("[SELF]", "")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,7 +720,7 @@ public abstract class CommonGUI
|
|||||||
result.add(this.user.getTranslation("challenges.gui.challenge-description.required-items"));
|
result.add(this.user.getTranslation("challenges.gui.challenge-description.required-items"));
|
||||||
|
|
||||||
Utils.groupEqualItems(requirements.getRequiredItems()).forEach(itemStack ->
|
Utils.groupEqualItems(requirements.getRequiredItems()).forEach(itemStack ->
|
||||||
result.addAll(this.generateItemStackDescription(itemStack)));
|
result.addAll(this.generateItemStackDescription(itemStack)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -744,7 +746,7 @@ public abstract class CommonGUI
|
|||||||
for (Map.Entry<Material, Integer> entry : challenge.getRequiredBlocks().entrySet())
|
for (Map.Entry<Material, Integer> entry : challenge.getRequiredBlocks().entrySet())
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.descriptions.block",
|
result.add(this.user.getTranslation("challenges.gui.descriptions.block",
|
||||||
"[block]", entry.getKey().name(),
|
"[block]", Util.prettifyText(entry.getKey().name()),
|
||||||
"[count]", Integer.toString(entry.getValue())));
|
"[count]", Integer.toString(entry.getValue())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -757,7 +759,7 @@ public abstract class CommonGUI
|
|||||||
for (Map.Entry<EntityType, Integer> entry : challenge.getRequiredEntities().entrySet())
|
for (Map.Entry<EntityType, Integer> entry : challenge.getRequiredEntities().entrySet())
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.descriptions.entity",
|
result.add(this.user.getTranslation("challenges.gui.descriptions.entity",
|
||||||
"[entity]", entry.getKey().name(),
|
"[entity]", Util.prettifyText(entry.getKey().name()),
|
||||||
"[count]", Integer.toString(entry.getValue())));
|
"[count]", Integer.toString(entry.getValue())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -787,105 +789,105 @@ public abstract class CommonGUI
|
|||||||
|
|
||||||
// Check if unlock message should appear.
|
// Check if unlock message should appear.
|
||||||
boolean hasCompletedOne = status.isComplete() || status.isUnlocked() &&
|
boolean hasCompletedOne = status.isComplete() || status.isUnlocked() &&
|
||||||
level.getChallenges().stream().anyMatch(challenge ->
|
level.getChallenges().stream().anyMatch(challenge ->
|
||||||
this.addon.getChallengesManager().isChallengeComplete(user.getUniqueId(), world, challenge));
|
this.addon.getChallengesManager().isChallengeComplete(user.getUniqueId(), world, challenge));
|
||||||
|
|
||||||
this.addon.getChallengesSettings().getLevelLoreMessage().forEach(messagePart -> {
|
this.addon.getChallengesSettings().getLevelLoreMessage().forEach(messagePart -> {
|
||||||
switch (messagePart)
|
switch (messagePart)
|
||||||
{
|
{
|
||||||
case LEVEL_STATUS:
|
case LEVEL_STATUS:
|
||||||
|
{
|
||||||
|
if (status.isComplete())
|
||||||
{
|
{
|
||||||
if (status.isComplete())
|
result.add(this.user.getTranslation("challenges.gui.level-description.completed"));
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.level-description.completed"));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case CHALLENGE_COUNT:
|
break;
|
||||||
|
}
|
||||||
|
case CHALLENGE_COUNT:
|
||||||
|
{
|
||||||
|
if (!status.isComplete() && status.isUnlocked())
|
||||||
{
|
{
|
||||||
if (!status.isComplete() && status.isUnlocked())
|
int doneChallengeCount = (int) level.getChallenges().stream().
|
||||||
{
|
|
||||||
int doneChallengeCount = (int) level.getChallenges().stream().
|
|
||||||
filter(challenge -> this.addon.getChallengesManager().isChallengeComplete(user.getUniqueId(), world, challenge)).
|
filter(challenge -> this.addon.getChallengesManager().isChallengeComplete(user.getUniqueId(), world, challenge)).
|
||||||
count();
|
count();
|
||||||
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.level-description.completed-challenges-of",
|
result.add(this.user.getTranslation("challenges.gui.level-description.completed-challenges-of",
|
||||||
"[number]", Integer.toString(doneChallengeCount),
|
"[number]", Integer.toString(doneChallengeCount),
|
||||||
"[max]", Integer.toString(level.getChallenges().size())));
|
"[max]", Integer.toString(level.getChallenges().size())));
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case UNLOCK_MESSAGE:
|
|
||||||
{
|
|
||||||
if (!hasCompletedOne)
|
|
||||||
{
|
|
||||||
result.add(level.getUnlockMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WAIVER_AMOUNT:
|
case UNLOCK_MESSAGE:
|
||||||
|
{
|
||||||
|
if (!hasCompletedOne)
|
||||||
{
|
{
|
||||||
if (status.isUnlocked() && !status.isComplete())
|
result.add(level.getUnlockMessage());
|
||||||
{
|
}
|
||||||
result.add(this.user.getTranslation("challenges.gui.level-description.waver-amount",
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WAIVER_AMOUNT:
|
||||||
|
{
|
||||||
|
if (status.isUnlocked() && !status.isComplete())
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation("challenges.gui.level-description.waver-amount",
|
||||||
"[value]", Integer.toString(level.getWaiverAmount())));
|
"[value]", Integer.toString(level.getWaiverAmount())));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LEVEL_REWARD_TEXT:
|
||||||
|
{
|
||||||
|
if (status.isUnlocked() && !status.isComplete())
|
||||||
|
{
|
||||||
|
result.add(level.getRewardText());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LEVEL_REWARD_OTHER:
|
||||||
|
{
|
||||||
|
if (status.isUnlocked() && !status.isComplete())
|
||||||
|
{
|
||||||
|
if (level.getRewardExperience() > 0)
|
||||||
|
{
|
||||||
|
result.add(this.user.getTranslation("challenges.gui.level-description.experience-reward",
|
||||||
|
"[value]", Integer.toString(level.getRewardExperience())));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
if (this.addon.isEconomyProvided() && level.getRewardMoney() > 0)
|
||||||
}
|
|
||||||
case LEVEL_REWARD_TEXT:
|
|
||||||
{
|
|
||||||
if (status.isUnlocked() && !status.isComplete())
|
|
||||||
{
|
{
|
||||||
result.add(level.getRewardText());
|
result.add(this.user.getTranslation("challenges.gui.level-description.money-reward",
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case LEVEL_REWARD_OTHER:
|
|
||||||
{
|
|
||||||
if (status.isUnlocked() && !status.isComplete())
|
|
||||||
{
|
|
||||||
if (level.getRewardExperience() > 0)
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.level-description.experience-reward",
|
|
||||||
"[value]", Integer.toString(level.getRewardExperience())));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.addon.isEconomyProvided() && level.getRewardMoney() > 0)
|
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.level-description.money-reward",
|
|
||||||
"[value]", Integer.toString(level.getRewardMoney())));
|
"[value]", Integer.toString(level.getRewardMoney())));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case LEVEL_REWARD_ITEMS:
|
break;
|
||||||
|
}
|
||||||
|
case LEVEL_REWARD_ITEMS:
|
||||||
|
{
|
||||||
|
if (status.isUnlocked() && !status.isComplete() && !level.getRewardItems().isEmpty())
|
||||||
{
|
{
|
||||||
if (status.isUnlocked() && !status.isComplete() && !level.getRewardItems().isEmpty())
|
result.add(this.user.getTranslation("challenges.gui.level-description.reward-items"));
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.level-description.reward-items"));
|
|
||||||
|
|
||||||
Utils.groupEqualItems(level.getRewardItems()).forEach(itemStack ->
|
Utils.groupEqualItems(level.getRewardItems()).forEach(itemStack ->
|
||||||
result.addAll(this.generateItemStackDescription(itemStack)));
|
result.addAll(this.generateItemStackDescription(itemStack)));
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case LEVEL_REWARD_COMMANDS:
|
break;
|
||||||
|
}
|
||||||
|
case LEVEL_REWARD_COMMANDS:
|
||||||
|
{
|
||||||
|
if (status.isUnlocked() && !status.isComplete() && !level.getRewardCommands().isEmpty())
|
||||||
{
|
{
|
||||||
if (status.isUnlocked() && !status.isComplete() && !level.getRewardCommands().isEmpty())
|
result.add(this.user.getTranslation("challenges.gui.level-description.reward-commands"));
|
||||||
{
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.level-description.reward-commands"));
|
|
||||||
|
|
||||||
for (String command : level.getRewardCommands())
|
for (String command : level.getRewardCommands())
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.descriptions.command",
|
result.add(this.user.getTranslation("challenges.gui.descriptions.command",
|
||||||
"[command]", command.replace("[player]", user.getName()).replace("[SELF]", "")));
|
"[command]", command.replace("[player]", user.getName()).replace("[SELF]", "")));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -905,12 +907,13 @@ public abstract class CommonGUI
|
|||||||
* @param itemStack Object which lore must be generated
|
* @param itemStack Object which lore must be generated
|
||||||
* @return List with generated description
|
* @return List with generated description
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected List<String> generateItemStackDescription(ItemStack itemStack)
|
protected List<String> generateItemStackDescription(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
|
|
||||||
result.add(this.user.getTranslation("challenges.gui.item-description.item",
|
result.add(this.user.getTranslation("challenges.gui.item-description.item",
|
||||||
"[item]", itemStack.getType().name(),
|
"[item]", Util.prettifyText(itemStack.getType().name()),
|
||||||
"[count]", Integer.toString(itemStack.getAmount())));
|
"[count]", Integer.toString(itemStack.getAmount())));
|
||||||
|
|
||||||
if (itemStack.hasItemMeta())
|
if (itemStack.hasItemMeta())
|
||||||
@ -959,22 +962,22 @@ public abstract class CommonGUI
|
|||||||
if (data.isExtended() && data.isUpgraded())
|
if (data.isExtended() && data.isUpgraded())
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.item-description.potion-type-extended-upgraded",
|
result.add(this.user.getTranslation("challenges.gui.item-description.potion-type-extended-upgraded",
|
||||||
"[name]", data.getType().name()));
|
"[name]", Util.prettifyText(data.getType().name())));
|
||||||
}
|
}
|
||||||
else if (data.isUpgraded())
|
else if (data.isUpgraded())
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.item-description.potion-type-upgraded",
|
result.add(this.user.getTranslation("challenges.gui.item-description.potion-type-upgraded",
|
||||||
"[name]", data.getType().name()));
|
"[name]", Util.prettifyText(data.getType().name())));
|
||||||
}
|
}
|
||||||
else if (data.isExtended())
|
else if (data.isExtended())
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.item-description.potion-type-extended",
|
result.add(this.user.getTranslation("challenges.gui.item-description.potion-type-extended",
|
||||||
"[name]", data.getType().name()));
|
"[name]", Util.prettifyText(data.getType().name())));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.item-description.potion-type",
|
result.add(this.user.getTranslation("challenges.gui.item-description.potion-type",
|
||||||
"[name]", data.getType().name()));
|
"[name]", Util.prettifyText(data.getType().name())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((PotionMeta) meta).hasCustomEffects())
|
if (((PotionMeta) meta).hasCustomEffects())
|
||||||
@ -983,7 +986,7 @@ public abstract class CommonGUI
|
|||||||
|
|
||||||
((PotionMeta) meta).getCustomEffects().forEach(potionEffect ->
|
((PotionMeta) meta).getCustomEffects().forEach(potionEffect ->
|
||||||
result.add(this.user.getTranslation("challenges.gui.item-description.potion-effect",
|
result.add(this.user.getTranslation("challenges.gui.item-description.potion-effect",
|
||||||
"[effect]", potionEffect.getType().getName(),
|
"[effect]", Util.prettifyText(potionEffect.getType().getName()),
|
||||||
"[duration]", Integer.toString(potionEffect.getDuration()),
|
"[duration]", Integer.toString(potionEffect.getDuration()),
|
||||||
"[amplifier]", Integer.toString(potionEffect.getAmplifier()))));
|
"[amplifier]", Integer.toString(potionEffect.getAmplifier()))));
|
||||||
}
|
}
|
||||||
@ -999,14 +1002,14 @@ public abstract class CommonGUI
|
|||||||
else if (meta instanceof SpawnEggMeta)
|
else if (meta instanceof SpawnEggMeta)
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.item-description.egg-meta",
|
result.add(this.user.getTranslation("challenges.gui.item-description.egg-meta",
|
||||||
"[mob]", ((SpawnEggMeta) meta).getSpawnedType().name()));
|
"[mob]", Util.prettifyText(((SpawnEggMeta) meta).getSpawnedType().name())));
|
||||||
}
|
}
|
||||||
else if (meta instanceof TropicalFishBucketMeta)
|
else if (meta instanceof TropicalFishBucketMeta)
|
||||||
{
|
{
|
||||||
result.add(this.user.getTranslation("challenges.gui.item-description.fish-meta",
|
result.add(this.user.getTranslation("challenges.gui.item-description.fish-meta",
|
||||||
"[pattern]", ((TropicalFishBucketMeta) meta).getPattern().name(),
|
"[pattern]", Util.prettifyText(((TropicalFishBucketMeta) meta).getPattern().name()),
|
||||||
"[pattern-color]", ((TropicalFishBucketMeta) meta).getPatternColor().name(),
|
"[pattern-color]", Util.prettifyText(((TropicalFishBucketMeta) meta).getPatternColor().name()),
|
||||||
"[body-color]", ((TropicalFishBucketMeta) meta).getBodyColor().name()));
|
"[body-color]", Util.prettifyText(((TropicalFishBucketMeta) meta).getBodyColor().name())));
|
||||||
// parse ne
|
// parse ne
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1026,9 +1029,9 @@ public abstract class CommonGUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// Section: Chat Input Methods
|
// Section: Chat Input Methods
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1043,44 +1046,44 @@ public abstract class CommonGUI
|
|||||||
final User user = this.user;
|
final User user = this.user;
|
||||||
|
|
||||||
Conversation conversation =
|
Conversation conversation =
|
||||||
new ConversationFactory(BentoBox.getInstance()).withFirstPrompt(
|
new ConversationFactory(BentoBox.getInstance()).withFirstPrompt(
|
||||||
new StringPrompt()
|
new StringPrompt()
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @see Prompt#getPromptText(ConversationContext)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getPromptText(ConversationContext conversationContext)
|
|
||||||
{
|
|
||||||
// Close input GUI.
|
|
||||||
user.closeInventory();
|
|
||||||
|
|
||||||
if (message != null)
|
|
||||||
{
|
{
|
||||||
// Create Edit Text message.
|
/**
|
||||||
TextComponent component = new TextComponent(user.getTranslation("challenges.gui.descriptions.admin.click-to-edit"));
|
* @see Prompt#getPromptText(ConversationContext)
|
||||||
component.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, message));
|
*/
|
||||||
// Send question and message to player.
|
@Override
|
||||||
user.getPlayer().spigot().sendMessage(component);
|
public String getPromptText(ConversationContext conversationContext)
|
||||||
}
|
{
|
||||||
|
// Close input GUI.
|
||||||
|
user.closeInventory();
|
||||||
|
|
||||||
// There are no editable message. Just return question.
|
if (message != null)
|
||||||
return question;
|
{
|
||||||
}
|
// Create Edit Text message.
|
||||||
|
TextComponent component = new TextComponent(user.getTranslation("challenges.gui.descriptions.admin.click-to-edit"));
|
||||||
|
component.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, message));
|
||||||
|
// Send question and message to player.
|
||||||
|
user.getPlayer().spigot().sendMessage(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
// There are no editable message. Just return question.
|
||||||
|
return question;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Prompt#acceptInput(ConversationContext, String)
|
* @see Prompt#acceptInput(ConversationContext, String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext conversationContext, String answer)
|
public Prompt acceptInput(ConversationContext conversationContext, String answer)
|
||||||
{
|
{
|
||||||
// Add answer to consumer.
|
// Add answer to consumer.
|
||||||
consumer.accept(answer);
|
consumer.accept(answer);
|
||||||
// End conversation
|
// End conversation
|
||||||
return Prompt.END_OF_CONVERSATION;
|
return Prompt.END_OF_CONVERSATION;
|
||||||
}
|
}
|
||||||
}).
|
}).
|
||||||
withLocalEcho(false).
|
withLocalEcho(false).
|
||||||
// On cancel conversation will be closed.
|
// On cancel conversation will be closed.
|
||||||
withEscapeSequence("cancel").
|
withEscapeSequence("cancel").
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -54,35 +54,35 @@ challenges:
|
|||||||
gui:
|
gui:
|
||||||
title:
|
title:
|
||||||
admin:
|
admin:
|
||||||
gui-title: '&aChallenges Admin'
|
gui-title: '&a Challenges Admin'
|
||||||
edit-challenge-title: '&aEdit Challenge'
|
edit-challenge-title: '&a Edit Challenge'
|
||||||
edit-level-title: '&aEdit Level'
|
edit-level-title: '&a Edit Level'
|
||||||
settings-title: '&aEdit Settings'
|
settings-title: '&a Edit Settings'
|
||||||
choose-challenge-title: '&aChoose Challenge'
|
choose-challenge-title: '&a Choose Challenge'
|
||||||
choose-level-title: '&aChoose Level'
|
choose-level-title: '&a Choose Level'
|
||||||
choose-user-title: '&aChoose Player'
|
choose-user-title: '&a Choose Player'
|
||||||
manage-blocks: '&aManage Blocks'
|
manage-blocks: '&a Manage Blocks'
|
||||||
manage-entities: '&aManage Entities'
|
manage-entities: '&a Manage Entities'
|
||||||
confirm-title: '&aConfirmation'
|
confirm-title: '&a Confirmation'
|
||||||
manage-items: '&aManage Items'
|
manage-items: '&a Manage Items'
|
||||||
manage-numbers: '&aNumber Pad'
|
manage-numbers: '&a Number Pad'
|
||||||
select-block: '&aSelect Block'
|
select-block: '&a Select Block'
|
||||||
select-challenge: '&aSelect Challenge'
|
select-challenge: '&a Select Challenge'
|
||||||
select-entity: '&aSelect Entity'
|
select-entity: '&a Select Entity'
|
||||||
toggle-environment: '&aToggle Environment'
|
toggle-environment: '&a Toggle Environment'
|
||||||
edit-text-fields: '&aEdit Text Fields'
|
edit-text-fields: '&a Edit Text Fields'
|
||||||
|
|
||||||
library-title: '&aDownloadable Libraries'
|
library-title: '&a Downloadable Libraries'
|
||||||
|
|
||||||
lore-add: '&aAdd Lore Element'
|
lore-add: '&a Add Lore Element'
|
||||||
lore-remove: '&aRemove Lore Element'
|
lore-remove: '&a Remove Lore Element'
|
||||||
lore-edit: '&aEdit Lore'
|
lore-edit: '&a Edit Lore'
|
||||||
|
|
||||||
type-select: "&aChoose Challenge Type"
|
type-select: "&a Choose Challenge Type"
|
||||||
challenges: '&6Challenges'
|
challenges: '&6 Challenges'
|
||||||
game-modes: '&6Choose GameMode'
|
game-modes: '&6 Choose GameMode'
|
||||||
|
|
||||||
multiple-complete: '&6How many times?'
|
multiple-complete: '&6 How many times?'
|
||||||
buttons:
|
buttons:
|
||||||
admin:
|
admin:
|
||||||
complete: 'Complete user challenge'
|
complete: 'Complete user challenge'
|
||||||
@ -180,9 +180,9 @@ challenges:
|
|||||||
download: 'Download Libraries'
|
download: 'Download Libraries'
|
||||||
|
|
||||||
type:
|
type:
|
||||||
island: '&6Island Type'
|
island: '&6 Island Type'
|
||||||
inventory: '&6Inventory Type'
|
inventory: '&6 Inventory Type'
|
||||||
other: '&6Other Type'
|
other: '&6 Other Type'
|
||||||
next: 'Next'
|
next: 'Next'
|
||||||
previous: 'Previous'
|
previous: 'Previous'
|
||||||
return: 'Return'
|
return: 'Return'
|
||||||
@ -252,13 +252,13 @@ challenges:
|
|||||||
remove-experience: 'Remove required experience.'
|
remove-experience: 'Remove required experience.'
|
||||||
required-level: |-
|
required-level: |-
|
||||||
Define the required island level for this challenge.
|
Define the required island level for this challenge.
|
||||||
&cRequires Level addon.'
|
&c Requires Level addon.'
|
||||||
required-money: |-
|
required-money: |-
|
||||||
Define the required money in player"s account.
|
Define the required money in player"s account.
|
||||||
&cRequires Vault and an Economy plugin.'
|
&c Requires Vault and an Economy plugin.'
|
||||||
remove-money: |-
|
remove-money: |-
|
||||||
Remove required money from player"s account.
|
Remove required money from player"s account.
|
||||||
&cRequires Vault and an Economy plugin.'
|
&c Requires Vault and an Economy plugin.'
|
||||||
reward-text: 'Change message that will be sent to player after challenges completion.'
|
reward-text: 'Change message that will be sent to player after challenges completion.'
|
||||||
reward-items: |-
|
reward-items: |-
|
||||||
Change first time completion reward items.
|
Change first time completion reward items.
|
||||||
@ -266,7 +266,7 @@ challenges:
|
|||||||
reward-experience: 'Change first time completion reward experience.'
|
reward-experience: 'Change first time completion reward experience.'
|
||||||
reward-money: |-
|
reward-money: |-
|
||||||
Change first time completion reward money.
|
Change first time completion reward money.
|
||||||
&cRequires Vault and Economy plugin.
|
&c Requires Vault and Economy plugin.
|
||||||
reward-commands: |-
|
reward-commands: |-
|
||||||
Define reward commands that will be called after first time completion.
|
Define reward commands that will be called after first time completion.
|
||||||
***Adding "[SELF]" at the start means that command will be run by player, e.g. "/kill"
|
***Adding "[SELF]" at the start means that command will be run by player, e.g. "/kill"
|
||||||
@ -281,7 +281,7 @@ challenges:
|
|||||||
repeat-reward-experience: 'Change repeated completion reward experience.'
|
repeat-reward-experience: 'Change repeated completion reward experience.'
|
||||||
repeat-reward-money: |-
|
repeat-reward-money: |-
|
||||||
Change repeated completion reward money.
|
Change repeated completion reward money.
|
||||||
&cRequires Vault and an Economy plugin.
|
&c Requires Vault and an Economy plugin.
|
||||||
repeat-reward-commands: |-
|
repeat-reward-commands: |-
|
||||||
Define reward commands that will be executed after challenge repeated completion.
|
Define reward commands that will be executed after challenge repeated completion.
|
||||||
***Adding "[SELF]" at the start means that command will be run by player, e.g. "/kill"
|
***Adding "[SELF]" at the start means that command will be run by player, e.g. "/kill"
|
||||||
@ -315,18 +315,18 @@ challenges:
|
|||||||
0 means forever.
|
0 means forever.
|
||||||
island-store: |-
|
island-store: |-
|
||||||
Enable/disable challenges data storing per island. This means that challenges will be the same for the whole team if this is enabled.
|
Enable/disable challenges data storing per island. This means that challenges will be the same for the whole team if this is enabled.
|
||||||
&cWill NOT convert data on click. PROGRESS WILL BE LOST.'
|
&c Will NOT convert data on click. PROGRESS WILL BE LOST.'
|
||||||
default-locked-icon: |-
|
default-locked-icon: |-
|
||||||
Change default locked level icon.
|
Change default locked level icon.
|
||||||
This option can be overwritten by each level.'
|
This option can be overwritten by each level.'
|
||||||
gui-mode: |-
|
gui-mode: |-
|
||||||
Enable/disable single challenges GUI.
|
Enable/disable single challenges GUI.
|
||||||
&2Requires a server restart.'
|
&2 Requires a server restart.'
|
||||||
visibility-mode: 'Show/hide undeployed challenges.'
|
visibility-mode: 'Show/hide undeployed challenges.'
|
||||||
|
|
||||||
click-to-edit: '&4Click here to edit input.'
|
click-to-edit: '&4 Click here to edit input.'
|
||||||
edit-text-line: '&6Edit text message!'
|
edit-text-line: '&6 Edit text message!'
|
||||||
add-text-line: '&6Add new text message!'
|
add-text-line: '&6 Add new text message!'
|
||||||
input-mode: 'Switch between chat and anvil input modes.'
|
input-mode: 'Switch between chat and anvil input modes.'
|
||||||
title-enable: 'Enable/disable the title message that will be shown to player"s when they complete a challenge.'
|
title-enable: 'Enable/disable the title message that will be shown to player"s when they complete a challenge.'
|
||||||
title-showtime: 'Modify how long title messages will be visible to the player.'
|
title-showtime: 'Modify how long title messages will be visible to the player.'
|
||||||
@ -339,10 +339,10 @@ challenges:
|
|||||||
|
|
||||||
library: 'Open GUI that shows all available public Challenges Libraries.'
|
library: 'Open GUI that shows all available public Challenges Libraries.'
|
||||||
|
|
||||||
library-author: 'by &e[author]'
|
library-author: 'by &e [author]'
|
||||||
library-version: '&9Made in Challenges [version]'
|
library-version: '&9 Made in Challenges [version]'
|
||||||
library-lang: '&aLanguage: [lang]'
|
library-lang: '&a Language: [lang]'
|
||||||
library-gamemode: '&aPrimary for [gamemode]'
|
library-gamemode: '&a Primary for [gamemode]'
|
||||||
|
|
||||||
download: |-
|
download: |-
|
||||||
Manually update available challenges libraries.
|
Manually update available challenges libraries.
|
||||||
@ -425,13 +425,13 @@ challenges:
|
|||||||
Reward commands.
|
Reward commands.
|
||||||
List of commands that will be rewarded defined in challengeLevel.rewardCommands
|
List of commands that will be rewarded defined in challengeLevel.rewardCommands
|
||||||
current-value: |-
|
current-value: |-
|
||||||
&6Current value: [value].
|
&6 Current value: [value].
|
||||||
enabled: 'Active'
|
enabled: 'Active'
|
||||||
disabled: 'Disabled'
|
disabled: 'Disabled'
|
||||||
type:
|
type:
|
||||||
island: '&arequire blocks or mobs around player'
|
island: '&a require blocks or mobs around player'
|
||||||
inventory: '&arequire items in the player"s inventory'
|
inventory: '&a require items in the player"s inventory'
|
||||||
other: '&arequire things from other plugins/addons'
|
other: '&a require things from other plugins/addons'
|
||||||
the-end: '- The End'
|
the-end: '- The End'
|
||||||
nether: '- Nether'
|
nether: '- Nether'
|
||||||
normal: '- Overworld'
|
normal: '- Overworld'
|
||||||
@ -445,8 +445,8 @@ challenges:
|
|||||||
level-unlocked: 'Click to see [level] challenges!'
|
level-unlocked: 'Click to see [level] challenges!'
|
||||||
level-locked: 'Complete [count] more [level] challenges to unlock this level!'
|
level-locked: 'Complete [count] more [level] challenges to unlock this level!'
|
||||||
|
|
||||||
increase-by: "&aIncrease completion count by [value]"
|
increase-by: "&a Increase completion count by [value]"
|
||||||
reduce-by: "&cReduce completion count by [value]"
|
reduce-by: "&c Reduce completion count by [value]"
|
||||||
|
|
||||||
visibility:
|
visibility:
|
||||||
visible: "All challenges are visible to everyone"
|
visible: "All challenges are visible to everyone"
|
||||||
@ -454,35 +454,36 @@ challenges:
|
|||||||
toggleable: "Toggle if undeployed challenges should be displayed"
|
toggleable: "Toggle if undeployed challenges should be displayed"
|
||||||
|
|
||||||
challenge-description:
|
challenge-description:
|
||||||
level: '&fLevel: [level]'
|
level: '&f Level: [level]'
|
||||||
completed: '&bCompleted'
|
completed: '&b Completed'
|
||||||
completed-times-of: 'Completed [donetimes] out of [maxtimes]'
|
completed-times-of: 'Completed [donetimes] out of [maxtimes]'
|
||||||
maxed-reached: 'Completed [donetimes] out of [maxtimes]'
|
maxed-reached: 'Completed [donetimes] out of [maxtimes]'
|
||||||
completed-times: 'Completed [donetimes]'
|
completed-times: 'Completed [donetimes]'
|
||||||
warning-items-take: '&cAll required items are taken from your inventory when you complete this challenge!'
|
warning-items-take: '&c All required items are taken from your inventory when you complete this challenge!'
|
||||||
objects-close-by: '&cAll required blocks and entities must be close to you on your island!'
|
objects-close-by: '&c All required blocks and entities must be close to you on your island!'
|
||||||
warning-entities-kill: '&cAll required entities will be killed when you complete this challenge!'
|
warning-entities-kill: '&c All required entities will be killed when you complete this challenge!'
|
||||||
warning-blocks-remove: '&cAll required blocks will be removed when you complete this challenge!'
|
warning-blocks-remove: '&c All required blocks will be removed when you complete this challenge!'
|
||||||
not-repeatable: '&cThis challenge is not repeatable!'
|
not-repeatable: '&c This challenge is not repeatable!'
|
||||||
experience-reward: '&6Exp reward: [value]'
|
experience-reward: '&6 Exp reward: [value]'
|
||||||
money-reward: '&6Money reward: $[value]'
|
money-reward: '&6 Money reward: $[value]'
|
||||||
required-experience: '&6Required exp: [value]'
|
required-experience: '&6 Required exp: [value]'
|
||||||
required-money: '&6Required money: $[value]'
|
required-money: '&6 Required money: $[value]'
|
||||||
required-island-level: '&6Required island level: [value]'
|
required-island-level: '&6 Required island level: [value]'
|
||||||
environment: 'Required Environments:'
|
environment: 'Required Environments:'
|
||||||
reward-items: '&6Reward Items:'
|
rewards-title: '&a Rewards:'
|
||||||
reward-commands: '&6Reward Commands:'
|
reward-items: '&6 Reward Items:'
|
||||||
|
reward-commands: '&6 Reward Commands:'
|
||||||
required-items: 'Required Items:'
|
required-items: 'Required Items:'
|
||||||
required-entities: 'Required Entities:'
|
required-entities: 'Required Entities:'
|
||||||
required-blocks: 'Required Blocks:'
|
required-blocks: 'Required Blocks:'
|
||||||
level-description:
|
level-description:
|
||||||
completed: '&bCompleted'
|
completed: '&b Completed'
|
||||||
completed-challenges-of: '&3You have completed [number] out of [max] challenges in this level.'
|
completed-challenges-of: '&3 You have completed [number] out of [max] challenges in this level.'
|
||||||
waver-amount: '&6[value] challenges can be skipped to unlock next level.'
|
waver-amount: '&6 [value] challenges can be skipped to unlock next level.'
|
||||||
experience-reward: '&6Exp reward: [value]'
|
experience-reward: '&6 Exp reward: [value]'
|
||||||
money-reward: '&6Money reward: $[value]'
|
money-reward: '&6 Money reward: $[value]'
|
||||||
reward-items: '&6Reward Items:'
|
reward-items: '&6 Reward Items:'
|
||||||
reward-commands: '&6Reward Commands:'
|
reward-commands: '&6 Reward Commands:'
|
||||||
item-description:
|
item-description:
|
||||||
item: '- [count] x [item]'
|
item: '- [count] x [item]'
|
||||||
item-meta: ' ([meta])'
|
item-meta: ' ([meta])'
|
||||||
@ -503,7 +504,7 @@ challenges:
|
|||||||
fish-meta: ' [body-color] with [pattern-color] [pattern]'
|
fish-meta: ' [body-color] with [pattern-color] [pattern]'
|
||||||
|
|
||||||
questions:
|
questions:
|
||||||
prefix: "&2[SERVER]: "
|
prefix: "&2 [SERVER]: "
|
||||||
|
|
||||||
admin:
|
admin:
|
||||||
number: "Write a number in the chat and press enter."
|
number: "Write a number in the chat and press enter."
|
||||||
@ -527,29 +528,29 @@ challenges:
|
|||||||
admin:
|
admin:
|
||||||
hit-things: 'Click the things to add them to the list of required things. Right click when done.'
|
hit-things: 'Click the things to add them to the list of required things. Right click when done.'
|
||||||
you-added: 'You added one [thing] to the challenge'
|
you-added: 'You added one [thing] to the challenge'
|
||||||
challenge-created: '[challenge]&r created!'
|
challenge-created: '[challenge]&r created!'
|
||||||
complete-wipe: '&cHopefully you have backups, because you just erased all the Challenges Addon databases!'
|
complete-wipe: '&c Hopefully you have backups, because you just erased all the Challenges Addon databases!'
|
||||||
|
|
||||||
challenge-wipe: '&cHopefully you have backups, because you just erased all the Challenges and their levels!'
|
challenge-wipe: '&c Hopefully you have backups, because you just erased all the Challenges and their levels!'
|
||||||
players-wipe: '&cHopefully you have backups, because you just erase all the player completed challenges!'
|
players-wipe: '&c Hopefully you have backups, because you just erase all the player completed challenges!'
|
||||||
|
|
||||||
completed: '&2You completed challenge [name] for [player]!'
|
completed: '&2 You completed challenge [name] for [player]!'
|
||||||
already-completed: '&2This challenge was already completed!'
|
already-completed: '&2 This challenge was already completed!'
|
||||||
reset: '&2You reset challenge [name] for [player]!'
|
reset: '&2 You reset challenge [name] for [player]!'
|
||||||
reset-all: '&2All [player] challenges were reset!'
|
reset-all: '&2 All [player] challenges were reset!'
|
||||||
not-completed: '&2This challenge is not completed yet!'
|
not-completed: '&2 This challenge is not completed yet!'
|
||||||
|
|
||||||
migrate-start: '&2Start migrating challenges addon data.'
|
migrate-start: '&2 Start migrating challenges addon data.'
|
||||||
migrate-end: '&2Challenges addon data updated to new format.'
|
migrate-end: '&2 Challenges addon data updated to new format.'
|
||||||
migrate-not: '&2All data is valid.'
|
migrate-not: '&2 All data is valid.'
|
||||||
|
|
||||||
start-downloading: '&5Starting to download and import Challenges Library.'
|
start-downloading: '&5 Starting to download and import Challenges Library.'
|
||||||
you-completed-challenge: '&2You completed the [value] &r&2challenge!'
|
you-completed-challenge: '&2 You completed the [value] &r &2 challenge!'
|
||||||
you-repeated-challenge: '&2You repeated the [value] &r&2challenge!'
|
you-repeated-challenge: '&2 You repeated the [value] &r &2 challenge!'
|
||||||
you-repeated-challenge-multiple: '&2You repeated the [value] &r&2challenge [count] times!'
|
you-repeated-challenge-multiple: '&2 You repeated the [value] &r &2 challenge [count] times!'
|
||||||
you-completed-level: '&2You completed the [value] &r&2level!'
|
you-completed-level: '&2 You completed the [value] &r &2 level!'
|
||||||
name-has-completed-challenge: '&5[name] has completed the [value] &r&5challenge!'
|
name-has-completed-challenge: '&5 [name] has completed the [value] &r &5 challenge!'
|
||||||
name-has-completed-level: '&5[name] has completed the [value] &r&5level!'
|
name-has-completed-level: '&5 [name] has completed the [value] &r &5 level!'
|
||||||
import-levels: 'Start importing Levels'
|
import-levels: 'Start importing Levels'
|
||||||
import-challenges: 'Start importing Challenges'
|
import-challenges: 'Start importing Challenges'
|
||||||
no-levels: 'Warning: No levels defined in challenges.yml'
|
no-levels: 'Warning: No levels defined in challenges.yml'
|
||||||
@ -560,47 +561,47 @@ challenges:
|
|||||||
defaults-file-overwrite: 'defaults.json exists. It will be overwritten.'
|
defaults-file-overwrite: 'defaults.json exists. It will be overwritten.'
|
||||||
defaults-file-completed: 'defaults.json file is populated with challenges from [world]!'
|
defaults-file-completed: 'defaults.json file is populated with challenges from [world]!'
|
||||||
errors:
|
errors:
|
||||||
no-name: '&cMissing challenge name'
|
no-name: '&c Missing challenge name'
|
||||||
unknown-challenge: '&cUnknown challenge'
|
unknown-challenge: '&c Unknown challenge'
|
||||||
unique-id: '&cUniqueID "[id]" is not valid.'
|
unique-id: '&c UniqueID "[id]" is not valid.'
|
||||||
wrong-icon: '&cGiven material "[value]" is not valid and cannot be used as icon.'
|
wrong-icon: '&c Given material "[value]" is not valid and cannot be used as icon.'
|
||||||
not-valid-integer: |-
|
not-valid-integer: |-
|
||||||
&cGiven integer "[value]" is not valid!
|
&c Given integer "[value]" is not valid!
|
||||||
Value should be between [min] and [max].
|
Value should be between [min] and [max].
|
||||||
not-a-integer: '&cGiven value "[value]" is not an integer!'
|
not-a-integer: '&c Given value "[value]" is not an integer!'
|
||||||
not-deployed: '&cChallenge is not deployed!'
|
not-deployed: '&c Challenge is not deployed!'
|
||||||
not-on-island: '&cYou must be on your island to do that!'
|
not-on-island: '&c You must be on your island to do that!'
|
||||||
challenge-level-not-available: '&cYou have not unlocked the required level to complete this challenge.'
|
challenge-level-not-available: '&c You have not unlocked the required level to complete this challenge.'
|
||||||
not-repeatable: '&cThis challenge is not repeatable!'
|
not-repeatable: '&c This challenge is not repeatable!'
|
||||||
wrong-environment: '&cYou are in the wrong environment!'
|
wrong-environment: '&c You are in the wrong environment!'
|
||||||
not-enough-items: '&cYou do not have enough [items] to complete this challenge!'
|
not-enough-items: '&c You do not have enough [items] to complete this challenge!'
|
||||||
not-close-enough: '&cYou must be standing within [number] blocks of all required items.'
|
not-close-enough: '&c You must be standing within [number] blocks of all required items.'
|
||||||
you-still-need: '&cYou still need [amount] x [item]'
|
you-still-need: '&c You still need [amount] x [item]'
|
||||||
missing-addon: '&cCannot complete challenge: Required addon or plugin is missing.'
|
missing-addon: '&c Cannot complete challenge: Required addon or plugin is missing.'
|
||||||
incorrect: '&cCannot complete challenge: Requirements are incorrect.'
|
incorrect: '&c Cannot complete challenge: Requirements are incorrect.'
|
||||||
not-enough-money: '&cIt is necessary to have [value] on your account to complete the challenge.'
|
not-enough-money: '&c It is necessary to have [value] on your account to complete the challenge.'
|
||||||
not-enough-experience: '&cIt is necessary to have [value] EXP to complete this challenge.'
|
not-enough-experience: '&c It is necessary to have [value] EXP to complete this challenge.'
|
||||||
island-level: '&cYour island must be level [number] or greater to complete this challenge!'
|
island-level: '&c Your island must be level [number] or greater to complete this challenge!'
|
||||||
import-no-file: '&cCould not find challenges.yml file to import!'
|
import-no-file: '&c Could not find challenges.yml file to import!'
|
||||||
no-load: '&cError: Could not load challenges.yml. [message]'
|
no-load: '&c Error: Could not load challenges.yml. [message]'
|
||||||
load-error: '&cError: Cannot load [value].'
|
load-error: '&c Error: Cannot load [value].'
|
||||||
no-rank: "&cYou do not have rank that is high enough to do that."
|
no-rank: "&c You do not have rank that is high enough to do that."
|
||||||
cannot-remove-items: '&cSome items cannot be removed from your inventory!'
|
cannot-remove-items: '&c Some items cannot be removed from your inventory!'
|
||||||
exist-challenges-or-levels: '&cChallenges already exist in your world. Cannot proceed!'
|
exist-challenges-or-levels: '&c Challenges already exist in your world. Cannot proceed!'
|
||||||
defaults-file-exist: '&cdefaults.json already exists. Use overwrite mode to replace it!'
|
defaults-file-exist: '&c defaults.json already exists. Use overwrite mode to replace it!'
|
||||||
defaults-file-error: '&cThere was an error while creating defaults.json file! Check console!'
|
defaults-file-error: '&c There was an error while creating defaults.json file! Check console!'
|
||||||
no-challenges: '&cChallenges are not implemented in this world yet!'
|
no-challenges: '&c Challenges are not implemented in this world yet!'
|
||||||
no-challenges-admin: '&cChallenges are not implemented in this world yet! Use &5/[command] &cto add them!'
|
no-challenges-admin: '&c Challenges are not implemented in this world yet! Use &5 /[command] &c to add them!'
|
||||||
missing-level: '&cChallenge Level [level] is not defined in the database. It may cause errors!'
|
missing-level: '&c Challenge Level [level] is not defined in the database. It may cause errors!'
|
||||||
missing-arguments: '&cCommand is missing arguments.'
|
missing-arguments: '&c Command is missing arguments.'
|
||||||
no-multiple-permission: "&cYou do not have permission to complete this challenge multiple times at once."
|
no-multiple-permission: "&c You do not have permission to complete this challenge multiple times at once."
|
||||||
protection:
|
protection:
|
||||||
flags:
|
flags:
|
||||||
CHALLENGES_ISLAND_PROTECTION:
|
CHALLENGES_ISLAND_PROTECTION:
|
||||||
description: "&5&oToggle who can\n&5&ocomplete challenges"
|
description: "&5 &o Toggle who can\n&5 &o complete challenges"
|
||||||
name: "Challenges protection"
|
name: "Challenges protection"
|
||||||
CHALLENGES_WORLD_PROTECTION:
|
CHALLENGES_WORLD_PROTECTION:
|
||||||
description: "&5&oEnable/disable\n&5&orequirement for players to\n&5&obe on their island to\n&5&ocomplete a challenge."
|
description: "&5 &o Enable/disable\n&5 &o requirement for players to\n&5 &o be on their island to\n&5 &o complete a challenge."
|
||||||
name: "Challenges Island limitation"
|
name: "Challenges Island limitation"
|
||||||
hint: "No challenges outside island"
|
hint: "No challenges outside island"
|
||||||
version: 11
|
version: 11
|
||||||
|
@ -39,6 +39,7 @@ import org.eclipse.jdt.annotation.NonNull;
|
|||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
@ -333,6 +334,7 @@ public class ChallengesManagerTest {
|
|||||||
/**
|
/**
|
||||||
* Test method for {@link world.bentobox.challenges.ChallengesManager#removeFromCache(java.util.UUID)}.
|
* Test method for {@link world.bentobox.challenges.ChallengesManager#removeFromCache(java.util.UUID)}.
|
||||||
*/
|
*/
|
||||||
|
@Ignore("This method does not do anything so there is no need to test right now.")
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveFromCache() {
|
public void testRemoveFromCache() {
|
||||||
cm.removeFromCache(playerID);
|
cm.removeFromCache(playerID);
|
||||||
|
Loading…
Reference in New Issue
Block a user