mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-09-29 23:17:34 +02:00
Compare commits
70 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2843a8e3ed | ||
|
d8fb2de177 | ||
|
9cf7107c04 | ||
|
eacf76e8a3 | ||
|
20b71d7cf3 | ||
|
e4319b2fb7 | ||
|
59edce4d0d | ||
|
7ddf865430 | ||
|
f811c7ca1d | ||
|
253428b223 | ||
|
4438c36b61 | ||
|
30d191f94e | ||
|
e265a58be6 | ||
|
d69f084ba6 | ||
|
adb7d1eb47 | ||
|
7441b7717f | ||
|
e424560c37 | ||
|
7fb20e74f3 | ||
|
1916f3f267 | ||
|
78cfa51641 | ||
|
7c1deb9384 | ||
|
ec6b950304 | ||
|
d0588303c0 | ||
|
7483ff0e0f | ||
|
005d49a756 | ||
|
fe9e63f1c7 | ||
|
8a8124f36e | ||
|
74cd97fb80 | ||
|
c351225e9a | ||
|
a90d17d70d | ||
|
b6bd3d3a2e | ||
|
b82defe3b5 | ||
|
a6a3a3e12d | ||
|
48f388c7f6 | ||
|
56d7eb4259 | ||
|
34d280d5bf | ||
|
9e34910f07 | ||
|
1fdcfdd7ef | ||
|
1759ef7123 | ||
|
bba54aa08b | ||
|
ebd0b46656 | ||
|
98052d1797 | ||
|
d74cfbfe96 | ||
|
3b36f38b7c | ||
|
125a3249ac | ||
|
9da197de21 | ||
|
480ffd8eb4 | ||
|
ddebdf0e62 | ||
|
82ba144038 | ||
|
53f0a0cb37 | ||
|
550e348428 | ||
|
01bd7b82bb | ||
|
a608c8b765 | ||
|
5ab4237df4 | ||
|
de7172ef75 | ||
|
9953459e50 | ||
|
e0377fd352 | ||
|
09adbde004 | ||
|
84a38f4d8c | ||
|
1b585a22c8 | ||
|
9ed92733c7 | ||
|
431aaf46fc | ||
|
ee8eaf8e84 | ||
|
5ba7c681de | ||
|
468232cabc | ||
|
1faf3b55be | ||
|
0d69459738 | ||
|
e94d2349c3 | ||
|
8b81101ef0 | ||
|
1da624002d |
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
@ -11,21 +11,22 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 21
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
distribution: 'adopt'
|
||||||
|
java-version: 21
|
||||||
- name: Cache SonarCloud packages
|
- name: Cache SonarCloud packages
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.sonar/cache
|
path: ~/.sonar/cache
|
||||||
key: ${{ runner.os }}-sonar
|
key: ${{ runner.os }}-sonar
|
||||||
restore-keys: ${{ runner.os }}-sonar
|
restore-keys: ${{ runner.os }}-sonar
|
||||||
- name: Cache Maven packages
|
- name: Cache Maven packages
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.m2
|
path: ~/.m2
|
||||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
|
44
README.md
44
README.md
@ -2,24 +2,9 @@
|
|||||||
[![Discord](https://img.shields.io/discord/272499714048524288.svg?logo=discord)](https://discord.bentobox.world)
|
[![Discord](https://img.shields.io/discord/272499714048524288.svg?logo=discord)](https://discord.bentobox.world)
|
||||||
[![Build Status](https://ci.codemc.org/buildStatus/icon?job=BentoBoxWorld/Challenges)](https://ci.codemc.org/job/BentoBoxWorld/job/Challenges/)
|
[![Build Status](https://ci.codemc.org/buildStatus/icon?job=BentoBoxWorld/Challenges)](https://ci.codemc.org/job/BentoBoxWorld/job/Challenges/)
|
||||||
|
|
||||||
Add-on for BentoBox to provide challenges for any BentoBox GameMode.
|
Add-on for BentoBox to provide challenges for any BentoBox GameMode. Challenges can be to collect items, to have items or blocks nearby, to amass an amount of money or island levels, or to have accomplished some player statistic. Each challenge can reward the player with money, experience points, blocks, items, or other things, like permissions, Pre-built challenges are available and there is also a Web Library of pre-built ones. Customize them to fit your needs!
|
||||||
|
|
||||||
## Where to find
|
![Challenges](https://github.com/BentoBoxWorld/Challenges/assets/4407265/9b3c5278-3a9d-45f2-9ee1-2c1fc1199a8d)
|
||||||
|
|
||||||
Currently Challenges Addon is in **Beta stage**, so it may or may not contain bugs... a lot of bugs. Also it means, that some features are not working or implemented.
|
|
||||||
Latest official **Beta Release is 0.8.3**, and you can download it from [Release tab](https://github.com/BentoBoxWorld/Challenges/releases)
|
|
||||||
But it will work with BentoBox 1.14.
|
|
||||||
|
|
||||||
Latest development builds will be based on **Minecraft 1.16.1** and **BentoBox 1.14.0**.
|
|
||||||
**Nightly builds** are available in [Jenkins Server](https://ci.codemc.org/job/BentoBoxWorld/job/Challenges/lastStableBuild/).
|
|
||||||
|
|
||||||
If you like this addon but something is missing or is not working as you want, you can always submit an [Issue request](https://github.com/BentoBoxWorld/Challenges/issues) or get a support in Discord [BentoBox ![icon](https://avatars2.githubusercontent.com/u/41555324?s=15&v=4)](https://discord.bentobox.world)
|
|
||||||
|
|
||||||
## Translations
|
|
||||||
|
|
||||||
As most of BentoBox projects, Challenges Addon is translatable in any language. Everyone can contribute, and translate some parts of the addon in their language via [GitLocalize](https://gitlocalize.com/repo/2896).
|
|
||||||
If your language is not in the list, please contact to developers via Discord and it will be added there.
|
|
||||||
Unfortunately, default challenges come only in English translation. But with version 0.8.0 there will be access to different challenges libraries, where everyone could share their challenges with their translations. More information will come soon.
|
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
@ -27,21 +12,32 @@ Unfortunately, default challenges come only in English translation. But with ver
|
|||||||
2. Restart the server
|
2. Restart the server
|
||||||
3. Edit the config.yml how you want.
|
3. Edit the config.yml how you want.
|
||||||
4. Restart the server
|
4. Restart the server
|
||||||
|
5. Run the Admin challenges command to set up challenges for your game mode.
|
||||||
|
|
||||||
#### Challenges
|
#### Installation
|
||||||
|
|
||||||
By default, challenges addon comes without any challenge or level. On first runtime only Admin GUI will be accessible.
|
By default, challenges addon comes without any challenge or level. On first run time only Admin GUI will be accessible.
|
||||||
Admins can create their own challenges or import some default challenges, which importing also are available via Admin GUI. Default challenges contains 5 levels and 57 challenges.
|
Admins can create their own challenges or import some default challenges. Default challenges contains 5 levels and 57 challenges.
|
||||||
There exist also Web Library, where users can download public challenges. It is accessible with Admin GUI by clicking on Web icon.
|
There also exists a Web Library, where admins can download public challenges. It is accessible from the Admin GUI by clicking on the Web icon.
|
||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
- [x] BentoBox - 1.14 versions
|
- [x] BentoBok
|
||||||
- [x] BSkyBlock
|
- [x] BSkyBlock
|
||||||
- [x] AcidIsland
|
- [x] AcidIsland
|
||||||
- [x] SkyGrid
|
- [x] SkyGrid
|
||||||
- [x] CaveBlock
|
- [x] CaveBlock
|
||||||
|
|
||||||
## Information
|
## Translations
|
||||||
|
|
||||||
|
As with most of BentoBox projects, Challenges Addon is translatable into any language. Everyone can contribute, and translate some parts of the addon in their language via [GitLocalize](https://gitlocalize.com/repo/2896).
|
||||||
|
If your language is not in the list, please contact the developers via Discord and it will be added there.
|
||||||
|
Unfortunately, default challenges come only be in English, but there are different challenges libraries where everyone can share their challenges with their translations.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
More information can be found in the docs: https://docs.bentobox.world/en/latest/addons/Challenges/
|
||||||
|
|
||||||
|
## Bugs or feature requests
|
||||||
|
If you like this addon but something is missing or is not working as you want, you can always submit an [Issue request](https://github.com/BentoBoxWorld/Challenges/issues) or get a support in Discord [BentoBox ![icon](https://avatars2.githubusercontent.com/u/41555324?s=15&v=4)](https://discord.bentobox.world)
|
||||||
|
|
||||||
More information can be found in [Wiki Pages](https://docs.bentobox.world/en/latest/addons/Challenges/).
|
|
||||||
|
85
pom.xml
85
pom.xml
@ -32,19 +32,19 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>17</java.version>
|
<java.version>21</java.version>
|
||||||
<powermock.version>2.0.9</powermock.version>
|
<powermock.version>2.0.9</powermock.version>
|
||||||
<!-- More visible way how to change dependency versions -->
|
<!-- More visible way how to change dependency versions -->
|
||||||
<spigot.version>1.17.1-R0.1-SNAPSHOT</spigot.version>
|
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>
|
||||||
<spigot-annotations.version>1.2.3-SNAPSHOT</spigot-annotations.version>
|
<spigot-annotations.version>1.2.3-SNAPSHOT</spigot-annotations.version>
|
||||||
<bentobox.version>1.21.0</bentobox.version>
|
<bentobox.version>2.4.2</bentobox.version>
|
||||||
<level.version>2.6.3</level.version>
|
<level.version>2.6.3</level.version>
|
||||||
<vault.version>1.7</vault.version>
|
<vault.version>1.7</vault.version>
|
||||||
<panelutils.version>1.1.0</panelutils.version>
|
<panelutils.version>1.2.0</panelutils.version>
|
||||||
<!-- Revision variable removes warning about dynamic version -->
|
<!-- Revision variable removes warning about dynamic version -->
|
||||||
<revision>${build.version}-SNAPSHOT</revision>
|
<revision>${build.version}-SNAPSHOT</revision>
|
||||||
<!-- This allows to change between versions and snapshots. -->
|
<!-- This allows to change between versions and snapshots. -->
|
||||||
<build.version>1.2.0</build.version>
|
<build.version>1.3.2</build.version>
|
||||||
<build.number>-LOCAL</build.number>
|
<build.number>-LOCAL</build.number>
|
||||||
<!-- Sonar Cloud -->
|
<!-- Sonar Cloud -->
|
||||||
<sonar.projectKey>BentoBoxWorld_Challenges</sonar.projectKey>
|
<sonar.projectKey>BentoBoxWorld_Challenges</sonar.projectKey>
|
||||||
@ -120,6 +120,12 @@
|
|||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- This is required for PowerMockito to work and must be placed before it -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.javassist</groupId>
|
||||||
|
<artifactId>javassist</artifactId>
|
||||||
|
<version>3.30.2-GA</version>
|
||||||
|
</dependency>
|
||||||
<!-- Spigot API -->
|
<!-- Spigot API -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
@ -187,6 +193,11 @@
|
|||||||
<version>1.5.21</version>
|
<version>1.5.21</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-math3</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -217,6 +228,38 @@
|
|||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
<configuration>
|
||||||
|
<minimizeJar>true</minimizeJar>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>lv.id.bonne:panelutils:*</include>
|
||||||
|
</includes>
|
||||||
|
</artifactSet>
|
||||||
|
<transformers>
|
||||||
|
<!-- Add a transformer to exclude any other manifest files (possibly from dependencies). -->
|
||||||
|
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
|
||||||
|
<resource>MANIFEST.MF</resource>
|
||||||
|
</transformer>
|
||||||
|
<!-- Add a transformer to include your custom manifest file. -->
|
||||||
|
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
|
||||||
|
<resource>META-INF/MANIFEST.MF</resource>
|
||||||
|
<file>src/main/resources/META-INF/MANIFEST.MF</file>
|
||||||
|
</transformer>
|
||||||
|
</transformers>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
@ -325,40 +368,15 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
<version>0.8.4</version>
|
<version>0.8.10</version>
|
||||||
<configuration>
|
|
||||||
<append>true</append>
|
|
||||||
<excludes>
|
|
||||||
<!-- This is required to prevent Jacoco from adding
|
|
||||||
synthetic fields to a JavaBean class (causes errors in testing) -->
|
|
||||||
<exclude>**/*Names*</exclude>
|
|
||||||
</excludes>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>pre-unit-test</id>
|
|
||||||
<goals>
|
|
||||||
<goal>prepare-agent</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>post-unit-test</id>
|
|
||||||
<goals>
|
|
||||||
<goal>report</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.jacoco</groupId>
|
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
|
||||||
<version>0.8.7</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<append>true</append>
|
<append>true</append>
|
||||||
<excludes>
|
<excludes>
|
||||||
<!-- This is required to prevent Jacoco from adding
|
<!-- This is required to prevent Jacoco from adding
|
||||||
synthetic fields to a JavaBean class (causes errors in testing) -->
|
synthetic fields to a JavaBean class (causes errors in testing) -->
|
||||||
<exclude>**/*Names*</exclude>
|
<exclude>**/*Names*</exclude>
|
||||||
|
<!-- Prevents the Material is too large to mock error -->
|
||||||
|
<exclude>org/bukkit/Material*</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
@ -378,6 +396,7 @@
|
|||||||
<format>XML</format>
|
<format>XML</format>
|
||||||
</formats>
|
</formats>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -15,9 +15,13 @@ import world.bentobox.bentobox.api.addons.Pladdon;
|
|||||||
*/
|
*/
|
||||||
public class ChallengesPladdon extends Pladdon
|
public class ChallengesPladdon extends Pladdon
|
||||||
{
|
{
|
||||||
|
private Addon addon;
|
||||||
@Override
|
@Override
|
||||||
public Addon getAddon()
|
public Addon getAddon()
|
||||||
{
|
{
|
||||||
return new ChallengesAddon();
|
if (addon == null) {
|
||||||
|
addon = new ChallengesAddon();
|
||||||
|
}
|
||||||
|
return addon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -952,6 +952,8 @@ public class TryToComplete
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
requiredItems = Collections.emptyList();
|
requiredItems = Collections.emptyList();
|
||||||
|
// Set maxTime to 2, to not crash client when completing 2147483647 times.
|
||||||
|
maxTimes = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the result
|
// Return the result
|
||||||
|
@ -7,11 +7,19 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Statistic;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.*;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.potion.PotionData;
|
import org.bukkit.potion.PotionData;
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
@ -558,6 +566,13 @@ public class Utils
|
|||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
// Return the display name if it already has one
|
||||||
|
if (object.hasItemMeta()) {
|
||||||
|
ItemMeta im = object.getItemMeta();
|
||||||
|
if (im.hasDisplayName()) {
|
||||||
|
return im.getDisplayName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find addon structure with:
|
// Find addon structure with:
|
||||||
// [addon]:
|
// [addon]:
|
||||||
@ -823,7 +838,7 @@ public class Utils
|
|||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
enchantmentMeta.getEnchants().forEach((enchantment, level) -> {
|
enchantmentMeta.getStoredEnchants().forEach((enchantment, level) -> {
|
||||||
builder.append("\n");
|
builder.append("\n");
|
||||||
builder.append(user.getTranslationOrNothing(Constants.ITEM_STACKS + "meta.enchant-meta",
|
builder.append(user.getTranslationOrNothing(Constants.ITEM_STACKS + "meta.enchant-meta",
|
||||||
"[type]", prettifyObject(enchantment, user),
|
"[type]", prettifyObject(enchantment, user),
|
||||||
@ -868,8 +883,8 @@ public class Utils
|
|||||||
final String metaReference = Constants.ITEM_STACKS + "meta.";
|
final String metaReference = Constants.ITEM_STACKS + "meta.";
|
||||||
|
|
||||||
String meta = user.getTranslationOrNothing(metaReference + "book-meta",
|
String meta = user.getTranslationOrNothing(metaReference + "book-meta",
|
||||||
"[title]", bookMeta.getTitle(),
|
"[title]", bookMeta.hasTitle() ? bookMeta.getTitle() : "",
|
||||||
"[author]", bookMeta.getAuthor());
|
"[author]", bookMeta.hasAuthor() ? bookMeta.getAuthor() : "");
|
||||||
|
|
||||||
return user.getTranslationOrNothing(Constants.ITEM_STACKS + "generic",
|
return user.getTranslationOrNothing(Constants.ITEM_STACKS + "generic",
|
||||||
"[type]", prettifyObject(itemType, user),
|
"[type]", prettifyObject(itemType, user),
|
||||||
|
@ -151,6 +151,11 @@ public class WebManager
|
|||||||
if (this.plugin.getSettings().isLogGithubDownloadData())
|
if (this.plugin.getSettings().isLogGithubDownloadData())
|
||||||
{
|
{
|
||||||
this.plugin.log("Could not connect to GitHub.");
|
this.plugin.log("Could not connect to GitHub.");
|
||||||
|
this.plugin.log(
|
||||||
|
"JSON files can be found at https://github.com/BentoBoxWorld/weblink/tree/master/challenges/library");
|
||||||
|
user.sendRawMessage("Could not connect to GitHub.");
|
||||||
|
user.sendRawMessage(
|
||||||
|
"JSON files can be found at https://github.com/BentoBoxWorld/weblink/tree/master/challenges/library");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -649,6 +649,12 @@ challenges:
|
|||||||
visible: Zeigen Sie sichtbare Herausforderungen
|
visible: Zeigen Sie sichtbare Herausforderungen
|
||||||
hidden: Alle Herausforderungen anzeigen
|
hidden: Alle Herausforderungen anzeigen
|
||||||
toggleable: Umschalten zulassen
|
toggleable: Umschalten zulassen
|
||||||
|
include_undeployed:
|
||||||
|
name: "&f&l Nicht bereitgestellte Herausforderungen einschließen"
|
||||||
|
description: "&7 Gibt an, ob nicht bereitgestellte \n&7 Herausforderungen
|
||||||
|
\n&7 für den Abschluss von Level \n&7 angerechnet werden sollen."
|
||||||
|
enabled: "&2 Aktiviert"
|
||||||
|
disabled: "&c Deaktiviert"
|
||||||
download:
|
download:
|
||||||
name: "&f&l Bibliotheken herunterladen"
|
name: "&f&l Bibliotheken herunterladen"
|
||||||
description: |-
|
description: |-
|
||||||
@ -851,7 +857,7 @@ challenges:
|
|||||||
environment-single: "&7 Limitiert auf [environment]"
|
environment-single: "&7 Limitiert auf [environment]"
|
||||||
environment-title: "&7 Limitiert auf:"
|
environment-title: "&7 Limitiert auf:"
|
||||||
environment-list: " &7 - &e [environment]"
|
environment-list: " &7 - &e [environment]"
|
||||||
permission-single: "&c Requires [permissions] permission"
|
permission-single: "&c Erfordert die Berechtigung [permission]"
|
||||||
permissions-title: "&c Erfordert Berechtigungen:"
|
permissions-title: "&c Erfordert Berechtigungen:"
|
||||||
permissions-list: " &c - [permission]"
|
permissions-list: " &c - [permission]"
|
||||||
island:
|
island:
|
||||||
@ -998,9 +1004,9 @@ challenges:
|
|||||||
write-reward-commands: "&e Bitte geben Sie pro Zeile im Chat einen neuen Belohnungsbefehl
|
write-reward-commands: "&e Bitte geben Sie pro Zeile im Chat einen neuen Belohnungsbefehl
|
||||||
ein und beenden Sie den Chat in einer eigenen Zeile."
|
ein und beenden Sie den Chat in einer eigenen Zeile."
|
||||||
reward-commands-changed: "&a Erfolg, die Belohnungsbefehle wurden aktualisiert."
|
reward-commands-changed: "&a Erfolg, die Belohnungsbefehle wurden aktualisiert."
|
||||||
write-repeat-reward-commands: "&e Bitte geben Sie pro Zeile im Chat einen neuen
|
write-repeat-reward-commands: "&e Geben Sie bitte pro Zeile im Chat einen neuen
|
||||||
Belohnungswiederholungsbefehl ein und beenden Sie den Chat in einer eigenen
|
Befehl zur Wiederholung der Belohnung ein und klicken Sie zum Beenden auf „Beenden“
|
||||||
Zeile."
|
in einer eigenen Zeile."
|
||||||
repeat-reward-commands-changed: "&a Erfolg, die Wiederholungsbelohnungsbefehle
|
repeat-reward-commands-changed: "&a Erfolg, die Wiederholungsbelohnungsbefehle
|
||||||
wurden aktualisiert."
|
wurden aktualisiert."
|
||||||
challenge-removed: "&a Herausforderungen [challende] für [gamemode] wird aus der
|
challenge-removed: "&a Herausforderungen [challende] für [gamemode] wird aus der
|
||||||
@ -1098,6 +1104,12 @@ challenges:
|
|||||||
not-hooked: "&c Challenges Addon konnte keinen GameMode finden."
|
not-hooked: "&c Challenges Addon konnte keinen GameMode finden."
|
||||||
timeout: "&c Diese Abfrage erfordert eine Wartezeit von [timeout] zwischen den
|
timeout: "&c Diese Abfrage erfordert eine Wartezeit von [timeout] zwischen den
|
||||||
Vervollständigungen. Sie müssen [wait-time] warten, bis Sie es erneut abschließen."
|
Vervollständigungen. Sie müssen [wait-time] warten, bis Sie es erneut abschließen."
|
||||||
|
requirement-not-met: "&c Für diese Herausforderung muss [statistic] [number] haben.
|
||||||
|
Sie haben nur [value]."
|
||||||
|
requirement-not-met-entity: "&c Für diese Herausforderung muss [statistic] [entity]
|
||||||
|
über [number] verfügen. Sie haben nur [value]."
|
||||||
|
requirement-not-met-material: "&c Diese Herausforderung erfordert, dass [statistic]
|
||||||
|
[material] [number] hat. Sie haben nur [value]."
|
||||||
protection:
|
protection:
|
||||||
flags:
|
flags:
|
||||||
CHALLENGES_ISLAND_PROTECTION:
|
CHALLENGES_ISLAND_PROTECTION:
|
||||||
|
@ -907,7 +907,7 @@ challenges:
|
|||||||
# Message that will be added after environment-title-multiple.
|
# Message that will be added after environment-title-multiple.
|
||||||
environment-list: " &7 - &e [environment]"
|
environment-list: " &7 - &e [environment]"
|
||||||
# Message that will replace [permissions] placeholder if there is just a single permission.
|
# Message that will replace [permissions] placeholder if there is just a single permission.
|
||||||
permission-single: "&c Requires [permissions] permission"
|
permission-single: "&c Requires [permission] permission"
|
||||||
# Message that will replace [permissions] placeholder if there are multiple permissions.
|
# Message that will replace [permissions] placeholder if there are multiple permissions.
|
||||||
permissions-title: "&c Requires permissions: "
|
permissions-title: "&c Requires permissions: "
|
||||||
# Message that will be added after permissions-title-multiple.
|
# Message that will be added after permissions-title-multiple.
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1102
src/main/resources/locales/hu.yml
Normal file
1102
src/main/resources/locales/hu.yml
Normal file
File diff suppressed because it is too large
Load Diff
1113
src/main/resources/locales/uk.yml
Normal file
1113
src/main/resources/locales/uk.yml
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@ gamemode_panel:
|
|||||||
content:
|
content:
|
||||||
2:
|
2:
|
||||||
1:
|
1:
|
||||||
icon: TIPPED_ARROW:INSTANT_HEAL::::1
|
icon: tipped_arrow{CustomPotionColor:11546150}
|
||||||
title: challenges.gui.buttons.previous.name
|
title: challenges.gui.buttons.previous.name
|
||||||
description: challenges.gui.buttons.previous.description
|
description: challenges.gui.buttons.previous.description
|
||||||
data:
|
data:
|
||||||
@ -33,7 +33,7 @@ gamemode_panel:
|
|||||||
7: gamemode
|
7: gamemode
|
||||||
8: gamemode
|
8: gamemode
|
||||||
9:
|
9:
|
||||||
icon: TIPPED_ARROW:JUMP::::1
|
icon: tipped_arrow{CustomPotionColor:8439583}
|
||||||
title: challenges.gui.buttons.next.name
|
title: challenges.gui.buttons.next.name
|
||||||
description: challenges.gui.buttons.next.description
|
description: challenges.gui.buttons.next.description
|
||||||
data:
|
data:
|
||||||
|
@ -23,7 +23,7 @@ main_panel:
|
|||||||
8: challenge_button
|
8: challenge_button
|
||||||
3:
|
3:
|
||||||
1:
|
1:
|
||||||
icon: TIPPED_ARROW:INSTANT_HEAL::::1
|
icon: tipped_arrow{CustomPotionColor:11546150}
|
||||||
title: challenges.gui.buttons.previous.name
|
title: challenges.gui.buttons.previous.name
|
||||||
description: challenges.gui.buttons.previous.description
|
description: challenges.gui.buttons.previous.description
|
||||||
data:
|
data:
|
||||||
@ -41,7 +41,7 @@ main_panel:
|
|||||||
7: challenge_button
|
7: challenge_button
|
||||||
8: challenge_button
|
8: challenge_button
|
||||||
9:
|
9:
|
||||||
icon: TIPPED_ARROW:JUMP::::1
|
icon: tipped_arrow{CustomPotionColor:8439583}
|
||||||
title: challenges.gui.buttons.next.name
|
title: challenges.gui.buttons.next.name
|
||||||
description: challenges.gui.buttons.next.description
|
description: challenges.gui.buttons.next.description
|
||||||
data:
|
data:
|
||||||
@ -53,7 +53,7 @@ main_panel:
|
|||||||
tooltip: challenges.gui.tips.click-to-next
|
tooltip: challenges.gui.tips.click-to-next
|
||||||
5:
|
5:
|
||||||
1:
|
1:
|
||||||
icon: TIPPED_ARROW:INSTANT_HEAL::::1
|
icon: tipped_arrow{CustomPotionColor:11546150}
|
||||||
title: challenges.gui.buttons.previous.name
|
title: challenges.gui.buttons.previous.name
|
||||||
description: challenges.gui.buttons.previous.description
|
description: challenges.gui.buttons.previous.description
|
||||||
data:
|
data:
|
||||||
@ -71,7 +71,7 @@ main_panel:
|
|||||||
7: level_button
|
7: level_button
|
||||||
8: level_button
|
8: level_button
|
||||||
9:
|
9:
|
||||||
icon: TIPPED_ARROW:JUMP::::1
|
icon: tipped_arrow{CustomPotionColor:8439583}
|
||||||
title: challenges.gui.buttons.next.name
|
title: challenges.gui.buttons.next.name
|
||||||
description: challenges.gui.buttons.next.description
|
description: challenges.gui.buttons.next.description
|
||||||
data:
|
data:
|
||||||
|
@ -82,7 +82,7 @@ public class ChallengesManagerTest {
|
|||||||
// Mocks
|
// Mocks
|
||||||
@Mock
|
@Mock
|
||||||
private ChallengesAddon addon;
|
private ChallengesAddon addon;
|
||||||
@Mock
|
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
@Mock
|
@Mock
|
||||||
private IslandWorldManager iwm;
|
private IslandWorldManager iwm;
|
||||||
@ -134,9 +134,11 @@ public class ChallengesManagerTest {
|
|||||||
when(s.getDatabaseType()).thenReturn(DatabaseType.JSON);
|
when(s.getDatabaseType()).thenReturn(DatabaseType.JSON);
|
||||||
|
|
||||||
// Addon Settings
|
// Addon Settings
|
||||||
|
settings = new Settings();
|
||||||
when(addon.getChallengesSettings()).thenReturn(settings);
|
when(addon.getChallengesSettings()).thenReturn(settings);
|
||||||
when(settings.isStoreHistory()).thenReturn(true);
|
settings.setStoreAsIslandData(false);
|
||||||
when(settings.getLifeSpan()).thenReturn(10);
|
settings.setStoreHistory(true);
|
||||||
|
settings.setLifeSpan(10);
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
database = new File("database");
|
database = new File("database");
|
||||||
@ -264,7 +266,7 @@ public class ChallengesManagerTest {
|
|||||||
assertTrue(cm.loadChallenge(challenge, world, false, user, true));
|
assertTrue(cm.loadChallenge(challenge, world, false, user, true));
|
||||||
// load twice - no overwrite, not silent
|
// load twice - no overwrite, not silent
|
||||||
assertFalse(cm.loadChallenge(challenge, world, false, user, false));
|
assertFalse(cm.loadChallenge(challenge, world, false, user, false));
|
||||||
verify(user).getTranslation("challenges.messages.load-skipping", "[value]", "name");
|
verify(user).getTranslation(world, "challenges.messages.load-skipping", "[value]", "name");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -276,7 +278,7 @@ public class ChallengesManagerTest {
|
|||||||
assertTrue(cm.loadChallenge(challenge, world, false, user, true));
|
assertTrue(cm.loadChallenge(challenge, world, false, user, true));
|
||||||
// overwrite
|
// overwrite
|
||||||
assertTrue(cm.loadChallenge(challenge, world, true, user, true));
|
assertTrue(cm.loadChallenge(challenge, world, true, user, true));
|
||||||
verify(user, never()).getTranslation(anyString(), anyString(), anyString());
|
verify(user, never()).getTranslation(any(World.class), anyString(), anyString(), anyString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -288,7 +290,7 @@ public class ChallengesManagerTest {
|
|||||||
assertTrue(cm.loadChallenge(challenge, world, false, user, true));
|
assertTrue(cm.loadChallenge(challenge, world, false, user, true));
|
||||||
// overwrite not silent
|
// overwrite not silent
|
||||||
assertTrue(cm.loadChallenge(challenge, world, true, user, false));
|
assertTrue(cm.loadChallenge(challenge, world, true, user, false));
|
||||||
verify(user).getTranslation("challenges.messages.load-overwriting", "[value]", "name");
|
verify(user).getTranslation(world, "challenges.messages.load-overwriting", "[value]", "name");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -311,7 +313,7 @@ public class ChallengesManagerTest {
|
|||||||
assertTrue(cm.loadLevel(level, world, false, user, true));
|
assertTrue(cm.loadLevel(level, world, false, user, true));
|
||||||
// load twice - no overwrite, not silent
|
// load twice - no overwrite, not silent
|
||||||
assertFalse(cm.loadLevel(level, world, false, user, false));
|
assertFalse(cm.loadLevel(level, world, false, user, false));
|
||||||
verify(user).getTranslation("challenges.messages.load-skipping", "[value]", "Novice");
|
verify(user).getTranslation(world, "challenges.messages.load-skipping", "[value]", "Novice");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -323,7 +325,7 @@ public class ChallengesManagerTest {
|
|||||||
assertTrue(cm.loadLevel(level, world, false, user, true));
|
assertTrue(cm.loadLevel(level, world, false, user, true));
|
||||||
// overwrite
|
// overwrite
|
||||||
assertTrue(cm.loadLevel(level, world, true, user, true));
|
assertTrue(cm.loadLevel(level, world, true, user, true));
|
||||||
verify(user, never()).getTranslation(anyString(), anyString(), anyString());
|
verify(user, never()).getTranslation(any(World.class), anyString(), anyString(), anyString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -335,7 +337,7 @@ public class ChallengesManagerTest {
|
|||||||
assertTrue(cm.loadLevel(level, world, false, user, true));
|
assertTrue(cm.loadLevel(level, world, false, user, true));
|
||||||
// overwrite not silent
|
// overwrite not silent
|
||||||
assertTrue(cm.loadLevel(level, world, true, user, false));
|
assertTrue(cm.loadLevel(level, world, true, user, false));
|
||||||
verify(user).getTranslation("challenges.messages.load-overwriting", "[value]", "Novice");
|
verify(user).getTranslation(world, "challenges.messages.load-overwriting", "[value]", "Novice");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,6 @@ import static org.junit.Assert.assertTrue;
|
|||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
@ -17,7 +16,6 @@ import java.util.Optional;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemFactory;
|
import org.bukkit.inventory.ItemFactory;
|
||||||
@ -38,7 +36,6 @@ import world.bentobox.bentobox.BentoBox;
|
|||||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||||
import world.bentobox.bentobox.api.configuration.WorldSettings;
|
import world.bentobox.bentobox.api.configuration.WorldSettings;
|
||||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
import world.bentobox.bentobox.database.objects.Island;
|
import world.bentobox.bentobox.database.objects.Island;
|
||||||
import world.bentobox.bentobox.managers.CommandsManager;
|
import world.bentobox.bentobox.managers.CommandsManager;
|
||||||
@ -46,16 +43,16 @@ import world.bentobox.bentobox.managers.IslandWorldManager;
|
|||||||
import world.bentobox.bentobox.managers.IslandsManager;
|
import world.bentobox.bentobox.managers.IslandsManager;
|
||||||
import world.bentobox.bentobox.util.Util;
|
import world.bentobox.bentobox.util.Util;
|
||||||
import world.bentobox.challenges.ChallengesAddon;
|
import world.bentobox.challenges.ChallengesAddon;
|
||||||
import world.bentobox.challenges.managers.ChallengesManager;
|
|
||||||
import world.bentobox.challenges.config.Settings;
|
import world.bentobox.challenges.config.Settings;
|
||||||
import world.bentobox.challenges.config.SettingsUtils.VisibilityMode;
|
import world.bentobox.challenges.config.SettingsUtils.VisibilityMode;
|
||||||
|
import world.bentobox.challenges.managers.ChallengesManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author tastybento
|
* @author tastybento
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RunWith(PowerMockRunner.class)
|
@RunWith(PowerMockRunner.class)
|
||||||
@PrepareForTest({Bukkit.class, BentoBox.class, ChatColor.class, Util.class})
|
@PrepareForTest({ Bukkit.class, BentoBox.class, Util.class })
|
||||||
public class ChallengesCommandTest {
|
public class ChallengesCommandTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@ -143,10 +140,6 @@ public class ChallengesCommandTest {
|
|||||||
// Challenges exist
|
// Challenges exist
|
||||||
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(true);
|
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(true);
|
||||||
|
|
||||||
// ChatColor
|
|
||||||
PowerMockito.mockStatic(ChatColor.class);
|
|
||||||
when(ChatColor.translateAlternateColorCodes(any(char.class), anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(1, String.class));
|
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
Settings settings = new Settings();
|
Settings settings = new Settings();
|
||||||
when(addon.getChallengesSettings()).thenReturn(settings);
|
when(addon.getChallengesSettings()).thenReturn(settings);
|
||||||
@ -161,6 +154,9 @@ public class ChallengesCommandTest {
|
|||||||
// Util
|
// Util
|
||||||
PowerMockito.mockStatic(Util.class, Mockito.RETURNS_MOCKS);
|
PowerMockito.mockStatic(Util.class, Mockito.RETURNS_MOCKS);
|
||||||
when(Util.sameWorld(any(), any())).thenReturn(true);
|
when(Util.sameWorld(any(), any())).thenReturn(true);
|
||||||
|
when(Util.translateColorCodes(anyString()))
|
||||||
|
.thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
||||||
|
|
||||||
// Command under test
|
// Command under test
|
||||||
cc = new ChallengesPlayerCommand(addon, ic);
|
cc = new ChallengesPlayerCommand(addon, ic);
|
||||||
}
|
}
|
||||||
@ -172,7 +168,7 @@ public class ChallengesCommandTest {
|
|||||||
public void testCanExecuteWrongWorld() {
|
public void testCanExecuteWrongWorld() {
|
||||||
when(iwm.inWorld(any(World.class))).thenReturn(false);
|
when(iwm.inWorld(any(World.class))).thenReturn(false);
|
||||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||||
verify(user).getTranslation("general.errors.wrong-world");
|
verify(user).getTranslation(world, "general.errors.wrong-world");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,7 +180,7 @@ public class ChallengesCommandTest {
|
|||||||
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
||||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||||
verify(addon).logError("There are no challenges set up in world!");
|
verify(addon).logError("There are no challenges set up in world!");
|
||||||
verify(user).getTranslation("challenges.errors.no-challenges");
|
verify(user).getTranslation(world, "challenges.errors.no-challenges");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,8 +192,8 @@ public class ChallengesCommandTest {
|
|||||||
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
||||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||||
verify(addon).logError("There are no challenges set up in world!");
|
verify(addon).logError("There are no challenges set up in world!");
|
||||||
verify(user).getTranslation("challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
verify(user).getTranslation(world, "challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
||||||
verify(user, never()).getTranslation("challenges.errors.no-challenges");
|
verify(user, never()).getTranslation(world, "challenges.errors.no-challenges");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,8 +205,8 @@ public class ChallengesCommandTest {
|
|||||||
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
||||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||||
verify(addon).logError("There are no challenges set up in world!");
|
verify(addon).logError("There are no challenges set up in world!");
|
||||||
verify(user).getTranslation("challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
verify(user).getTranslation(world, "challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
||||||
verify(user, never()).getTranslation("challenges.errors.no-challenges");
|
verify(user, never()).getTranslation(world, "challenges.errors.no-challenges");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -223,8 +219,8 @@ public class ChallengesCommandTest {
|
|||||||
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
||||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||||
verify(addon).logError("There are no challenges set up in world!");
|
verify(addon).logError("There are no challenges set up in world!");
|
||||||
verify(user).getTranslation("challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
verify(user).getTranslation(world, "challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
||||||
verify(user, never()).getTranslation("challenges.errors.no-challenges");
|
verify(user, never()).getTranslation(world, "challenges.errors.no-challenges");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -234,7 +230,7 @@ public class ChallengesCommandTest {
|
|||||||
public void testCanExecuteNoIsland() {
|
public void testCanExecuteNoIsland() {
|
||||||
when(im.getIsland(any(), any(User.class))).thenReturn(null);
|
when(im.getIsland(any(), any(User.class))).thenReturn(null);
|
||||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||||
verify(user).getTranslation("general.errors.no-island");
|
verify(user).getTranslation(world, "general.errors.no-island");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -246,16 +242,6 @@ public class ChallengesCommandTest {
|
|||||||
verify(user, never()).sendMessage(anyString());
|
verify(user, never()).sendMessage(anyString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test method for {@link ChallengesPlayerCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testExecuteUserStringListOfStringConsole() {
|
|
||||||
User console = mock(User.class);
|
|
||||||
assertFalse(cc.execute(console, "challenges", Collections.emptyList()));
|
|
||||||
verify(console).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link ChallengesPlayerCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
* Test method for {@link ChallengesPlayerCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,6 @@ import java.util.Optional;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemFactory;
|
import org.bukkit.inventory.ItemFactory;
|
||||||
@ -46,11 +45,12 @@ import world.bentobox.bentobox.managers.IslandWorldManager;
|
|||||||
import world.bentobox.bentobox.managers.IslandsManager;
|
import world.bentobox.bentobox.managers.IslandsManager;
|
||||||
import world.bentobox.bentobox.util.Util;
|
import world.bentobox.bentobox.util.Util;
|
||||||
import world.bentobox.challenges.ChallengesAddon;
|
import world.bentobox.challenges.ChallengesAddon;
|
||||||
import world.bentobox.challenges.managers.ChallengesManager;
|
|
||||||
import world.bentobox.challenges.config.Settings;
|
import world.bentobox.challenges.config.Settings;
|
||||||
import world.bentobox.challenges.config.SettingsUtils.VisibilityMode;
|
import world.bentobox.challenges.config.SettingsUtils.VisibilityMode;
|
||||||
import world.bentobox.challenges.database.object.Challenge;
|
import world.bentobox.challenges.database.object.Challenge;
|
||||||
|
import world.bentobox.challenges.managers.ChallengesManager;
|
||||||
import world.bentobox.challenges.tasks.TryToComplete;
|
import world.bentobox.challenges.tasks.TryToComplete;
|
||||||
|
import world.bentobox.challenges.utils.Constants;
|
||||||
import world.bentobox.challenges.utils.Utils;
|
import world.bentobox.challenges.utils.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +58,7 @@ import world.bentobox.challenges.utils.Utils;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RunWith(PowerMockRunner.class)
|
@RunWith(PowerMockRunner.class)
|
||||||
@PrepareForTest({Bukkit.class, BentoBox.class, ChatColor.class, Utils.class, TryToComplete.class, Util.class})
|
@PrepareForTest({ Bukkit.class, BentoBox.class, Utils.class, TryToComplete.class, Util.class })
|
||||||
public class CompleteChallengeCommandTest {
|
public class CompleteChallengeCommandTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@ -149,11 +149,6 @@ public class CompleteChallengeCommandTest {
|
|||||||
List<String> nameList = Arrays.asList("world_maker", "world_placer", "bad_challenge_name", "world_breaker");
|
List<String> nameList = Arrays.asList("world_maker", "world_placer", "bad_challenge_name", "world_breaker");
|
||||||
when(chm.getAllChallengesNames(any())).thenReturn(nameList);
|
when(chm.getAllChallengesNames(any())).thenReturn(nameList);
|
||||||
|
|
||||||
|
|
||||||
// ChatColor
|
|
||||||
PowerMockito.mockStatic(ChatColor.class);
|
|
||||||
when(ChatColor.translateAlternateColorCodes(any(char.class), anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(1, String.class));
|
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
Settings settings = new Settings();
|
Settings settings = new Settings();
|
||||||
when(addon.getChallengesSettings()).thenReturn(settings);
|
when(addon.getChallengesSettings()).thenReturn(settings);
|
||||||
@ -175,6 +170,8 @@ public class CompleteChallengeCommandTest {
|
|||||||
// Util
|
// Util
|
||||||
PowerMockito.mockStatic(Util.class);
|
PowerMockito.mockStatic(Util.class);
|
||||||
when(Util.tabLimit(any(), any())).thenAnswer((Answer<List<String>>) invocation -> (List<String>)invocation.getArgument(0, List.class));
|
when(Util.tabLimit(any(), any())).thenAnswer((Answer<List<String>>) invocation -> (List<String>)invocation.getArgument(0, List.class));
|
||||||
|
when(Util.translateColorCodes(anyString()))
|
||||||
|
.thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
||||||
|
|
||||||
// Command under test
|
// Command under test
|
||||||
cc = new CompleteChallengeCommand(addon, ic);
|
cc = new CompleteChallengeCommand(addon, ic);
|
||||||
@ -207,7 +204,8 @@ public class CompleteChallengeCommandTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testExecuteUserStringListOfStringNoArgs() {
|
public void testExecuteUserStringListOfStringNoArgs() {
|
||||||
assertFalse(cc.execute(user, "complete", Collections.emptyList()));
|
assertFalse(cc.execute(user, "complete", Collections.emptyList()));
|
||||||
verify(user).getTranslation(eq("challenges.errors.no-name"));
|
PowerMockito.verifyStatic(Utils.class);
|
||||||
|
Utils.sendMessage(user, world, Constants.ERRORS + "no-name");
|
||||||
verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock"));
|
verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +216,8 @@ public class CompleteChallengeCommandTest {
|
|||||||
public void testExecuteUserStringListOfStringUnknownChallenge() {
|
public void testExecuteUserStringListOfStringUnknownChallenge() {
|
||||||
when(chm.getChallenge(anyString())).thenReturn(null);
|
when(chm.getChallenge(anyString())).thenReturn(null);
|
||||||
assertFalse(cc.execute(user, "complete", Collections.singletonList("mychal")));
|
assertFalse(cc.execute(user, "complete", Collections.singletonList("mychal")));
|
||||||
verify(user).getTranslation(eq("challenges.errors.unknown-challenge"));
|
PowerMockito.verifyStatic(Utils.class);
|
||||||
|
Utils.sendMessage(user, world, Constants.ERRORS + "unknown-challenge");
|
||||||
verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock"));
|
verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +246,8 @@ public class CompleteChallengeCommandTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testExecuteUserStringListOfStringKnownChallengeSuccessMultipleTimesNoPerm() {
|
public void testExecuteUserStringListOfStringKnownChallengeSuccessMultipleTimesNoPerm() {
|
||||||
assertTrue(cc.execute(user, "complete", Arrays.asList("mychal", "5")));
|
assertTrue(cc.execute(user, "complete", Arrays.asList("mychal", "5")));
|
||||||
verify(user).getTranslation(eq("challenges.error.no-multiple-permission"));
|
PowerMockito.verifyStatic(Utils.class);
|
||||||
|
Utils.sendMessage(user, world, Constants.ERRORS + "no-multiple-permission");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user