Challenges/src/main/java/world/bentobox/challenges/panel/admin/EditLoreGUI.java

639 lines
18 KiB
Java
Raw Normal View History

package world.bentobox.challenges.panel.admin;
Bug fix release (#228) * Fix issue when users could not select non-block items as icons for challenges and levels. (#190) * English update (#193) * Organized imports * Minor code cleanup * Updated English locale file. * Translate zh-CN.yml via GitLocalize (#188) * Make default translation looking a bit nicer (#192) * Make default translation looking a bit nicer * Updating a few friendly names and rewording some phrases * Add generic .gitignore * Fix novice level Update `chiseledmaker` name in `novice` level. * Adapt literal style (#197) Improve translations and process as a YAML string. * Test coverage (#199) * Test coverage for Challenges Command * Added CompleteChallengeCommand test class * Added Utils test class * Added ChallengesGUI test class * Fix code smells from sonarcloud analysis * Added .gitignore * Added Travis CI config file * WIP ChallengesManager Test class * Added ChallengesManager test class * Removed debug * Removed code smells. * Added ChallengesAddon test class. * Added onDisbale test * Added new TryToComplete test class - WIP Covers inventory challenges. * Added Island Challenge entity tests to TryToComplete test class * Fix a bug with challenge deletion. If challenge has been left in a level, then system did not remove challenge from it and was kept as ghost challenge, preventing from completing level. * Fixes tests * Updated travis.yml * All strings to spanish (#200) * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Fix LevelListRequestHandler. This handler did not return list of strings but list of challenge levels, that is incorrect. Not it should work correctly. * Create ro.yml * Create id.yml * Remove blanks files now that GitLocalize is fixed. * Initial Russian translation (#207) * Translate ru.yml via GitLocalize Co-authored-by: @mt-gitlocalize @IPeredero @LoveBiscuit * Changed build character from # to b * Add German translation (#210) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: xXjojojXx <36734820+xXjojojXx@users.noreply.github.com> Co-authored-by: FunnysBanana <51290016+FunnysBanana@users.noreply.github.com> Co-authored-by: mt-gitlocalize <mt@gitlocalize.com> * Czech translation. Credit @Polda18 * Added a uniqueId sanitization when creating challenges/levels This will help fixing issues with spaces, hyphens and accents in non-English languages. * Fixes bug with checking entities in nether and end (#219) https://github.com/BentoBoxWorld/Challenges/issues/218 Adds test case to check for compliance. * Add 7 new placeholders for Challenges Addon. - `[gamemode]_challenge_total_completion_count` returns number of sum of challenge completions for user. - `[gamemode]_challenge_completed_count` returns number of completed challenges (at least once) for user. - `[gamemode]_challenge_uncompleted_count` returns number of uncompleted challenges for user. - `[gamemode]_challenge_completed_level_count` returns number of completed levels for user. - `[gamemode]_challenge_uncompleted_level_count` returns number of uncompleted levels for user. - `[gamemode]_challenge_unlocked_level_count` returns number of unlocked levels for user. - `[gamemode]_challenge_locked_level_count` returns number of locked levels for user. Fixes #224 * Add 2 new placeholders: - `[gamemode]_challenge_latest_level_name` returns latest unlocked challenge level name - `[gamemode]_challenge_latest_level_id` returns latest unlocked challenge level id Fixes #226 * Fix broken tests due to placeholder additions. https://github.com/BentoBoxWorld/Challenges/commit/b5ecffb725d78c154f469d7e2868574ca7ecff30 https://github.com/BentoBoxWorld/Challenges/commit/2958ca8b6c98f9c8d389aa93c4a2846f578fff43 * Added default perms for aoneblock * Downgrade to 0.8.1 version * Add option to quit from conversation by writing "cancel" in chat. Move sanitizeInput to a GuiUtil class. * Change latest version to 0.8.1
2020-04-22 00:19:46 +02:00
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.bukkit.Material;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.ItemStack;
Bug fix release (#228) * Fix issue when users could not select non-block items as icons for challenges and levels. (#190) * English update (#193) * Organized imports * Minor code cleanup * Updated English locale file. * Translate zh-CN.yml via GitLocalize (#188) * Make default translation looking a bit nicer (#192) * Make default translation looking a bit nicer * Updating a few friendly names and rewording some phrases * Add generic .gitignore * Fix novice level Update `chiseledmaker` name in `novice` level. * Adapt literal style (#197) Improve translations and process as a YAML string. * Test coverage (#199) * Test coverage for Challenges Command * Added CompleteChallengeCommand test class * Added Utils test class * Added ChallengesGUI test class * Fix code smells from sonarcloud analysis * Added .gitignore * Added Travis CI config file * WIP ChallengesManager Test class * Added ChallengesManager test class * Removed debug * Removed code smells. * Added ChallengesAddon test class. * Added onDisbale test * Added new TryToComplete test class - WIP Covers inventory challenges. * Added Island Challenge entity tests to TryToComplete test class * Fix a bug with challenge deletion. If challenge has been left in a level, then system did not remove challenge from it and was kept as ghost challenge, preventing from completing level. * Fixes tests * Updated travis.yml * All strings to spanish (#200) * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Fix LevelListRequestHandler. This handler did not return list of strings but list of challenge levels, that is incorrect. Not it should work correctly. * Create ro.yml * Create id.yml * Remove blanks files now that GitLocalize is fixed. * Initial Russian translation (#207) * Translate ru.yml via GitLocalize Co-authored-by: @mt-gitlocalize @IPeredero @LoveBiscuit * Changed build character from # to b * Add German translation (#210) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: xXjojojXx <36734820+xXjojojXx@users.noreply.github.com> Co-authored-by: FunnysBanana <51290016+FunnysBanana@users.noreply.github.com> Co-authored-by: mt-gitlocalize <mt@gitlocalize.com> * Czech translation. Credit @Polda18 * Added a uniqueId sanitization when creating challenges/levels This will help fixing issues with spaces, hyphens and accents in non-English languages. * Fixes bug with checking entities in nether and end (#219) https://github.com/BentoBoxWorld/Challenges/issues/218 Adds test case to check for compliance. * Add 7 new placeholders for Challenges Addon. - `[gamemode]_challenge_total_completion_count` returns number of sum of challenge completions for user. - `[gamemode]_challenge_completed_count` returns number of completed challenges (at least once) for user. - `[gamemode]_challenge_uncompleted_count` returns number of uncompleted challenges for user. - `[gamemode]_challenge_completed_level_count` returns number of completed levels for user. - `[gamemode]_challenge_uncompleted_level_count` returns number of uncompleted levels for user. - `[gamemode]_challenge_unlocked_level_count` returns number of unlocked levels for user. - `[gamemode]_challenge_locked_level_count` returns number of locked levels for user. Fixes #224 * Add 2 new placeholders: - `[gamemode]_challenge_latest_level_name` returns latest unlocked challenge level name - `[gamemode]_challenge_latest_level_id` returns latest unlocked challenge level id Fixes #226 * Fix broken tests due to placeholder additions. https://github.com/BentoBoxWorld/Challenges/commit/b5ecffb725d78c154f469d7e2868574ca7ecff30 https://github.com/BentoBoxWorld/Challenges/commit/2958ca8b6c98f9c8d389aa93c4a2846f578fff43 * Added default perms for aoneblock * Downgrade to 0.8.1 version * Add option to quit from conversation by writing "cancel" in chat. Move sanitizeInput to a GuiUtil class. * Change latest version to 0.8.1
2020-04-22 00:19:46 +02:00
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.PanelListener;
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.challenges.config.SettingsUtils.ChallengeLore;
import world.bentobox.challenges.config.SettingsUtils.LevelLore;
import world.bentobox.challenges.panel.CommonGUI;
import world.bentobox.challenges.utils.GuiUtils;
/**
* This class allows to change Input ItemStacks to different ItemStacks.
*/
public class EditLoreGUI extends CommonGUI
{
Bug fix release (#228) * Fix issue when users could not select non-block items as icons for challenges and levels. (#190) * English update (#193) * Organized imports * Minor code cleanup * Updated English locale file. * Translate zh-CN.yml via GitLocalize (#188) * Make default translation looking a bit nicer (#192) * Make default translation looking a bit nicer * Updating a few friendly names and rewording some phrases * Add generic .gitignore * Fix novice level Update `chiseledmaker` name in `novice` level. * Adapt literal style (#197) Improve translations and process as a YAML string. * Test coverage (#199) * Test coverage for Challenges Command * Added CompleteChallengeCommand test class * Added Utils test class * Added ChallengesGUI test class * Fix code smells from sonarcloud analysis * Added .gitignore * Added Travis CI config file * WIP ChallengesManager Test class * Added ChallengesManager test class * Removed debug * Removed code smells. * Added ChallengesAddon test class. * Added onDisbale test * Added new TryToComplete test class - WIP Covers inventory challenges. * Added Island Challenge entity tests to TryToComplete test class * Fix a bug with challenge deletion. If challenge has been left in a level, then system did not remove challenge from it and was kept as ghost challenge, preventing from completing level. * Fixes tests * Updated travis.yml * All strings to spanish (#200) * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Fix LevelListRequestHandler. This handler did not return list of strings but list of challenge levels, that is incorrect. Not it should work correctly. * Create ro.yml * Create id.yml * Remove blanks files now that GitLocalize is fixed. * Initial Russian translation (#207) * Translate ru.yml via GitLocalize Co-authored-by: @mt-gitlocalize @IPeredero @LoveBiscuit * Changed build character from # to b * Add German translation (#210) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: xXjojojXx <36734820+xXjojojXx@users.noreply.github.com> Co-authored-by: FunnysBanana <51290016+FunnysBanana@users.noreply.github.com> Co-authored-by: mt-gitlocalize <mt@gitlocalize.com> * Czech translation. Credit @Polda18 * Added a uniqueId sanitization when creating challenges/levels This will help fixing issues with spaces, hyphens and accents in non-English languages. * Fixes bug with checking entities in nether and end (#219) https://github.com/BentoBoxWorld/Challenges/issues/218 Adds test case to check for compliance. * Add 7 new placeholders for Challenges Addon. - `[gamemode]_challenge_total_completion_count` returns number of sum of challenge completions for user. - `[gamemode]_challenge_completed_count` returns number of completed challenges (at least once) for user. - `[gamemode]_challenge_uncompleted_count` returns number of uncompleted challenges for user. - `[gamemode]_challenge_completed_level_count` returns number of completed levels for user. - `[gamemode]_challenge_uncompleted_level_count` returns number of uncompleted levels for user. - `[gamemode]_challenge_unlocked_level_count` returns number of unlocked levels for user. - `[gamemode]_challenge_locked_level_count` returns number of locked levels for user. Fixes #224 * Add 2 new placeholders: - `[gamemode]_challenge_latest_level_name` returns latest unlocked challenge level name - `[gamemode]_challenge_latest_level_id` returns latest unlocked challenge level id Fixes #226 * Fix broken tests due to placeholder additions. https://github.com/BentoBoxWorld/Challenges/commit/b5ecffb725d78c154f469d7e2868574ca7ecff30 https://github.com/BentoBoxWorld/Challenges/commit/2958ca8b6c98f9c8d389aa93c4a2846f578fff43 * Added default perms for aoneblock * Downgrade to 0.8.1 version * Add option to quit from conversation by writing "cancel" in chat. Move sanitizeInput to a GuiUtil class. * Change latest version to 0.8.1
2020-04-22 00:19:46 +02:00
public EditLoreGUI(CommonGUI parent, LoreType loreType)
{
super(parent);
this.lore = loreType;
this.activeValues = new ArrayList<>();
switch (this.lore)
{
case CHALLENGES:
for (ChallengeLore lore : this.addon.getChallengesSettings().getChallengeLoreMessage())
{
this.activeValues.add(lore.name());
}
break;
case LEVELS:
for (LevelLore lore : this.addon.getChallengesSettings().getLevelLoreMessage())
{
this.activeValues.add(lore.name());
}
break;
}
}
/**
* This is static call method for easier GUI opening.
* @param parent Parent GUI.
* @param loreType loreType that will be edited.
*/
public static void open(CommonGUI parent, LoreType loreType)
{
new EditLoreGUI(parent, loreType).build();
}
// ---------------------------------------------------------------------
// Section: Methods
// ---------------------------------------------------------------------
/**
* This method builds panel that allows to change given number value.
*/
@Override
public void build()
{
PanelBuilder panelBuilder = new PanelBuilder().
name(this.user.getTranslation("challenges.gui.title.admin.lore-edit")).
user(this.user).
listener(new CustomPanelListener());
GuiUtils.fillBorder(panelBuilder, 5, Material.MAGENTA_STAINED_GLASS_PANE);
// Define all active buttons
panelBuilder.item(1, this.getButton(Button.SAVE));
panelBuilder.item(3, this.getButton(Button.ADD));
panelBuilder.item(4, this.getButton(Button.REMOVE));
// TODO: Need 2 View Buttons
// One for closes / One for opened.
// panelBuilder.item(6, this.getButton(Button.VIEW));
panelBuilder.item(44, this.returnButton);
// necessary as I have a border around this GUI
int currentIndex = 10;
// Only 21 elements will be displayed. On porpoise!
for (int i = 0; i < this.activeValues.size() || i > 21; i++)
{
panelBuilder.item(currentIndex++, this.getLoreButton(this.activeValues.get(i)));
// Border element
if (currentIndex % 9 == 8)
{
currentIndex += 2;
}
// Just in case. Should never occur.
if (currentIndex % 9 == 0)
{
currentIndex++;
}
}
panelBuilder.build();
}
/**
* This method create button that does some functionality in current gui.
* @param button Button functionality.
* @return PanelItem.
*/
private PanelItem getButton(Button button)
{
ItemStack icon;
String name;
List<String> description;
PanelItem.ClickHandler clickHandler;
switch (button)
{
case SAVE:
{
name = this.user.getTranslation("challenges.gui.buttons.admin.save");
description = Collections.emptyList();
icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> {
switch (this.lore)
{
case CHALLENGES:
{
List<ChallengeLore> lore = this.activeValues.stream().
map(ChallengeLore::valueOf).
collect(Collectors.toCollection(() -> new ArrayList<>(this.activeValues.size())));
this.addon.getChallengesSettings().setChallengeLoreMessage(lore);
break;
}
case LEVELS:
{
List<LevelLore> lore = this.activeValues.stream().
map(LevelLore::valueOf).
collect(Collectors.toCollection(() -> new ArrayList<>(this.activeValues.size())));
this.addon.getChallengesSettings().setLevelLoreMessage(lore);
break;
}
}
// Save and return to parent gui.
this.parentGUI.build();
return true;
};
break;
}
case ADD:
{
name = this.user.getTranslation("challenges.gui.buttons.admin.add");
description = Collections.emptyList();
icon = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> {
new AddLoreElementGUI(element -> {
this.activeValues.add(element);
this.build();
});
return true;
};
break;
}
case REMOVE:
{
name = this.user.getTranslation("challenges.gui.buttons.admin.remove-selected");
description = Collections.emptyList();
icon = new ItemStack(Material.RED_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> {
new RemoveLoreElementGUI((element, index) -> {
if (this.activeValues.get(index).equals(element))
{
this.activeValues.remove(element);
}
this.build();
});
return true;
};
break;
}
case VIEW:
{
name = this.user.getTranslation("challenges.gui.buttons.admin.view");
description = Collections.emptyList();
icon = new ItemStack(Material.YELLOW_STAINED_GLASS_PANE);
clickHandler = (panel, user, clickType, slot) -> {
return true;
};
break;
}
default:
return null;
}
return new PanelItemBuilder().
icon(icon).
name(name).
description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())).
glow(false).
clickHandler(clickHandler).
build();
}
/**
* This method creates button for lore element.
* @param loreElement String that represents current lore element.
* @return PanelItem.
*/
@Nullable
private PanelItem getLoreButton(String loreElement)
{
switch (this.lore)
{
case CHALLENGES:
return this.getChallengeLoreButton(loreElement);
case LEVELS:
return this.getLevelLoreButton(loreElement);
default:
// this should never happen!
return null;
}
}
/**
* This method creates button for challenge lore element.
* @param loreElement String that represents current challenge lore element.
* @return PanelItem.
*/
private PanelItem getChallengeLoreButton(String loreElement)
{
Material icon;
String name = loreElement;
List<String> description = new ArrayList<>();
description.add(this.user.getTranslation(REFERENCE_DESCRIPTION + "lore." + loreElement.toLowerCase()));
PanelItem.ClickHandler clickHandler = (panel, user1, clickType, slot) -> true;
switch (ChallengeLore.valueOf(loreElement))
{
case LEVEL:
{
icon = Material.DIRT;
break;
}
case STATUS:
{
icon = Material.LEVER;
break;
}
case COUNT:
{
icon = Material.REPEATER;
break;
}
case DESCRIPTION:
{
icon = Material.WRITTEN_BOOK;
break;
}
case WARNINGS:
{
icon = Material.LAVA_BUCKET;
break;
}
case ENVIRONMENT:
{
icon = Material.GLASS;
break;
}
case REQUIREMENTS:
{
icon = Material.HOPPER;
break;
}
case REWARD_TEXT:
{
icon = Material.PAPER;
break;
}
case REWARD_OTHER:
{
icon = Material.CHEST;
break;
}
case REWARD_ITEMS:
{
icon = Material.TRAPPED_CHEST;
break;
}
case REWARD_COMMANDS:
{
icon = Material.COMMAND_BLOCK;
break;
}
default:
{
icon = Material.BARRIER;
break;
}
}
return new PanelItemBuilder().
name(name).
icon(icon).
description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())).
clickHandler(clickHandler).
glow(false).
build();
}
/**
* This method creates button for challenge level lore element.
* @param loreElement String that represents current challenge level lore element.
* @return PanelItem.
*/
private PanelItem getLevelLoreButton(String loreElement)
{
Material icon;
String name = loreElement;
List<String> description = new ArrayList<>();
description.add(this.user.getTranslation(REFERENCE_DESCRIPTION + "lore." + loreElement.toLowerCase()));
PanelItem.ClickHandler clickHandler = (panel, user1, clickType, slot) -> true;
switch (LevelLore.valueOf(loreElement))
{
case LEVEL_STATUS:
{
icon = Material.DIRT;
break;
}
case CHALLENGE_COUNT:
{
icon = Material.REPEATER;
break;
}
case UNLOCK_MESSAGE:
{
icon = Material.WRITTEN_BOOK;
break;
}
case WAIVER_AMOUNT:
{
icon = Material.COMPARATOR;
break;
}
case LEVEL_REWARD_TEXT:
{
icon = Material.PAPER;
break;
}
case LEVEL_REWARD_OTHER:
{
icon = Material.CHEST;
break;
}
case LEVEL_REWARD_ITEMS:
{
icon = Material.TRAPPED_CHEST;
break;
}
case LEVEL_REWARD_COMMANDS:
{
icon = Material.COMMAND_BLOCK;
break;
}
default:
{
icon = Material.BARRIER;
break;
}
}
return new PanelItemBuilder().
name(name).
icon(icon).
description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())).
clickHandler(clickHandler).
glow(false).
build();
}
// ---------------------------------------------------------------------
// Section: Select GUI
// ---------------------------------------------------------------------
/**
* This class opens new GUI that add an element from all available lore values.
*/
private class AddLoreElementGUI
{
private AddLoreElementGUI(Consumer<String> selectedElement)
{
PanelBuilder panelBuilder = new PanelBuilder().
name(EditLoreGUI.this.user.getTranslation("challenges.gui.title.admin.lore-add")).
user(EditLoreGUI.this.user);
GuiUtils.fillBorder(panelBuilder, 5, Material.MAGENTA_STAINED_GLASS_PANE);
int currentIndex = 10;
List<String> values = new ArrayList<>();
// Populate list with all elements.
switch (EditLoreGUI.this.lore)
{
case CHALLENGES:
for (ChallengeLore value : ChallengeLore.values())
{
values.add(value.name());
}
break;
case LEVELS:
for (LevelLore value : LevelLore.values())
{
values.add(value.name());
}
break;
}
for (String value : values)
{
PanelItem item = EditLoreGUI.this.getLoreButton(value);
if (item != null) {
item.setClickHandler((panel, user1, clickType, slot) -> {
selectedElement.accept(value);
return true;
});
panelBuilder.item(currentIndex++, item);
// Border element
if (currentIndex % 9 == 8)
{
currentIndex += 2;
}
// Just in case. Should never occur.
if (currentIndex % 9 == 0)
{
currentIndex++;
}
// Just in case. Should never occur.
if (currentIndex > 35)
{
break;
}
}
}
panelBuilder.build();
}
}
/**
* This class opens new GUI that remove an element from all available lore values.
*/
private class RemoveLoreElementGUI
{
private RemoveLoreElementGUI(BiConsumer<String, Integer> selectedElement)
{
PanelBuilder panelBuilder = new PanelBuilder().
name(EditLoreGUI.this.user.getTranslation("challenges.gui.title.admin.lore-remove")).
user(EditLoreGUI.this.user);
GuiUtils.fillBorder(panelBuilder, 5, Material.MAGENTA_STAINED_GLASS_PANE);
int currentIndex = 10;
List<String> values = EditLoreGUI.this.activeValues;
for (int i = 0; i < values.size(); i++)
{
final int counter = i;
String value = values.get(counter);
PanelItem item = EditLoreGUI.this.getLoreButton(value);
if (item != null) {
item.setClickHandler((panel, user1, clickType, slot) -> {
selectedElement.accept(value, counter);
return true;
});
panelBuilder.item(currentIndex++, item);
// Border element
if (currentIndex % 9 == 8)
{
currentIndex += 2;
}
// Just in case. Should never occur.
if (currentIndex % 9 == 0)
{
currentIndex++;
}
// Just in case. Should never occur.
if (currentIndex > 35)
{
break;
}
}
}
panelBuilder.build();
}
}
// ---------------------------------------------------------------------
// Section: Private classes
// ---------------------------------------------------------------------
/**
* This CustomPanelListener allows to move items in current panel.
*/
private class CustomPanelListener implements PanelListener
{
@Override
public void setup()
{
}
@Override
public void onInventoryClose(InventoryCloseEvent inventoryCloseEvent)
{
}
@Override
public void onInventoryClick(User user, InventoryClickEvent event)
{
// First row of elements should be ignored, as it contains buttons and blocked slots.
event.setCancelled(event.getRawSlot() < 9 ||
event.getRawSlot() < 35 ||
event.getRawSlot() % 9 == 0 ||
event.getRawSlot() % 9 == 8);
}
}
// ---------------------------------------------------------------------
// Section: Enums
// ---------------------------------------------------------------------
/**
* This enum holds all button values in current gui.
*/
private enum Button
{
SAVE,
ADD,
REMOVE,
VIEW,
RETURN
}
/**
* This enum holds which Lore is edited with current GUI.
*/
public enum LoreType
{
CHALLENGES,
LEVELS,
}
// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
/**
* Lore that will be edited with current GUI.
*/
private final LoreType lore;
/**
* List of lore elements that are currently enabled.
*/
private List<String> activeValues;
// ---------------------------------------------------------------------
// Section: Constants
// ---------------------------------------------------------------------
Bug fix release (#228) * Fix issue when users could not select non-block items as icons for challenges and levels. (#190) * English update (#193) * Organized imports * Minor code cleanup * Updated English locale file. * Translate zh-CN.yml via GitLocalize (#188) * Make default translation looking a bit nicer (#192) * Make default translation looking a bit nicer * Updating a few friendly names and rewording some phrases * Add generic .gitignore * Fix novice level Update `chiseledmaker` name in `novice` level. * Adapt literal style (#197) Improve translations and process as a YAML string. * Test coverage (#199) * Test coverage for Challenges Command * Added CompleteChallengeCommand test class * Added Utils test class * Added ChallengesGUI test class * Fix code smells from sonarcloud analysis * Added .gitignore * Added Travis CI config file * WIP ChallengesManager Test class * Added ChallengesManager test class * Removed debug * Removed code smells. * Added ChallengesAddon test class. * Added onDisbale test * Added new TryToComplete test class - WIP Covers inventory challenges. * Added Island Challenge entity tests to TryToComplete test class * Fix a bug with challenge deletion. If challenge has been left in a level, then system did not remove challenge from it and was kept as ghost challenge, preventing from completing level. * Fixes tests * Updated travis.yml * All strings to spanish (#200) * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Fix LevelListRequestHandler. This handler did not return list of strings but list of challenge levels, that is incorrect. Not it should work correctly. * Create ro.yml * Create id.yml * Remove blanks files now that GitLocalize is fixed. * Initial Russian translation (#207) * Translate ru.yml via GitLocalize Co-authored-by: @mt-gitlocalize @IPeredero @LoveBiscuit * Changed build character from # to b * Add German translation (#210) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: xXjojojXx <36734820+xXjojojXx@users.noreply.github.com> Co-authored-by: FunnysBanana <51290016+FunnysBanana@users.noreply.github.com> Co-authored-by: mt-gitlocalize <mt@gitlocalize.com> * Czech translation. Credit @Polda18 * Added a uniqueId sanitization when creating challenges/levels This will help fixing issues with spaces, hyphens and accents in non-English languages. * Fixes bug with checking entities in nether and end (#219) https://github.com/BentoBoxWorld/Challenges/issues/218 Adds test case to check for compliance. * Add 7 new placeholders for Challenges Addon. - `[gamemode]_challenge_total_completion_count` returns number of sum of challenge completions for user. - `[gamemode]_challenge_completed_count` returns number of completed challenges (at least once) for user. - `[gamemode]_challenge_uncompleted_count` returns number of uncompleted challenges for user. - `[gamemode]_challenge_completed_level_count` returns number of completed levels for user. - `[gamemode]_challenge_uncompleted_level_count` returns number of uncompleted levels for user. - `[gamemode]_challenge_unlocked_level_count` returns number of unlocked levels for user. - `[gamemode]_challenge_locked_level_count` returns number of locked levels for user. Fixes #224 * Add 2 new placeholders: - `[gamemode]_challenge_latest_level_name` returns latest unlocked challenge level name - `[gamemode]_challenge_latest_level_id` returns latest unlocked challenge level id Fixes #226 * Fix broken tests due to placeholder additions. https://github.com/BentoBoxWorld/Challenges/commit/b5ecffb725d78c154f469d7e2868574ca7ecff30 https://github.com/BentoBoxWorld/Challenges/commit/2958ca8b6c98f9c8d389aa93c4a2846f578fff43 * Added default perms for aoneblock * Downgrade to 0.8.1 version * Add option to quit from conversation by writing "cancel" in chat. Move sanitizeInput to a GuiUtil class. * Change latest version to 0.8.1
2020-04-22 00:19:46 +02:00
private final static String REFERENCE_DESCRIPTION = "challenges.gui.descriptions.admin.";
}