addon-challenges/src/main/java/world/bentobox/challenges/commands/admin/CompleteCommand.java

201 lines
4.7 KiB
Java
Raw Normal View History

package world.bentobox.challenges.commands.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.List;
import java.util.Optional;
import java.util.UUID;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
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;
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
import world.bentobox.challenges.utils.Constants;
import world.bentobox.challenges.utils.Utils;
/**
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
* This command allows completing challenges without a gui.
*/
public class CompleteCommand extends CompositeCommand
{
/**
* Default constructor for Composite Command.
* @param addon Challenges addon.
* @param cmd Parent Command.
*/
public CompleteCommand(Addon addon, CompositeCommand cmd)
{
super(addon, cmd, "complete");
this.addon = (ChallengesAddon) addon;
}
/**
* {@inheritDoc}
*/
@Override
public void setup()
{
this.setPermission("complete");
this.setParametersHelp("challenges.commands.admin.complete.parameters");
this.setDescription("challenges.commands.admin.complete.description");
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(User user, String label, List<String> args)
{
if (args.isEmpty())
{
if (user.isPlayer())
{
Release 1.2.0 (#317) * Init 1.2.0 version * Fixes #311 localization errors in zn-CN. Original translation author translated `[]` placeholders which broke locale * Init 1.2.0 version * Edit some unfit translation (#312) Edit some unfit translation * Fixes a regex bug that replaced every [player] char instead of whole word. * Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed. * Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error. * Add locale of Chinese-Hong Kong (zh-HK) (#313) Addition of locale updated to latest version * Add ${argLine} to get jacoco coverage * Updated Jacoco POM section * Update build.yml Java 17 for Surefire * Updated pladdon annotations * Add support for gamemode-specific translations. This was a request from Floris * Update ChallengesManagerTest methods with world parameter. * Implement option that excludes undeployed challenges The new option allows to toggle if undeployed challenges should be included in level completion count. Disabling option will not include these challenges for level completion. Fixes #315 * Create plugin.yml (#316) * Create plugin.yml * Update pom.xml * Update ChallengesPladdon.java * Remove dependency to org.apache.commons Replace org.apache.commons.lang.ArrayUtils to a default Java implementation. --------- Co-authored-by: EpicMo <1982742309@qq.com> Co-authored-by: JamesMCL44 <epicquarters@gmail.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: tastybento <tastybento@wasteofplastic.com>
2023-04-15 21:55:34 +02:00
Utils.sendMessage(user, this.getWorld(), Constants.ERRORS + "no-name");
}
else
{
this.addon.logError("Missing parameters");
}
}
else if (args.size() < 2)
{
if (user.isPlayer())
{
Release 1.2.0 (#317) * Init 1.2.0 version * Fixes #311 localization errors in zn-CN. Original translation author translated `[]` placeholders which broke locale * Init 1.2.0 version * Edit some unfit translation (#312) Edit some unfit translation * Fixes a regex bug that replaced every [player] char instead of whole word. * Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed. * Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error. * Add locale of Chinese-Hong Kong (zh-HK) (#313) Addition of locale updated to latest version * Add ${argLine} to get jacoco coverage * Updated Jacoco POM section * Update build.yml Java 17 for Surefire * Updated pladdon annotations * Add support for gamemode-specific translations. This was a request from Floris * Update ChallengesManagerTest methods with world parameter. * Implement option that excludes undeployed challenges The new option allows to toggle if undeployed challenges should be included in level completion count. Disabling option will not include these challenges for level completion. Fixes #315 * Create plugin.yml (#316) * Create plugin.yml * Update pom.xml * Update ChallengesPladdon.java * Remove dependency to org.apache.commons Replace org.apache.commons.lang.ArrayUtils to a default Java implementation. --------- Co-authored-by: EpicMo <1982742309@qq.com> Co-authored-by: JamesMCL44 <epicquarters@gmail.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: tastybento <tastybento@wasteofplastic.com>
2023-04-15 21:55:34 +02:00
Utils.sendMessage(user, this.getWorld(), Constants.ERRORS + "missing-arguments");
}
else
{
this.addon.logError("Missing parameters");
}
}
else if (!args.get(1).isEmpty())
{
UUID targetUUID = this.getPlayers().getUUID(args.get(0));
if (targetUUID == null)
{
if (user.isPlayer())
{
Release 1.2.0 (#317) * Init 1.2.0 version * Fixes #311 localization errors in zn-CN. Original translation author translated `[]` placeholders which broke locale * Init 1.2.0 version * Edit some unfit translation (#312) Edit some unfit translation * Fixes a regex bug that replaced every [player] char instead of whole word. * Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed. * Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error. * Add locale of Chinese-Hong Kong (zh-HK) (#313) Addition of locale updated to latest version * Add ${argLine} to get jacoco coverage * Updated Jacoco POM section * Update build.yml Java 17 for Surefire * Updated pladdon annotations * Add support for gamemode-specific translations. This was a request from Floris * Update ChallengesManagerTest methods with world parameter. * Implement option that excludes undeployed challenges The new option allows to toggle if undeployed challenges should be included in level completion count. Disabling option will not include these challenges for level completion. Fixes #315 * Create plugin.yml (#316) * Create plugin.yml * Update pom.xml * Update ChallengesPladdon.java * Remove dependency to org.apache.commons Replace org.apache.commons.lang.ArrayUtils to a default Java implementation. --------- Co-authored-by: EpicMo <1982742309@qq.com> Co-authored-by: JamesMCL44 <epicquarters@gmail.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: tastybento <tastybento@wasteofplastic.com>
2023-04-15 21:55:34 +02:00
Utils.sendMessage(user,
this.getWorld(),
"general.errors.unknown-player",
TextVariables.NAME,
Release 1.2.0 (#317) * Init 1.2.0 version * Fixes #311 localization errors in zn-CN. Original translation author translated `[]` placeholders which broke locale * Init 1.2.0 version * Edit some unfit translation (#312) Edit some unfit translation * Fixes a regex bug that replaced every [player] char instead of whole word. * Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed. * Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error. * Add locale of Chinese-Hong Kong (zh-HK) (#313) Addition of locale updated to latest version * Add ${argLine} to get jacoco coverage * Updated Jacoco POM section * Update build.yml Java 17 for Surefire * Updated pladdon annotations * Add support for gamemode-specific translations. This was a request from Floris * Update ChallengesManagerTest methods with world parameter. * Implement option that excludes undeployed challenges The new option allows to toggle if undeployed challenges should be included in level completion count. Disabling option will not include these challenges for level completion. Fixes #315 * Create plugin.yml (#316) * Create plugin.yml * Update pom.xml * Update ChallengesPladdon.java * Remove dependency to org.apache.commons Replace org.apache.commons.lang.ArrayUtils to a default Java implementation. --------- Co-authored-by: EpicMo <1982742309@qq.com> Co-authored-by: JamesMCL44 <epicquarters@gmail.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: tastybento <tastybento@wasteofplastic.com>
2023-04-15 21:55:34 +02:00
args.get(0));
}
else
{
2019-08-26 06:55:22 +02:00
this.addon.logError("Unknown player name " + args.get(0));
}
return false;
}
// Add world name back at the start
String challengeName = Utils.getGameMode(this.getWorld()) + "_" + args.get(1);
Challenge challenge = this.addon.getChallengesManager().getChallenge(challengeName);
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
User target = User.getInstance(targetUUID);
if (challenge != null)
{
if (!this.addon.getChallengesManager().isChallengeComplete(targetUUID, this.getWorld(), challenge))
{
this.addon.getChallengesManager().setChallengeComplete(
targetUUID, this.getWorld(), challenge, user.getUniqueId());
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
if (user.isPlayer())
{
Release 1.2.0 (#317) * Init 1.2.0 version * Fixes #311 localization errors in zn-CN. Original translation author translated `[]` placeholders which broke locale * Init 1.2.0 version * Edit some unfit translation (#312) Edit some unfit translation * Fixes a regex bug that replaced every [player] char instead of whole word. * Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed. * Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error. * Add locale of Chinese-Hong Kong (zh-HK) (#313) Addition of locale updated to latest version * Add ${argLine} to get jacoco coverage * Updated Jacoco POM section * Update build.yml Java 17 for Surefire * Updated pladdon annotations * Add support for gamemode-specific translations. This was a request from Floris * Update ChallengesManagerTest methods with world parameter. * Implement option that excludes undeployed challenges The new option allows to toggle if undeployed challenges should be included in level completion count. Disabling option will not include these challenges for level completion. Fixes #315 * Create plugin.yml (#316) * Create plugin.yml * Update pom.xml * Update ChallengesPladdon.java * Remove dependency to org.apache.commons Replace org.apache.commons.lang.ArrayUtils to a default Java implementation. --------- Co-authored-by: EpicMo <1982742309@qq.com> Co-authored-by: JamesMCL44 <epicquarters@gmail.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: tastybento <tastybento@wasteofplastic.com>
2023-04-15 21:55:34 +02:00
Utils.sendMessage(user,
this.getWorld(),
Constants.MESSAGES + "completed",
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
Constants.PARAMETER_NAME, challenge.getFriendlyName(),
Release 1.2.0 (#317) * Init 1.2.0 version * Fixes #311 localization errors in zn-CN. Original translation author translated `[]` placeholders which broke locale * Init 1.2.0 version * Edit some unfit translation (#312) Edit some unfit translation * Fixes a regex bug that replaced every [player] char instead of whole word. * Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed. * Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error. * Add locale of Chinese-Hong Kong (zh-HK) (#313) Addition of locale updated to latest version * Add ${argLine} to get jacoco coverage * Updated Jacoco POM section * Update build.yml Java 17 for Surefire * Updated pladdon annotations * Add support for gamemode-specific translations. This was a request from Floris * Update ChallengesManagerTest methods with world parameter. * Implement option that excludes undeployed challenges The new option allows to toggle if undeployed challenges should be included in level completion count. Disabling option will not include these challenges for level completion. Fixes #315 * Create plugin.yml (#316) * Create plugin.yml * Update pom.xml * Update ChallengesPladdon.java * Remove dependency to org.apache.commons Replace org.apache.commons.lang.ArrayUtils to a default Java implementation. --------- Co-authored-by: EpicMo <1982742309@qq.com> Co-authored-by: JamesMCL44 <epicquarters@gmail.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: tastybento <tastybento@wasteofplastic.com>
2023-04-15 21:55:34 +02:00
Constants.PARAMETER_PLAYER, target.getName());
}
else
{
this.addon.log("Challenge " + challenge.getFriendlyName() + " completed for player " +
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
target.getName());
}
}
else
{
if (user.isPlayer())
{
Release 1.2.0 (#317) * Init 1.2.0 version * Fixes #311 localization errors in zn-CN. Original translation author translated `[]` placeholders which broke locale * Init 1.2.0 version * Edit some unfit translation (#312) Edit some unfit translation * Fixes a regex bug that replaced every [player] char instead of whole word. * Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed. * Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error. * Add locale of Chinese-Hong Kong (zh-HK) (#313) Addition of locale updated to latest version * Add ${argLine} to get jacoco coverage * Updated Jacoco POM section * Update build.yml Java 17 for Surefire * Updated pladdon annotations * Add support for gamemode-specific translations. This was a request from Floris * Update ChallengesManagerTest methods with world parameter. * Implement option that excludes undeployed challenges The new option allows to toggle if undeployed challenges should be included in level completion count. Disabling option will not include these challenges for level completion. Fixes #315 * Create plugin.yml (#316) * Create plugin.yml * Update pom.xml * Update ChallengesPladdon.java * Remove dependency to org.apache.commons Replace org.apache.commons.lang.ArrayUtils to a default Java implementation. --------- Co-authored-by: EpicMo <1982742309@qq.com> Co-authored-by: JamesMCL44 <epicquarters@gmail.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: tastybento <tastybento@wasteofplastic.com>
2023-04-15 21:55:34 +02:00
Utils.sendMessage(user,
this.getWorld(),
Constants.MESSAGES + "already-completed");
}
else
{
this.addon.log("Challenge was already completed");
}
}
return true;
}
else
{
if (user.isPlayer())
{
Release 1.2.0 (#317) * Init 1.2.0 version * Fixes #311 localization errors in zn-CN. Original translation author translated `[]` placeholders which broke locale * Init 1.2.0 version * Edit some unfit translation (#312) Edit some unfit translation * Fixes a regex bug that replaced every [player] char instead of whole word. * Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed. * Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error. * Add locale of Chinese-Hong Kong (zh-HK) (#313) Addition of locale updated to latest version * Add ${argLine} to get jacoco coverage * Updated Jacoco POM section * Update build.yml Java 17 for Surefire * Updated pladdon annotations * Add support for gamemode-specific translations. This was a request from Floris * Update ChallengesManagerTest methods with world parameter. * Implement option that excludes undeployed challenges The new option allows to toggle if undeployed challenges should be included in level completion count. Disabling option will not include these challenges for level completion. Fixes #315 * Create plugin.yml (#316) * Create plugin.yml * Update pom.xml * Update ChallengesPladdon.java * Remove dependency to org.apache.commons Replace org.apache.commons.lang.ArrayUtils to a default Java implementation. --------- Co-authored-by: EpicMo <1982742309@qq.com> Co-authored-by: JamesMCL44 <epicquarters@gmail.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: tastybento <tastybento@wasteofplastic.com>
2023-04-15 21:55:34 +02:00
Utils.sendMessage(user,
this.getWorld(),
Constants.ERRORS + "unknown-challenge");
}
else
{
this.addon.logError("Unknown challenge " + args.get(1));
}
return false;
}
}
this.showHelp(this, user);
return false;
}
/**
* {@inheritDoc}
*/
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args)
{
String lastString = args.get(args.size() - 1);
final List<String> returnList = new ArrayList<>();
final int size = args.size();
switch (size)
{
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
case 3 ->
// Create suggestions with all challenges that is available for users.
returnList.addAll(Util.getOnlinePlayerList(user));
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
case 4 ->
// Create suggestions with all challenges that is available for users.
returnList.addAll(this.addon.getChallengesManager().getAllChallengesNames(this.getWorld()).stream().
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
map(challenge -> challenge.substring(Utils.getGameMode(this.getWorld()).length() + 1)).toList());
default ->
returnList.add("help");
}
return Optional.of(Util.tabLimit(returnList, lastString));
}
// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
/**
* Variable that holds challenge addon. Single casting.
*/
Prepare 1.0 Release (#287) * Version 0.8.5 * Retranslated zh-CN.yml (#273) * 50% completed. * 60% completed. * 63% completed. * Completed. * Change the indentation, some improvements. Co-authored-by: zhangYi <apachezy@hotmail.com> * Updated german language file (#278) fixed double & and double whitespace * Fixes a mistaken permission for completing multiple challenges at once. * Fixes translated placeholders in PL translation. Note: translation looks bad. * Update CompleteChallengeCommandTest.java * Upgrade to BentoBox 1.17 API changes. Implement Pladdon functionality. Compile against java 16 and Spigot 1.17 * Fix Java 16 compilation. * Use BentoBox 1.17.0 * Update pom.xml * Create Statistic Requirement for Challenges addon. Statistic requirement is a new type of challenge that is based on Statistic page for clients. * Switch to annotations instead of plugin.yml file. * Move managers to a separate directory. * Add mojang authLib instead of NMS. * Rename classes to Selectors. Split single and multiple item selectors for easier implementation. Update proper locales. * Implement customizable user panels. Server owners can customize 3 panels: - main panel - gamemode selector - multiple completions Panel functions will be explained in docs later. * Update all admin panels. Admin panels will not contain better locales codding and easier-to-improve design. Remove old and unused GUIs. * Remove unused adapters. Updates Challenges and ChallengesLevel objects. Add TypeMigrationAdapter that will fix issue with renamed challenge type. * Update commands. Commands will now call correct GUI. * Update Settings file. Remove unused parts. * Fixes ChallengesManager and Completer. * Adds panel saving to the `/challenges/panels` directory. * Updates locales file. Complete rework of the locales file. Very sorry translators :( no migration. * Updates pom.xml * Updates tests. ChallengesGUITest is removed because GUI is removed. * Update default.json Split text into multiple lines. * Create template YAML file. This file format is for people who has an alergy with ingame GUI. * Implements Template reading. Add template loading via Admin Panel. Improve LibraryPanel so it could find json and yml files. * Improve coloring scheme a bit. * Change settings file. Add ability to change commands for addon. Change default mode from player challenges to island challenges. * Update Main addon class. Move vault and level detection after everything is loaded. Update command names. * Update all commands. Commands now will have an option to change their call values. * Update default config value. * Fixes #264 Challenges Menu will be opened only if player is in correct world. * Changes User#sendMessage to Utils#sendMessage This allows add "prefix" to all messages send from Challenges addon. * Separate singe and multiple listings. * Clean up Constants a bit. * Add meta for items translations. * Fix permission link. * Translates color codes for database texts. * Fixes a bug when global commands does not displays in tab-complete. Remove DefaultsCommand.java as it is not used anymore. * Fixes small bugs in translation. * Remove unnecessary "admin" tag. * Update default locale. * Update latvian locale to the latest version. * Implement multi-linguistic server support. Now server owners can specify different name, description and reward text for each challenge and level via locales file. Add showcase example. * Comment out showcase translation. * Update BentoBox version * Update missing icons for blocks. Some blocks cannot be displayed in GUI's, and were leaving empty spaces. This replaces their icon with a close representative. Fixes #286 * Add missing mob heads. * Fixes illegal stack issues in default challenges. #249 * Change from click-to-select to a proper next/previous page tooltip * Add search field to the PagedSelectors. Add missing tooltips. * Change download icon from hopper to cobweb. * Add missing tooltips to the CommonPagedPanel * Add search button to the CommonPagedPanel. Search button will allow to search elements if there are more than displayed elements. * Add missing strings into locale. * Reorder dependencies The Mojang dependency was blocking out the needed Google common packages. * Prevent errors in TryToCompleteTest Note - tests still fail. * Fixed errors and tests for CompleteChallengeCommandTest * Fixed ChallengesCommandTest tests * Fixes tests * Fix JavaDoc, Shade plugin settings * Updated .gitignore * Try different spigot API version * Remove Vault repo because it is not needed. * Excluded unnecessary files from shading. * Fixes #253 Adds TeamKick and TeamLeave events to the reset check. Do not reset challenges if data is stored per island. As in that case, they will already lose their data. * Fixes #187 Add a new method that updates unlocked level list without changing active level. This method returns if last unlocked level was changed, and in that case it triggers whole gui rebuilding. * Fixes #269 Disable waiver amount message for last challenge level. * Add timeout for repeatable challenges. Relates #71 * Implement timeout respecting in challenges completion. Implement timeout in GUI's. Relates #71 * Implement changing Timeout in the Challenge Edit GUI. Relates #71 * Implement an option to set which item type will ignore metadata per challenge. Fixes #261 Fixes #252 * Fixes failing unit-test * Removed shade plugin from POM * Replace GuiUtils and HeadLib to the PanelUtils library. * Link templates to the docs. * Remove unnecessary NMS dependency. NMS code was used for Player Heads, but instead of NMS now it uses public mojang lib. * Address some code quality reports from SonarCloud. Most of the errors are just sanity checks, as the most of null-pointers were already checked in other ways. * Fixes incorrect NEXT and PREVIOUS button descriptions. Fixes #289 * Implement MetaData ignoring for rewards. While required items had a metadata grouping, reward items did not have it. This will fix that. Fixes #289 * Fix an issue when edit menu did not display item amount. * Update lv translation. * Fixes some small bugs with translation potion base effect. There was an issue that it tried to translate extra effects and ignored main one. Relates to #290 * Fix a bug with completion broadcasting Reported via Discord. * Update pom.xml * Fixes a bug with `-1` repeat-times There was a bug that prevented the challenge to be completed if negative numbers were set in the "max-repeats" value. * Improve equal item listing. Change when items should be grouped. Instead of relaying strictly from ignoreMetaData set, now try to group equal elements without durability check, and use set only if that fails. * Update German translation (#295) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de> * Fix NPEs when running tests. Note that there are still test failures, but these are assertions and not errors. * Fix error in test class. Note this does not fix the failing assertion. * Fix failing test. Make player default to being on island. * Fixed test failures. * Avoid potential call with a null parameter to User.getInstance * Check for null world * Null check * Added null check * Require non-nulls. getInventory never returns null. * Remove various code smells. Co-authored-by: tastybento <tastybento@wasteofplastic.com> Co-authored-by: apachezy <50116371+apachezy@users.noreply.github.com> Co-authored-by: zhangYi <apachezy@hotmail.com> Co-authored-by: Qumoo <76853697+Qumoo@users.noreply.github.com> Co-authored-by: tastybento <tastybento@users.noreply.github.com> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <patrick.wassmuth@gmx.de> Co-authored-by: Michael F <unhappyangel83@googlemail.com> Co-authored-by: DAge030 <dage030@web.de>
2022-05-06 18:51:54 +02:00
private final ChallengesAddon addon;
}