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.builders.PanelItemBuilder;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.challenges.ChallengesAddon;
|
||||
import world.bentobox.challenges.ChallengesManager;
|
||||
import world.bentobox.challenges.database.object.Challenge;
|
||||
|
@ -263,7 +264,6 @@ public abstract class CommonGUI
|
|||
* @param button Button that must be returned.
|
||||
* @return PanelItem with requested functionality.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
protected PanelItem getButton(CommonButtons button)
|
||||
{
|
||||
ItemStack icon;
|
||||
|
@ -510,6 +510,8 @@ public abstract class CommonGUI
|
|||
}
|
||||
else
|
||||
{
|
||||
// Show a title to the rewards
|
||||
result.add(this.user.getTranslation("challenges.gui.challenge-description.rewards-title"));
|
||||
if (isCompletedOnce)
|
||||
{
|
||||
result.add(challenge.getRepeatRewardText());
|
||||
|
@ -744,7 +746,7 @@ public abstract class CommonGUI
|
|||
for (Map.Entry<Material, Integer> entry : challenge.getRequiredBlocks().entrySet())
|
||||
{
|
||||
result.add(this.user.getTranslation("challenges.gui.descriptions.block",
|
||||
"[block]", entry.getKey().name(),
|
||||
"[block]", Util.prettifyText(entry.getKey().name()),
|
||||
"[count]", Integer.toString(entry.getValue())));
|
||||
}
|
||||
}
|
||||
|
@ -757,7 +759,7 @@ public abstract class CommonGUI
|
|||
for (Map.Entry<EntityType, Integer> entry : challenge.getRequiredEntities().entrySet())
|
||||
{
|
||||
result.add(this.user.getTranslation("challenges.gui.descriptions.entity",
|
||||
"[entity]", entry.getKey().name(),
|
||||
"[entity]", Util.prettifyText(entry.getKey().name()),
|
||||
"[count]", Integer.toString(entry.getValue())));
|
||||
}
|
||||
}
|
||||
|
@ -905,12 +907,13 @@ public abstract class CommonGUI
|
|||
* @param itemStack Object which lore must be generated
|
||||
* @return List with generated description
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
protected List<String> generateItemStackDescription(ItemStack itemStack)
|
||||
{
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
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())));
|
||||
|
||||
if (itemStack.hasItemMeta())
|
||||
|
@ -959,22 +962,22 @@ public abstract class CommonGUI
|
|||
if (data.isExtended() && data.isUpgraded())
|
||||
{
|
||||
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())
|
||||
{
|
||||
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())
|
||||
{
|
||||
result.add(this.user.getTranslation("challenges.gui.item-description.potion-type-extended",
|
||||
"[name]", data.getType().name()));
|
||||
"[name]", Util.prettifyText(data.getType().name())));
|
||||
}
|
||||
else
|
||||
{
|
||||
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())
|
||||
|
@ -983,7 +986,7 @@ public abstract class CommonGUI
|
|||
|
||||
((PotionMeta) meta).getCustomEffects().forEach(potionEffect ->
|
||||
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()),
|
||||
"[amplifier]", Integer.toString(potionEffect.getAmplifier()))));
|
||||
}
|
||||
|
@ -999,14 +1002,14 @@ public abstract class CommonGUI
|
|||
else if (meta instanceof SpawnEggMeta)
|
||||
{
|
||||
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)
|
||||
{
|
||||
result.add(this.user.getTranslation("challenges.gui.item-description.fish-meta",
|
||||
"[pattern]", ((TropicalFishBucketMeta) meta).getPattern().name(),
|
||||
"[pattern-color]", ((TropicalFishBucketMeta) meta).getPatternColor().name(),
|
||||
"[body-color]", ((TropicalFishBucketMeta) meta).getBodyColor().name()));
|
||||
"[pattern]", Util.prettifyText(((TropicalFishBucketMeta) meta).getPattern().name()),
|
||||
"[pattern-color]", Util.prettifyText(((TropicalFishBucketMeta) meta).getPatternColor().name()),
|
||||
"[body-color]", Util.prettifyText(((TropicalFishBucketMeta) meta).getBodyColor().name())));
|
||||
// parse ne
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import world.bentobox.bentobox.api.panels.PanelItem;
|
|||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.challenges.ChallengesAddon;
|
||||
import world.bentobox.challenges.database.object.Challenge;
|
||||
import world.bentobox.challenges.database.object.requirements.InventoryRequirements;
|
||||
|
@ -643,7 +644,7 @@ public class EditChallengeGUI extends CommonGUI
|
|||
for (Map.Entry<EntityType, Integer> entry : requirements.getRequiredEntities().entrySet())
|
||||
{
|
||||
description.add(this.user.getTranslation("challenges.gui.descriptions.entity",
|
||||
"[entity]", entry.getKey().name(),
|
||||
"[entity]", Util.prettifyText(entry.getKey().name()),
|
||||
"[count]", Integer.toString(entry.getValue())));
|
||||
}
|
||||
|
||||
|
|
|
@ -470,6 +470,7 @@ challenges:
|
|||
required-money: '&6 Required money: $[value]'
|
||||
required-island-level: '&6 Required island level: [value]'
|
||||
environment: 'Required Environments:'
|
||||
rewards-title: '&a Rewards:'
|
||||
reward-items: '&6 Reward Items:'
|
||||
reward-commands: '&6 Reward Commands:'
|
||||
required-items: 'Required Items:'
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.jdt.annotation.NonNull;
|
|||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
|
@ -333,6 +334,7 @@ public class ChallengesManagerTest {
|
|||
/**
|
||||
* 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
|
||||
public void testRemoveFromCache() {
|
||||
cm.removeFromCache(playerID);
|
||||
|
|
Loading…
Reference in New Issue