Compare commits

...

53 Commits

Author SHA1 Message Date
tastybento e424560c37
Fixes 345 (#346)
Use the object's name if it already has a display name
2024-06-15 06:33:23 -07:00
gitlocalize-app[bot] 7fb20e74f3
Spanish translation (#341)
* Translate es.yml via GitLocalize

* Translate es.yml via GitLocalize

* Translate es.yml via GitLocalize

---------

Co-authored-by: sergyops <lince885@gmail.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
Co-authored-by: Amfetas <artodetodoo@gmail.com>
2024-06-08 10:21:45 -07:00
gitlocalize-app[bot] 1916f3f267
French translation (#342)
* Translate fr.yml via GitLocalize

* Translate fr.yml via GitLocalize

* Translate fr.yml via GitLocalize

---------

Co-authored-by: Aksel <afgameytb@gmail.com>
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
2024-06-08 10:21:33 -07:00
gitlocalize-app[bot] 78cfa51641
Chinese translation (#343)
* Translate zh-CN.yml via GitLocalize

* Translate zh-CN.yml via GitLocalize

* Translate zh-CN.yml via GitLocalize

* Translate zh-CN.yml via GitLocalize

* Translate zh-CN.yml via GitLocalize

---------

Co-authored-by: Jeansou <bettertreebot@gmail.com>
Co-authored-by: CuteLittleSky <2173204318@qq.com>
Co-authored-by: RUYSUE <ruysue@outlook.com>
Co-authored-by: Clexus <528373858@qq.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
2024-06-08 10:21:19 -07:00
tastybento ec6b950304 Fix tests. 2024-03-10 18:44:57 -07:00
tastybento d0588303c0 Reference latest BentoBox release version 2024-03-10 16:11:22 -07:00
BONNe 7483ff0e0f
Update en-US.yml 2024-02-11 17:13:24 +02:00
tastybento 005d49a756 Update TIPPED_ARROW to latest API in panels 2024-01-21 09:02:19 -08:00
tastybento fe9e63f1c7 Fix tests for creative user inventory challenge completion 2024-01-13 08:23:41 -08:00
BONNe 8a8124f36e Fixes crash when player in CREATIVE shift+clicks on INVENTORY challenge.
Limit completion time to 2, if player is in creative instead of Integer.MAX_VALUE

Fixes #330
2024-01-11 09:40:20 +02:00
BONNe 74cd97fb80 Upgrade PanelUtils to 1.2.0 2024-01-03 14:11:22 +02:00
BONNe c351225e9a
Fixes enchanted book meta not displayed (#328)
Apparently in Spigot EnchantmentStorage has a map that is not used for enchantment storing. Nice.

Fixes #327
2023-12-20 11:06:16 +02:00
tastybento a90d17d70d
Update README.md 2023-11-26 19:06:04 -08:00
tastybento b6bd3d3a2e
Update README.md 2023-11-26 19:04:43 -08:00
tastybento b82defe3b5 Show money as formatted. Addresses #324 2023-11-26 18:52:39 -08:00
gitlocalize-app[bot] a6a3a3e12d
Translate uk.yml via GitLocalize (#325)
Co-authored-by: GIGABAIT <freebitcoin93@gmail.com>
Co-authored-by: tastybento <tastybento@users.noreply.github.com>
2023-11-26 10:09:27 -08:00
gitlocalize-app[bot] 48f388c7f6
Add Ukrainian locale (#326)
* Translate uk.yml via GitLocalize

* Translate uk.yml via GitLocalize

---------

Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
Co-authored-by: GIGABAIT <freebitcoin93@gmail.com>
2023-11-26 10:00:06 -08:00
tastybento 56d7eb4259 Update to BentoBox 2.0.0
Had to ignore some tests because PowerMockito can't mock them for some
reason.
2023-11-12 13:23:22 -08:00
tastybento 34d280d5bf
Update pom.xml 2023-07-10 21:41:20 -07:00
tastybento 9e34910f07 Update Jacoco 2023-07-10 21:22:34 -07:00
tastybento 1fdcfdd7ef Remove offending test. Was not that useful anyway. 2023-07-08 11:42:52 -07:00
tastybento 1759ef7123 Try adding maven dependency to fix test issue 2023-07-08 11:37:45 -07:00
tastybento bba54aa08b Remove duplicate plugin reference in POM 2023-07-08 11:28:40 -07:00
tastybento ebd0b46656 Update POM versions to use latest API 2023-07-08 10:50:47 -07:00
gitlocalize-app[bot] 98052d1797
Update Hungarian translation (#301)
* Translate hu.yml via GitLocalize

* Translate hu.yml via GitLocalize

* Translate hu.yml via GitLocalize

* Translate hu.yml via GitLocalize

* Update hu.yml

Fix color codes and placeholders

---------

Co-authored-by: driverdakid <tamascsiszar99@icloud.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
Co-authored-by: BONNe <bonne@bonne.id.lv>
Co-authored-by: slimcraft <davidelek12@gmail.com>
Co-authored-by: tastybento <tastybento@users.noreply.github.com>
2023-07-08 10:43:57 -07:00
BONNe d74cfbfe96 Merge remote-tracking branch 'origin/develop' into develop 2023-07-03 12:36:59 +03:00
BONNe 3b36f38b7c Fixes the admin GUI crash.
Add shade plugin that was missing for dependencies.
2023-07-03 12:35:55 +03:00
tastybento 125a3249ac Add required distribution 2023-06-24 13:52:45 -07:00
tastybento 9da197de21 Update Github Action build script 2023-06-24 13:02:26 -07:00
tastybento 480ffd8eb4 Fixed ChallengesManagerTest 2023-06-04 10:49:16 -07:00
tastybento ddebdf0e62 Fixed ChallengesCommandTest 2023-06-04 10:41:18 -07:00
tastybento 82ba144038 Fixed CompleteChallengeCommandTest 2023-06-04 10:38:45 -07:00
tastybento 53f0a0cb37 Fixed TryToComplete test class 2023-06-04 10:31:52 -07:00
BONNe 550e348428 Fixes a crash with written/writable books.
The issue was with generating description message for written books without title or author.

Fixes #318
2023-04-24 15:01:56 +03:00
BONNe 01bd7b82bb
Remove dependency to org.apache.commons
Replace org.apache.commons.lang.ArrayUtils to a default Java implementation.
2023-04-13 18:56:17 +03:00
BONNe a608c8b765
Create plugin.yml (#316)
* Create plugin.yml

* Update pom.xml

* Update ChallengesPladdon.java
2023-04-08 18:30:40 +03:00
BONNe 5ab4237df4 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
2023-04-02 14:47:10 +03:00
BONNe de7172ef75 Update ChallengesManagerTest methods with world parameter. 2023-03-31 11:26:54 +03:00
BONNe 9953459e50 Add support for gamemode-specific translations.
This was a request from Floris
2023-03-31 11:12:08 +03:00
tastybento e0377fd352 Updated pladdon annotations 2023-03-25 10:05:36 -07:00
tastybento 09adbde004
Update build.yml
Java 17 for Surefire
2023-02-10 15:36:55 -08:00
tastybento 84a38f4d8c Updated Jacoco POM section 2023-02-10 10:50:41 -08:00
tastybento 1b585a22c8
Add ${argLine} to get jacoco coverage 2023-02-09 15:14:35 -08:00
JamesMCL44 9ed92733c7
Add locale of Chinese-Hong Kong (zh-HK) (#313)
Addition of locale updated to latest version
2023-02-05 18:36:33 +02:00
BONNe 431aaf46fc Add requirement-not-met-material and requirement-not-met-entity to display statistic required item on error. 2023-02-02 23:29:06 +02:00
BONNe ee8eaf8e84 Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed. 2023-02-02 23:24:22 +02:00
BONNe 5ba7c681de Merge remote-tracking branch 'origin/develop' into develop 2023-01-30 23:54:36 +02:00
BONNe 468232cabc Fixes a regex bug that replaced every [player] char instead of whole word. 2023-01-30 23:54:29 +02:00
EpicMo 1faf3b55be
Edit some unfit translation (#312)
Edit some unfit translation
2023-01-20 04:44:29 +02:00
BONNe 0d69459738 Merge remote-tracking branch 'origin/develop' into develop 2023-01-19 12:47:29 +02:00
BONNe e94d2349c3 Init 1.2.0 version 2023-01-19 12:47:21 +02:00
BONNe 8b81101ef0 Fixes #311 localization errors in zn-CN.
Original translation author translated `[]` placeholders which broke locale
2023-01-19 12:47:20 +02:00
BONNe 1da624002d
Init 1.2.0 version 2023-01-05 21:49:39 +02:00
19 changed files with 7097 additions and 4223 deletions

View File

@ -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 17
uses: actions/setup-java@v1 uses: actions/setup-java@v3
with: with:
distribution: 'adopt'
java-version: 17 java-version: 17
- 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') }}

View File

@ -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/).

83
pom.xml
View File

@ -35,16 +35,16 @@
<java.version>17</java.version> <java.version>17</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.20.4-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.1.0</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.0</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.3.1-SNAPSHOT</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>

View File

@ -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

View File

@ -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),

View File

@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,31 +2,26 @@
meta: meta:
authors: authors:
- BONNe - BONNe
# Attention for Chinese translation
# 中文翻译须知在本人2023年1月19日接手前上一位翻译者疑似用机翻软件翻译了全文包括变量在内的所有文字。
# 感谢原作者BONNe进行了修改同时笔者对管理员部分的翻译和玩家全部的翻译进行了订正。时间仓促请君斧正。
challenges: challenges:
commands: commands:
admin: admin:
main: main:
description: 打开管理员面板 description: 管理员主指令。打开管理员菜单
reload: reload:
description: |- description: 重新加载挑战数据
从数据库中重载挑战
如果使用了 hard 参数,将重置与数据库的连接。
show: show:
description: 在聊天框中列出这个世界适用的所有挑战。 description: 在聊天栏中显示此世界可用的所有挑战。
complete: complete:
description: 完成一个玩家的挑战 description: 强制为玩家完成挑战
parameters: "<player> <challenge_id>" parameters: "<player> <challenge_id>"
reset: reset:
description: 重设玩家的挑战。如果将参数 <challenge_id> 设置为 "all" 则将重置该玩家所有挑战。 description: 为玩家重置挑战。如果 "challenge_id" 填写为 "all",则将为该玩家重置所有挑战。
parameters: "<player> <challenge_id>" parameters: "<player> <challenge_id>"
migrate: migrate:
description: 迁移当前游戏世界的挑战数据到 0.8.0 存储格式。 description: 将当前世界的挑战数据转换为 0.8.0 的存储格式。
user: user:
main: main:
description: 打开挑战界面 description: 打开挑战菜单
complete: complete:
description: 完成挑战。 description: 完成挑战。
parameters: "<challenge_id> [count]" parameters: "<challenge_id> [count]"
@ -35,222 +30,211 @@ challenges:
player-gui: "&0&l 挑战菜单" player-gui: "&0&l 挑战菜单"
gamemode-gui: "&0&l 选择游戏模式" gamemode-gui: "&0&l 选择游戏模式"
multiple-gui: "&0&l 多少次?" multiple-gui: "&0&l 多少次?"
admin-gui: "&0&l 挑战管理菜单" admin-gui: "&0&l 管理员挑战菜单"
edit-challenge: "&0&l 编辑 [challenge]" edit-challenge: "&0&l 编辑 [challenge]"
edit-level: "&0&l 编辑 [level]" edit-level: "&0&l 编辑 [level]"
settings: "&0&l 设置" settings: "&0&l 设置"
choose-challenge: "&0&l 选择挑战" choose-challenge: "&0&l 选择挑战"
choose-level: "&0&l 选择" choose-level: "&0&l 选择挑战等级"
choose-player: "&0&l 选择玩家" choose-player: "&0&l 选择玩家"
library: "&0&l 库" library: "&0&l 库"
manage-blocks: "&0&l 管理方块" manage-blocks: "&0&l 管理方块"
manage-entities: "&0&l 管理实体" manage-entities: "&0&l 管理实体"
type-selector: "&0&l 挑战类型选择器" type-selector: "&0&l 选择挑战类型"
item-selector: "&0&l 项目选择器" item-selector: "&0&l 选择物品"
block-selector: "&0&l 块选择器" block-selector: "&0&l 选择方块"
entity-selector: "&0&l 实体选择器" entity-selector: "&0&l 选择实体"
challenge-selector: "&0&l 挑战选择器" challenge-selector: "&0&l 选择挑战"
statistic-selector: "&0&l 统计选择器" statistic-selector: "&0&l 选择统计数据"
environment-selector: "&0&l 环境选择器" environment-selector: "&0&l 选择环境条件"
buttons: buttons:
free-challenges: free-challenges:
name: "&f&l 自由挑战" name: "&f&l 自由挑战"
description: |- description: |-
&7 显示列表 &7 显示自由
&7 个自由挑战 &7 挑战列表
return: return:
name: "&f&l 返回" name: "&f&l 返回"
description: |- description: |-
&7 返回上一级菜单 &7 返回上一级菜单
&7 退出 GUI &7 关闭菜单
previous: previous:
name: "&f&l 上一页" name: "&f&l 上一页"
description: "&7 切换到 &e [number] &7 页" description: "&7 跳转到 &e [number] &7 页"
next: next:
name: "&f&l 下一页" name: "&f&l 下一页"
description: "&7 切换到 &e [number] &7 页" description: "&7 跳转到 &e [number] &7 页"
reduce: reduce:
name: "&f&l 减少" name: "&f&l 减少"
description: "&7 减少 &e [number]" description: "&7 减少 &e [number]"
increase: increase:
name: "&f&l 增加" name: "&f&l 增加"
description: "&7 增加 &e [number]" description: "&7 增加 &e [number]"
accept: accept:
name: "&f&l 完成" name: "&f&l 完成"
description: |- description: |-
&7 完成挑战 &e [number] &7 完成挑战
&7次(-s) &e [number] &7次
quit: quit:
name: "&f&l 退出" name: "&f&l 退出"
description: "&7 退出 GUI。" description: "&7 关闭菜单。"
complete_user_challenges: complete_user_challenges:
name: "&f&l 完成用户挑战(-s)" name: "&f&l 完成玩家的挑战"
description: |- description: |-
&7 允许选择用户和 &7 在这里选择
&7 完成挑战(-s &7 玩家并为他
&7 &7 完成挑战
reset_user_challenges: reset_user_challenges:
name: "&f&l 重置用户挑战" name: "&f&l 重置玩家的挑战"
description: |- description: |-
&7 允许选择用户和 &7 在这里选择玩家并
&7 重置他的挑战 &7 重置他的挑战
add_challenge: add_challenge:
name: "&f&l 创建挑战" name: "&f&l 创建挑战"
description: |- description: |-
&7 启动一个进程 &7 进入挑战
&7 造了一个新的挑战 &7 建模式
add_level: add_level:
name: "&f&l 创建" name: "&f&l 创建挑战等级"
description: |- description: |-
&7 启动一个进程 &7 进入挑战等级
&7 造了一个新的级别 &7 建模式
edit_challenge: edit_challenge:
name: "&f&l 编辑挑战" name: "&f&l 编辑挑战"
description: |- description: |-
&7 允许选择和编辑 &7 在这里选择和
&7 挑战。 &7 编辑挑战。
edit_level: edit_level:
name: "&f&l 编辑" name: "&f&l 编辑挑战等级"
description: |- description: |-
&7 允许选择和编辑 &7 在这里选择和
&7 一个级别 &7 编辑挑战等级
delete_challenge: delete_challenge:
name: "&f&l 删除挑战" name: "&f&l 删除挑战"
description: |- description: |-
&7 允许选择和删除 &7 在这里选择并删除
&7 挑战。 &7 挑战。
delete_level: delete_level:
name: "&f&l 删除" name: "&f&l 删除挑战等级"
description: |- description: |-
&7 允许选择和删除 &7 在这里选择并删除
&7 一个级别 &7 某个挑战等级
edit_settings: edit_settings:
name: "&f&l 设置" name: "&f&l 设置"
description: |- description: |-
&7 允许查看和编辑 &7 在这里查看和编辑
&7 插件设置。 &7 扩展设置。
complete_wipe: complete_wipe:
name: "&f&l 完全擦除" name: "&f&l 清除所有数据"
description: |- description: |-
&7 彻底清除挑战 &7 彻底清除挑战
&7 插件数据库,包括 &7 扩展数据,包括
&7 用户数据。 &7 用户数据。
challenge_wipe: challenge_wipe:
name: "&f&l 挑战擦除" name: "&f&l 清除挑战数据"
description: |- description: |-
&7 彻底清除挑战 &7 彻底清除挑战
&7 和来自数据库的级别 &7 及挑战等级数据
user_wipe: user_wipe:
name: "&f&l 用户擦除" name: "&f&l 清除玩家数据"
description: |- description: "&7 彻底清除玩家数据。"
&7 完全清除用户
&7 来自数据库的数据。
library: library:
name: "&f&l 库" name: "&f&l 库"
description: |- description: "&7 打开公共挑战库。"
&7 打开公共
&7 挑战库。
import_database: import_database:
name: "&f&l 导入数据库" name: "&f&l 导入数据"
description: |- description: "&7 导入或导出挑战扩展数据。"
&7 允许导入导出
&7 挑战数据库。
import_template: import_template:
name: "&f&l 导入模板" name: "&f&l 导入模板"
description: |- description: "&7 点击导入挑战模板文件。"
&7 允许导入模板
&7 文件有挑战。
export_challenges: export_challenges:
name: "&f&l 导出挑战" name: "&f&l 导出挑战"
description: |- description: "&7 导出挑战数据到本地文件。"
&7 允许导出数据库
&7 到本地文件。
properties: properties:
name: "&f&l 属性" name: "&f&l 属性"
description: "&7 查看所有主要属性。" description: "&7 查看所有主要属性。"
requirements: requirements:
name: "&f&l 要求" name: "&f&l 要求"
description: "&7 查看需求属性。" description: "&7 查看要求。"
rewards: rewards:
name: "&f&l 奖励" name: "&f&l 奖励"
description: "&7 查看奖励属性。" description: "&7 查看奖励。"
deployed: deployed:
name: "&f&l 部署" name: "&f&l 发布"
description: |- description: |-
&7 切换是否挑战 &7 发布挑战后,
&7 已部署,用户可以 &7 用户可以
&7 完成它。 &7 完成它。
enabled: "&2 已启用" enabled: "&2 已启用"
disabled: "&c 已禁用" disabled: "&c 已禁用"
name: name:
name: "&f&l 名称" name: "&f&l 名称"
description: |- description: |-
&7 允许更 &7 在这里修
&7 显示名称。 &7 挑战名称。
value: "&7 当前&r [name]" value: "&7 当前名称&r [name]"
remove_on_complete: remove_on_complete:
name: "&f&l 完成后隐藏" name: "&f&l 完成后隐藏"
description: |- description: |-
&7 切换是否应该挑战 &7 切换挑战是否
&7 之后对玩家隐藏 &7 已完成的玩家
&7 完成 &7 隐藏
enabled: "&2 已启用" enabled: "&2 已启用"
disabled: "&c 已禁用" disabled: "&c 已禁用"
description: description:
name: "&f&l 说明" name: "&f&l 说明"
description: |- description: |-
&7 具体说明 &7 关于该挑战的
&7 挑战。颜色 &7 详细描述。必须
&7 代码必须应用于它 &7 使用颜色代码。
value: "&7 当前说明" value: "&7 当前描述"
environment: environment:
name: "&f&l 维度" name: "&f&l 维度"
description: |- description: |-
&7 允许限制 &7 在这里限制
&7 维度挑战 &7 哪些维度
&7 可以完成 &7 可以完成此挑战
enabled: "&2" enabled: "&2"
disabled: "C" disabled: "&c"
order: order:
name: "&f&l 顺序" name: "&f&l 位置"
description: |- description: |-
&7 允许改变顺序 &7 修改挑战显示
&7 个对象 &7 的位置
&7 相同数量的对象 &7 使用相同位置值
&7 将由他们订购 &7 的挑战将根据它们的
&7 唯一 ID 名称 &7 ID 来排序
value: "&7 当前顺序&e [number]" value: "&7 当前位置值&e [number]"
icon: icon:
name: "&f&l 图标" name: "&f&l 图标"
description: |- description: |-
&7 允许更改图标 &7 修改此挑战
&7 对于这个挑战 &7 的图标
locked_icon: locked_icon:
name: "&f&l 图标" name: "&f&l 未解锁图标"
description: |- description: |-
&7 允许更改锁定 &7 修改未解锁
&7 级图标。 &7 挑战等图标。
required_permissions: required_permissions:
name: "&f&l 所需权限" name: "&f&l 所需权限"
description: |- description: |-
&7 允许根据需要进行更改 &7 修改完成此
&7 权限 &7 挑战
&7 挑战是可完成的。 &7 权限
title: "&7 权限:" title: "&7 权限:"
permission: " &8 - [permission]" permission: " &8 - [permission]"
none: "&7 权限未设置。" none: "&7 未设置权限。"
remove_entities: remove_entities:
name: "&f&l 除实体" name: "&f&l 除实体"
description: |- description: |-
&7 允许切换 &7 是否在完成
&7 所需要的 &7 挑战后移除
&7 在完成挑战 &7 所需的
&7 后, &7 实体
&7 从世界中移除的实体
enabled: "&2 已启用" enabled: "&2 已启用"
disabled: "&c 已禁用" disabled: "&c 已禁用"
required_entities: required_entities:
name: "&f&l 必需的实体" name: "&f&l 所需实体"
description: |- description: |-
&7 允许对 &7 允许对
&7 为完成这个挑战。 &7 为完成这个挑战。
@ -287,41 +271,24 @@ challenges:
value: "&7 当前距离:&e [number]" value: "&7 当前距离:&e [number]"
remove_items: remove_items:
name: "&f&l 删除道具" name: "&f&l 删除道具"
description: |- description: "&7允许切换是否在完成挑战后移除所需物品"
&7 允许切换
&7 挑战所需道具
&7 在挑战完成后
&7 是否从背包中
&7 移除。
enabled: "&2 已启用" enabled: "&2 已启用"
disabled: "&c 已禁用" disabled: "&c 已禁用"
required_items: required_items:
name: "&f&l 需求道具" name: "&f&l 需求道具"
description: |- description: "&7 允许更改待完成任务中所需的物品"
&7 允许根据需要进行更改
&7 项为此
&7 挑战是可完成的。
title: "&7 项:" title: "&7 项:"
list: " &8 - [number] x [item]" list: " &8 - [number] x [item]"
none: "&7 项目未添加。" none: "&7 项目未添加。"
add_ignored_meta: add_ignored_meta:
name: "&f&l 添加忽略元数据" name: "&f&l 添加忽略元数据"
#翻译到这了下面的都是没有人工翻译的cirno看了也无语 description: "&7允许添加忽略所有元数据的物品"
description: |-
&7 允许添加哪个
&7 项应忽略
&7 任何元数据
&7 分配给他们。
title: "&7 项:" title: "&7 项:"
list: " &8 - [number] x [item]" list: " &8 - [number] x [item]"
none: "&7 项目未添加。" none: "&7 物品未添加。"
remove_ignored_meta: remove_ignored_meta:
name: "&f&l 删除忽略元数据" name: "&f&l 删除忽略元数据"
description: |- description: "&7允许移除忽略所有元数据的物品"
&7 允许删除
&7 项应忽略
&7 任何元数据
&7 分配给他们。
remove_experience: remove_experience:
name: "&f&l 移除经验" name: "&f&l 移除经验"
description: |- description: |-
@ -348,12 +315,7 @@ challenges:
value: "&7 当前级别:&e [number]" value: "&7 当前级别:&e [number]"
remove_money: remove_money:
name: "&f&l 移除金钱" name: "&f&l 移除金钱"
description: |- description: "&7允许切换是否在玩家完成任务后移除所需金额"
&7 允许切换
&7 所需资金将
&7 从玩家中移除
&7 帐号完成后
&7 挑战。
enabled: "&2 已启用" enabled: "&2 已启用"
disabled: "&c 已禁用" disabled: "&c 已禁用"
required_money: required_money:
@ -365,10 +327,7 @@ challenges:
value: "&7 当前值:&e [number]" value: "&7 当前值:&e [number]"
statistic: statistic:
name: "&f&l 统计" name: "&f&l 统计"
description: |- description: "&7允许修改该挑战所检查的统计类型"
&7 允许更改
&7 统计类型是
&7 签入了这个挑战。
value: "&7 当前值:&e [statistic]" value: "&7 当前值:&e [statistic]"
statistic_amount: statistic_amount:
name: "&f&l 目标值" name: "&f&l 目标值"
@ -658,6 +617,15 @@ challenges:
visible: 显示可见的挑战 visible: 显示可见的挑战
hidden: 显示所有挑战 hidden: 显示所有挑战
toggleable: 允许切换 toggleable: 允许切换
include_undeployed:
name: "&f&l 包括未部署的挑战"
description: |-
&7 表示是否未部署
&7 挑战应该是
&7 计入等级
&7 完成。
enabled: "&2 启用"
disabled: "&c 禁用"
download: download:
name: "&f&l 下载库" name: "&f&l 下载库"
description: |- description: |-
@ -741,14 +709,10 @@ challenges:
&7 喜欢等级和金钱。 &7 喜欢等级和金钱。
statistic_type: statistic_type:
name: "&f&l 统计类型" name: "&f&l 统计类型"
description: |- description: "&7 检查的挑战玩家统计数据。"
&7 检查的挑战
&7 球员统计数据。
save: save:
name: "&f&l 保存" name: "&f&l 保存"
description: |- description: "&7 保存更改并返回。"
&7 保存更改并
&7 返回。
cancel: cancel:
name: "&f&l 取消" name: "&f&l 取消"
description: |- description: |-
@ -774,7 +738,6 @@ challenges:
&7 元素与输入 &7 元素与输入
&7 文本值。 &7 文本值。
search: "&b 值:[value]" search: "&b 值:[value]"
#上面的都是没有翻译的,cirno看了直摇头
tips: tips:
click-to-select: "&e 单击 &7 进行选择。" click-to-select: "&e 单击 &7 进行选择。"
click-to-choose: "&e 单击 &7 进行选择。" click-to-choose: "&e 单击 &7 进行选择。"
@ -830,29 +793,28 @@ challenges:
[rewards] [rewards]
status: status:
completed: "&2&l 已完成" completed: "&2&l 已完成"
#原来的time(-s)意思是如果完成复数次就是times不是时间里秒的含义 completed-times: "&2 已完成&7&l [number] &r&2次"
completed-times: "&2 完成 &7&l [number] &r&2 次" completed-times-of: "&2 已完成&7&l [number] &r&2次最多完成&7&l [max] &r&2次"
completed-times-of: "&2 已完成 &7&l [number] &r&2 共 &7&l [max] &r&2 次" completed-times-reached: "&2&l 你最多只能完成&7 [max] &2次"
completed-times-reached: "&2&l 全部完成 &7 [max] &2 次"
cooldown: cooldown:
lore: |- lore: |-
[timeout] [timeout]
[wait-time] [wait-time]
timeout: "&7&l 冷却时间:&r&7 [time]" timeout: "&7&l 冷却时间:&r&7[time]"
wait-time: "&c&l 等待时间:&r&c [time]" wait-time: "&c&l 冷却中:&r&c[time]"
in-days: "[number] d" in-days: "[number] "
in-hours: "[number]小时" in-hours: "[number] 小时"
in-minutes: "[number] 分钟" in-minutes: "[number] 分钟"
in-seconds: "[number] s" in-seconds: "[number] "
requirements: requirements:
lore: |- lore: |-
[environment] [environment]
[type-requirement] [type-requirement]
[permission] [permissions]
environment-single: "&7 限于 [environment]" environment-single: "&7 仅限在 [environment] 完成"
environment-title: "&7 限于" environment-title: "&7 仅限在这些维度完成"
environment-list: " &7 - &e [environment]" environment-list: " &7 - &e [environment]"
permission-single: "&c 需要 [permissions] 权限" permission-single: "&c 需要 [permission] 权限"
permissions-title: "&c 需要权限:" permissions-title: "&c 需要权限:"
permissions-list: " &c - [permission]" permissions-list: " &c - [permission]"
island: island:
@ -868,17 +830,17 @@ challenges:
entities-title: "&7&l 所需实体:" entities-title: "&7&l 所需实体:"
entity-value: " &7 - &e [entity]" entity-value: " &7 - &e [entity]"
entities-value: " &7 - &e [number] x [entity]" entities-value: " &7 - &e [number] x [entity]"
search-radius: "&7 不超过 &e [number] &7 米" search-radius: "&7 必须在在&e [number] &7米范围内"
warning-block: "&e 方块将被 &c 删除" warning-block: "&e 所需方块将在完成挑战时&c移除"
warning-entity: "&e 实体将被 &c 删除" warning-entity: "&e 所需实体将在完成挑战时&c移除"
inventory: inventory:
lore: |- lore: |-
[items] [items]
[warning] [warning]
item-title: "&7&l 必填项目" item-title: "&7&l 所需物品"
item-value: " &7 - &e [item]" item-value: " &7 - &e [item]"
items-value: " &7 - &e [number] x [item]" items-value: " &7 - &e [number] x [item]"
warning: "&e 项目(-s将被 &c 删除" warning: "&e 所需物品将在挑战完成时&c移除"
other: other:
lore: |- lore: |-
[experience] [experience]
@ -886,11 +848,11 @@ challenges:
[money] [money]
[money-warning] [money-warning]
[level] [level]
experience: "&7&l 所需经验:&r&e [number]" experience: "&7&l 所需经验:&r&e[number]"
experience-warning: "&e 经验将被 &c 移除" experience-warning: "&e 所需经验将在挑战完成时&c扣除"
money: "&7&l 所需金:&r&e [number]" money: "&7&l 所需&r&e[number]"
money-warning: "&e 钱将被 &c 移除" money-warning: "&e 所需金钱将在挑战完成时&c扣除"
level: "&7&l 所需岛屿等级:&r&e [number]" level: "&7&l 所需岛屿等级:&r&e[number]"
statistic: statistic:
lore: |- lore: |-
[statistic] [statistic]
@ -907,12 +869,12 @@ challenges:
[experience] [experience]
[money] [money]
[commands] [commands]
item-title: "&7 " item-title: "&7 物品"
item-value: " &7 - &e [item]" item-value: " &7 - &e [item]"
items-value: " &7 - &e [number] x [item]" items-value: " &7 - &e [number] x [item]"
experience: "&7 经验:&r&e [number]" experience: "&7 经验:&r&e [number]"
money: "&7 金钱:&r&e [number]" money: "&7 金钱:&r&e [number]"
commands-title: "&7 令:" commands-title: "&7 令:"
command: " &7 - &e [command]" command: " &7 - &e [command]"
level: level:
lore: |- lore: |-
@ -923,15 +885,15 @@ challenges:
status: status:
completed: "&2&l 已完成" completed: "&2&l 已完成"
completed-challenges-of: |- completed-challenges-of: |-
&2 已完成 &7&l [number] &r&2 出 &2 已完成&7&l [number] &r&2个挑战
&7&l [max] &r&2 挑战。 &7&l 共 [max] &r&2个挑战。
locked: "&c&l " locked: "&c&l 未解锁"
missing-challenges: |- missing-challenges: |-
&7 [number] 更多的挑战必须是 &7 你需要再完成 [number] 个挑战
&7 完成以解锁此级别 &7 才能解锁此等级
waiver: |- waiver: |-
&7&l [number] 挑战(-s) &r&7 可以 &7&l 你可以跳过 [number] 挑战
&7 跳过解锁下一个级别 &7 来解锁下一等级
rewards: rewards:
lore: |- lore: |-
&7&l 奖励: &7&l 奖励:
@ -940,88 +902,86 @@ challenges:
[experience] [experience]
[money] [money]
[commands] [commands]
item-title: "&7 " item-title: "&7 物品"
item-value: " &7 - &e [item]" item-value: " &7 - &e [item]"
items-value: " &7 - &e [number] x [item]" items-value: " &7 - &e [number] x [item]"
experience: "&7 经验:&r&e [number]" experience: "&7 经验:&r&e [number]"
money: "&7 金钱:&r&e [number]" money: "&7 金钱:&r&e [number]"
commands-title: "&7 令:" commands-title: "&7 令:"
command: " &7 - &e [command]" command: " &7 - &e [command]"
library: library:
author: "&7 作者 &e [author]" author: "&7 作者&e[author]"
version: "&7 Made with Challenges &e [version]" version: "&7 使用 Challenges &e [version] 制作"
lang: "&7 语言:&e [lang]" lang: "&7 语言:&e [lang]"
gamemode: "&7 主要用于 &e [gamemode]" gamemode: "&7 主要用于 &e [gamemode]"
#后面没人工翻译了
conversations: conversations:
prefix: "&l&6 [BentoBox]: &r" prefix: "&l&6 [BentoBox]: &r"
confirm-string: true, on, yes, 确认, y, 有效, 正确 confirm-string: true, on, yes, confirm, y, valid, correct, 是, 确认, 对
deny-string: 关闭拒绝n无效不正确 deny-string: false, off, no, deny, n, invalid, incorrect, 否, 错, 不是
cancel-string: 取消 cancel-string: cancel, 取消
exit-string: 取消,退出,退出 exit-string: cancel, exit, quit, 取消, 退出
cancelled: "&c 对话取消!" cancelled: "&c 会话已取消!"
input-number: "&e 请在聊天中输入一个号码。" input-number: "&e 请在聊天中输入一个数字。"
input-seconds: "&e 请在聊天中输入秒。" input-seconds: "&e 请在聊天中输入秒。"
numeric-only: "&c 给定的 [value] 不是数字!" numeric-only: "&c 你输入的 [value] 不是数字!"
not-valid-value: "&c 给定的数字 [value] 无效。它必须大于 [min] 并且小于 [max]" not-valid-value: "&c 你输入的的数字 [value] 无效。它必须大于 [min] 且小于 [max]"
user-data-removed: "&a [gamemode] 的所有用户数据都从数据库中清除。" user-data-removed: "&a 已清除 [gamemode] 的所有玩家数据。"
confirm-user-data-deletion: "&e 请确认您要清除 [gamemode] 的用户数据库。" confirm-user-data-deletion: "&e 请确认您要清除 [gamemode] 的玩家数据。"
challenge-data-removed: "&a [gamemode] 的所有挑战数据都从数据库中清除。" challenge-data-removed: "&a 已清除 [gamemode] 的所有挑战数据。"
confirm-challenge-data-deletion: "&e 请确认您要清除 [gamemode] 的挑战数据。" confirm-challenge-data-deletion: "&e 请确认您要清除 [gamemode] 的挑战数据。"
all-data-removed: "&a [gamemode] 的所有插件数据都从数据库中清除。" all-data-removed: "&a 已清除 [gamemode] 的所有扩展数据。"
confirm-all-data-deletion: "&e 请确认您要清除 [gamemode] 的插件数据。" confirm-all-data-deletion: "&e 请确认您要清除 [gamemode] 的扩展数据。"
write-name: "&e 请在聊天中输入一个名字。" write-name: "&e 请在聊天中输入一个名字。"
new-object-created: "&a 为 [gamemode] 创建了一个新对象。" new-object-created: "&a 为 [gamemode] 创建了一个新对象。"
object-already-exists: "&c 对象 &7 [id] &c 已经存在。选择不同的名称。" object-already-exists: "&c 对象 &7 [id] &c 已经存在。选择不同的名称。"
invalid-challenge: "&c 挑战 [challenge] 包含无效数据。无法部署" invalid-challenge: "&c 挑战 [challenge] 包含无效数据。无法发布"
name-changed: "&a 成功,名称已更新。" name-changed: "&a 成功,名称已更新。"
write-description: "&e 请在聊天中输入新的描述,然后在一行中自行“退出”以完成。" write-description: "&e 请在聊天中输入新的描述,可输入多行,输入 'quit' 完成编辑。"
description-changed: "&a 成功,说明已更新。" description-changed: "&a 成功,描述已更新。"
write-permissions: "&e 请输入所需的权限,在聊天中每行一个,并在一行中自行“退出”以完成。" write-permissions: "&e 请输入所需的权限,每次输入一个,输入 'quit' 完成编辑。"
permissions-changed: "&a 成功,挑战权限已更新。" permissions-changed: "&a 成功,挑战权限已更新。"
write-reward-text: "&e 请在聊天中输入新的奖励文本并自行“退出”一行以完成。" write-reward-text: "&e 请在聊天中输入新的奖励提示,输入 'quit' 完成编辑。"
reward-text-changed: "&a 成功,奖励文字已更新。" reward-text-changed: "&a 成功,奖励提示已更新。"
write-repeat-reward-text: "&e 请在聊天中输入新的重复奖励文本,然后在一行中自行“退出”以完成。" write-repeat-reward-text: "&e 请在聊天中输入新的重复奖励提示,输入 'quit' 结束编辑。"
repeat-reward-text-changed: "&a 成功,重复奖励文本已更新。" repeat-reward-text-changed: "&a 成功,重复奖励提示已更新。"
write-reward-commands: "&e 请在聊天中每行输入一个新的奖励命令,然后在一行上自行“退出”以完成。" write-reward-commands: "&e 请在聊天中每行输入新的奖励命令,输入 'quit' 结束编辑。"
reward-commands-changed: "&a 成功,奖励命令已更新。" reward-commands-changed: "&a 成功,奖励命令已更新。"
write-repeat-reward-commands: "&e 请在聊天中每行输入一个新的重复奖励命令,然后单独在一行上“退出”以完成。" write-repeat-reward-commands: "&e 请在聊天中每行输入一个新的重复奖励命令,输入 'quit' 结束编辑。"
repeat-reward-commands-changed: "&a 成功,重复奖励命令已更新。" repeat-reward-commands-changed: "&a 成功,重复奖励命令已更新。"
challenge-removed: "&a 从数据库中删除 [gamemode] 的挑战 [challenge]。" challenge-removed: "&a 已删除 [gamemode] 中的挑战 [challenge]。"
confirm-challenge-deletion: "&e 请确认您要从数据库中删除 [gamemode] 的 [challenge]。" confirm-challenge-deletion: "&e 请确认您要删除 [gamemode] 的 [challenge]。"
level-removed: "&a [gamemode] 的级 [level] 已从数据库中删除。" level-removed: "&a [gamemode] 挑战等级 [level] 已删除。"
confirm-level-deletion: "&e 请确认您要从数据库中删除 [gamemode] 的 [level]。" confirm-level-deletion: "&e 请确认您要删除 [gamemode] 的 [level]。"
start-downloading: "&a 开始下载和导入挑战库。" start-downloading: "&a 开始下载和导入挑战库。"
written-text: "&a 输入文本:" written-text: "&a 输入文本:"
confirm-data-replacement: "&e 请确认您想用新的挑战替换当前的挑战。" confirm-data-replacement: "&e 请确认您想用新的挑战替换当前的挑战。"
new-challenges-imported: "&a 成功,[gamemode] 的新挑战已导入。" new-challenges-imported: "&a 成功,[gamemode] 的新挑战已导入。"
exported-file-name: "&e 请输入导出的数据库文件的文件名。 (写“取消”退出)" exported-file-name: "&e 请输入导出的数据库文件的文件名。(输入 'cancel ' 退出)"
database-export-completed: "&a 成功,[world] 的数据库导出完成。文件[文件]生成。" database-export-completed: "&a 成功,[world] 的数据库导出完成。文件 [file] 已生成。"
file-name-exist: "&c 名称为“[id]”的文件存在。无法覆盖。" file-name-exist: "&c 名称为 “[id]” 的文件存在。无法覆盖。"
write-search: "&e 请写一个搜索值。 (写“取消”退出" write-search: "&e 请写一个搜索值。(输入 'cancel' 取消"
search-updated: "&a 搜索值已更新。" search-updated: "&a 搜索值已更新。"
titles: titles:
challenge-title: "&a已完成" challenge-title: "&a已完成"
challenge-subtitle: "[friendlyName]" challenge-subtitle: "[friendlyName]"
level-title: "&a已完成" level-title: "&a已完成"
level-subtitle: "[friendlyName]" level-subtitle: "[friendlyName]"
#上面没翻译了
messages: messages:
completed: "&2 你为[player]完成了挑战[name]" completed: "&2 你为[player]完成了挑战[name]"
already-completed: "&2 这个挑战已经完成了!" already-completed: "&2 这个挑战已经完成了!"
reset: "&2 你为 [player] 重置挑战 [name]" reset: "&2 你为 [player] 重置挑战 [name]"
reset-all: "&2 所有[player]挑战均已重置!" reset-all: "&2 所有[player]挑战均已重置!"
not-completed: "&2 此挑战尚未完成!" not-completed: "&2 此挑战尚未完成!"
migrate-start: "&2 开始迁移挑战插件数据。" migrate-start: "&2 开始转换挑战扩展数据。"
migrate-end: "&2 挑战插件数据更新为新格式。" migrate-end: "&2 挑战扩展数据已更新为新格式。"
migrate-not: "&2 所有数据均有效。" migrate-not: "&2 所有数据均有效。"
start-downloading: "&5 开始下载和导入挑战库。" start-downloading: "&5 开始下载和导入挑战库。"
you-completed-challenge: "&2你完成了挑战 &r[value] &2" you-completed-challenge: "&2你完成了挑战 &r[value] &2"
you-repeated-challenge: "&2你再次完成了挑战 &r[value] &2" you-repeated-challenge: "&2你再次完成了挑战 &r[value] &2"
you-repeated-challenge-multiple: "&2你完成挑战 &r[value] &r[count] &2次了" you-repeated-challenge-multiple: "&2你完成挑战 &r[value] &r[count] &2次了"
you-completed-level: "&2恭喜的挑战等级 &r[value] &2已完成" you-completed-level: "&2恭喜已完成挑战等级 &r[value]&2"
name-has-completed-challenge: "&a恭喜 &r[name] &a完成了挑战 [value] &a" name-has-completed-challenge: "&a恭喜 &r[name] &a完成了挑战 [value] &a"
name-has-completed-level: "&a恭喜 &r[name] &a的挑战等级 [value] &a已全部完成" name-has-completed-level: "&a恭喜 &r[name] &a已完成挑战等级 [value]&a"
load-skipping: '&c挑战项 "[value]" &c已存在 - 将跳过' load-skipping: '&c挑战项 "[value]" &c已存在 - 将跳过'
load-overwriting: '&6覆盖了已载入的挑战 "[value]"' load-overwriting: '&6覆盖了已载入的挑战 "[value]"'
load-add: "&a新增了挑战 [value]" load-add: "&a新增了挑战 [value]"
@ -1029,15 +989,15 @@ challenges:
no-name: "&c缺少挑战名称。" no-name: "&c缺少挑战名称。"
unknown-challenge: "&c未知的挑战。" unknown-challenge: "&c未知的挑战。"
not-valid-integer: "&c给定整数“[value]”无效!|值应介于[min]和[max]之间。" not-valid-integer: "&c给定整数“[value]”无效!|值应介于[min]和[max]之间。"
not-deployed: "&c这项挑战尚未部署" not-deployed: "&c这个挑战还未发布"
not-on-island: "&c您必须在您的岛上才能完成挑战" not-on-island: "&c您必须在您的岛上才能完成挑战"
challenge-level-not-available: "&c您尚未解锁这项挑战的等级。" challenge-level-not-available: "&c您还未解锁这个挑战等级。"
not-repeatable: "&c这项挑战不可重复进行" not-repeatable: "&c这项挑战不可重复进行"
wrong-environment: "&c你在错误的环境中!" wrong-environment: "&c你不在指定的维度中!"
not-enough-items: "&c你没有足够的 &r[items] &c来完成这项挑战。" not-enough-items: "&c你没有足够的 &r[items] &c来完成这项挑战。"
not-close-enough: "&c要完成挑战你必须站在所需项目 &f[number] &c格范围内。" not-close-enough: "&c要完成挑战你必须站在所需物品 &f[number] &c格范围内。"
you-still-need: "&c你还差 &f[amount] &c个 &f[item] &c才能完成挑战。" you-still-need: "&c你还差 &f[amount] &c个 &f[item] &c才能完成挑战。"
missing-addon: "&c无法完成挑战缺少必需的组件或插件。" missing-addon: "&c无法完成挑战缺少必需的扩展或插件。"
incorrect: "&c无法完成挑战必要条件设定错误。" incorrect: "&c无法完成挑战必要条件设定错误。"
not-enough-money: "&c你必须有 &f[value] &c金钱才能完成任务。" not-enough-money: "&c你必须有 &f[value] &c金钱才能完成任务。"
not-enough-experience: "&c你必须有 &f[value] &c经验值才能完成任务。" not-enough-experience: "&c你必须有 &f[value] &c经验值才能完成任务。"
@ -1056,92 +1016,10 @@ challenges:
no-library-entries: "&c 找不到任何库条目。没什么可显示的。" no-library-entries: "&c 找不到任何库条目。没什么可显示的。"
not-hooked: "&c Challenges Addon 找不到任何游戏模式。" not-hooked: "&c Challenges Addon 找不到任何游戏模式。"
timeout: "&c 此挑战需要在完成之间等待 [timeout]。您必须等待 [wait-time] 才能再次完成。" timeout: "&c 此挑战需要在完成之间等待 [timeout]。您必须等待 [wait-time] 才能再次完成。"
requirement-not-met: "&c This challenge requires [statistic] to have [number]. You have only [value]. " requirement-not-met: "&c 这个挑战需要 [statistic] 至少为 [number]. 你只有 [value]. "
# # Showcase for manual material translation requirement-not-met-entity: "&c 这个挑战需要 [number] 个 [statistic] [entity]. 你只有 [value]. "
# materials: requirement-not-met-material: "&c 这个挑战需要 [number] 个 [statistic] [material]. 你只有
# # Names should be lowercase. [value]. "
# cobblestone: "Cobblestone"
# # Also supports descriptions.
# stone:
# name: "Stone"
# description: ""
# item-stacks:
# # Non-specific item meta translations.
# # TYPE is the item type
# # META is a content of item meta.
# generic: "[type] [meta]"
# # Non-specific meta translations. Will replace [meta]
# meta:
# upgraded: "Upgraded"
# extended: "Extended"
# potion-meta: "&e [type] [upgraded] [extended]"
# # Be aware, enchants are always listed below item in separate line.
# enchant-meta: " &7 - &e [type] [level]"
# skull-meta: ": &e [player-name]"
# book-meta: "&e [title] [author]"
# # Custom Enchantment Translation.
# enchant:
# menting: "Mending"
# unbreaking: "Unbreaking"
# # Custom Potion Translation.
# potion-type:
# water_breathing: "Water Breathing"
# # You can also create specific item translations
# # Like translate all potions.
# potion:
# # This will overwrite generic translation.
# name: "[type] [upgraded] [extended]"
# # Type is either specific translation or potion effect.
# uncraftable: "Uncraftable"
# water: "Water"
# mundane: "Mundane"
# thick: "Thick"
# awkward: "Awkward"
# night_vision: "Potion of Night Vision"
# invisibility: "Potion of Invisibility"
# jump: "Potion of Leaping"
# fire_resistance: "Potion of Fire Resistance"
# speed: "Potion of Swiftness"
# slowness: "Potion of Slowness"
# water_breathing: "Potion of Water Breathing"
# instant_heal: "Potion of Healing"
# instant_damage: "Potion of Harming"
# poison: "Potion of Poison"
# regen: "Potion of Regeneration"
# strength: "Potion of Strength"
# weakness: "Potion of Weakness"
# luck: "Potion of Luck"
# turtle_master: "Potion of Turtle Master"
# slow_falling: "Potion of Slow Falling"
# stone_shovel:
# # This will mean that only stone shovels will not show
# # meta information.
# name: "[type]"
#
# # Showcase how to support multi-linguistic challenges
# challenges:
# # Database ID name.
# example_challenge_id:
# name: "&2 Translated Name"
# description: |-
# &7 Translated Custom
# &7 description
# reward-text: |-
# &7 Translated Reward
# &7 text
# repeat-reward-text: |-
# &7 Translated Repeat
# &7 Reward text
# levels:
# # Database ID name.
# example_level_id:
# name: "&2 Translated Name"
# description: |-
# &7 Translated Custom
# &7 description
# reward-text: |-
# &7 Translated Reward
# &7 text
protection: protection:
flags: flags:
CHALLENGES_ISLAND_PROTECTION: CHALLENGES_ISLAND_PROTECTION:
@ -1152,9 +1030,9 @@ protection:
CHALLENGES_WORLD_PROTECTION: CHALLENGES_WORLD_PROTECTION:
description: |- description: |-
&5 &o 启用 / 禁用 &5 &o 启用 / 禁用
&5 &o 玩家们在自己 &5 &o 玩家需在
&5 &o 岛屿中完成挑 &5 &o 自己的岛屿中
&5 &o 的需求 &5 &o 完成挑战。
name: 岛屿挑战限制 name: 岛屿挑战限制
hint: 岛屿外无挑战 hint: 岛屿外无挑战
version: 11 version: 12

View File

@ -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:

View File

@ -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:

View File

@ -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");
} }
/** /**

View File

@ -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
@ -104,7 +101,7 @@ public class ChallengesCommandTest {
Optional<GameModeAddon> optionalAddon = Optional.of(gameModeAddon); Optional<GameModeAddon> optionalAddon = Optional.of(gameModeAddon);
when(iwm.getAddon(any())).thenReturn(optionalAddon); when(iwm.getAddon(any())).thenReturn(optionalAddon);
when(plugin.getIWM()).thenReturn(iwm); when(plugin.getIWM()).thenReturn(iwm);
@NonNull @NonNull
WorldSettings ws = new TestWorldSetting(); WorldSettings ws = new TestWorldSetting();
when(iwm.getWorldSettings(any())).thenReturn(ws); when(iwm.getWorldSettings(any())).thenReturn(ws);
@ -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)}.
*/ */

View File

@ -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");
} }
/** /**