Merge pull request #85 from BentoBoxWorld/master

Merge Last Minute Changes into develop branch
This commit is contained in:
BONNe 2019-02-13 23:11:17 +02:00 committed by GitHub
commit 4eb7a03d08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 113 additions and 132 deletions

View File

@ -1,33 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: "Bug \U0001F4A5"
assignees: BONNe
---
**Description**
A clear and concise description of what the bug is.
### Description
<!-- A clear and concise description of what the bug is. -->
<!-- Please type below this line. -->
**Steps to reproduce the behavior:**
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
#### Steps to reproduce the behavior:
<!-- A clear steps how problem can be replicated: -->
<!-- 1. Edit challenge -->
<!-- 2. Try to complete challenge -->
<!-- 3. Error: -->
<!-- Please type below this line. -->
**Expected behavior**
A clear and concise description of what you expected to happen.
#### Server / BentoBox information:
<!-- Please provide information from `/bentobox version` -->
<!-- Please provide information about database type for BentoBox plugin -->
<!-- Please provide information about other plugins `/pl` -->
<!-- Please type below this line. -->
**Screenshots**
If applicable, add screenshots to help explain your problem.
#### Screenshots / Server log
<!-- Any screenshots or videos that could help to diagnostic issue -->
<!-- Server log could help to diagnostic issue a lot faster -->
<!-- Please add links or images below this line. -->
**Server Information:**
[Please complete the following information:]
- Database being used (YAML, JSON, MySQL, MongoDB): []
- OS: [e.g. iOS]
- Java Version: [e.g. Java 8]
- BentoBox version: [e.g. 1.7.2.21]
- Addons installed? [Do '/bentobox version' and copy/paste from the console]
- Other plugins? [Do '/plugins' and copy/paste from the console]
**Additional context**
Add any other context about the problem here.
#### Expected behavior / Additional context
<!-- Add any other context about the problem here. -->
<!-- Please type below this line. -->

View File

@ -1,17 +1,25 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: Enhancement ✨
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
### Description
#### Is your feature request related to a problem?
<!-- A clear and concise description of the problem you're encountering, if any. -->
<!-- Please type below this line. -->
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
#### Describe the solution you'd like us to implement.
<!-- A clear and concise description of what you want us to do to resolve your problem. -->
<!-- Please type below this line. -->
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
#### Describe alternatives you've considered.
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
<!-- Please type below this line -->
**Additional context**
Add any other context or screenshots about the feature request here.
#### Additional context
<!-- Add any other context or screenshots about the feature request here. -->
<!-- Please type below this line. -->

10
pom.xml
View File

@ -6,10 +6,10 @@
<groupId>world.bentobox</groupId>
<artifactId>challenges</artifactId>
<version>0.5.0-SNAPSHOT</version>
<version>0.5.0</version>
<name>Challenges</name>
<description>Challenges is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like ASkyBlock or AcidIsland.</description>
<description>Challenges is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock, AcidIsland or CaveBlock.</description>
<url>https://github.com/BentoBoxWorld/Challenges</url>
<inceptionYear>2018</inceptionYear>
@ -100,13 +100,13 @@
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>level</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -256,4 +256,4 @@
</plugins>
</build>
</project>
</project>

View File

@ -1077,4 +1077,39 @@ public class ChallengesManager
this.levelDatabase.deleteObject(challengeLevel);
}
}
// ---------------------------------------------------------------------
// Section: Fix world duplication issue.
// ---------------------------------------------------------------------
/**
* This allows to fix player data issue when world name is duplicated.
* @deprecated Will be removed in 0.7.0 release.
*/
@Deprecated
public void fixCorruptedPlayerData()
{
this.playersDatabase.loadObjects().forEach(playerData -> {
Map<String, Integer> completed = playerData.getChallengeStatus();
Map<String, Long> timeStamps = playerData.getChallengesTimestamp();
new ArrayList<>(completed.keySet()).forEach(challenge -> {
String correctName = challenge.replaceFirst("(\\w+)(?=(\\1))", "");
if (!correctName.isEmpty() && !correctName.equals(challenge))
{
completed.put(correctName, completed.get(challenge));
timeStamps.put(correctName, timeStamps.get(challenge));
completed.remove(challenge);
timeStamps.remove(challenge);
this.addon.log("ChallengeString was modified " + challenge + " was changed to " + correctName);
}
});
this.playerCacheData.put(UUID.fromString(playerData.getUniqueId()), playerData);
this.savePlayer(UUID.fromString(playerData.getUniqueId()));
});
}
}

View File

@ -12,6 +12,7 @@ import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.Util;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.panel.CommonGUI;
import world.bentobox.challenges.panel.util.ConfirmationGUI;
import world.bentobox.challenges.utils.GuiUtils;
@ -55,6 +56,7 @@ public class AdminGUI extends CommonGUI
DELETE_LEVEL,
IMPORT_CHALLENGES,
BACKWARD_CHALLENGES,
BACKWARD_PLAYER_DATA,
EDIT_SETTINGS
}
@ -111,6 +113,7 @@ public class AdminGUI extends CommonGUI
// Import Challenges
panelBuilder.item(15, this.createButton(Button.IMPORT_CHALLENGES));
panelBuilder.item(24, this.createButton(Button.BACKWARD_CHALLENGES));
panelBuilder.item(33, this.createButton(Button.BACKWARD_PLAYER_DATA));
// Edit Addon Settings
panelBuilder.item(16, this.createButton(Button.EDIT_SETTINGS));
@ -388,6 +391,30 @@ public class AdminGUI extends CommonGUI
break;
}
case BACKWARD_PLAYER_DATA:
{
permissionSuffix = IMPORT;
name = this.user.getTranslation("challenges.gui.buttons.admin.backward-player");
description = this.user.getTranslation("challenges.gui.descriptions.admin.backward-player");
icon = new ItemStack(Material.HOPPER);
clickHandler = (panel, user, clickType, slot) -> {
new ConfirmationGUI(this.user, status -> {
if (status)
{
this.addon.getChallengesManager().fixCorruptedPlayerData();
}
this.build();
});
return true;
};
glow = false;
break;
}
case EDIT_SETTINGS:
{
permissionSuffix = SETTINGS;

View File

@ -88,8 +88,8 @@ public class ConfirmationGUI
private PanelItem getButton(boolean returnValue)
{
return new PanelItemBuilder().
name(this.user.getTranslation("challenges.gui.admin.buttons." + (returnValue ? "accept" : "cancel"))).
icon(returnValue ? Material.GRAY_STAINED_GLASS_PANE : Material.RED_STAINED_GLASS_PANE).
name(this.user.getTranslation("challenges.gui.buttons.admin." + (returnValue ? "accept" : "cancel"))).
icon(returnValue ? Material.GREEN_STAINED_GLASS_PANE : Material.RED_STAINED_GLASS_PANE).
clickHandler((panel, user1, clickType, i) -> {
this.consumer.accept(returnValue);
return true;

View File

@ -1,6 +1,7 @@
name: Challenges
main: world.bentobox.challenges.ChallengesAddon
version: ${version}
repository: 'BentoBoxWorld/Challenges'
authors: tastybento

View File

@ -69,6 +69,7 @@ challenges:
delete-level: 'Remove level'
import: 'Import ASkyblock Challenges'
backward: 'Import 0.3.0 Challenges'
backward-player: 'Fix 0.3.0 PlayerData'
settings: 'Edit Settings'
properties: 'Properties'
requirements: 'Requirements'
@ -157,6 +158,7 @@ challenges:
delete-challenge: 'Allows remove any Challenge.'
delete-level: 'Allows remove any Level.'
backward: 'Allows to import challenges from 0.3.0 and below addon version.'
backward-player: 'Allows to fix corrupted PlayerData from 0.3.0 version.|&2USE ONLY IF NECESSARY|&2MAY NOT WORK IN ALL SITUATIONS'
settings: 'Allows to change addon settings.'
properties: 'Allows to change general properties'
requirements: 'Allows to manage requirements'
@ -305,4 +307,4 @@ challenges:
import-no-file: '&cCould not find challenges.yml file to import!'
no-load: '&cError: Could not load challenges.yml. [message]'
load-error: '&cError: Cannot load [value].'
version: 5
version: 6

View File

@ -1,93 +0,0 @@
###########################################################################################
# This is a YML file. Be careful when editing. Check your edits in a YAML checker like #
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
challenges:
completed-times: "已完成 [donetimes] 次,共能完成 [maxtimes] 次"
max-reached: "达到上限 [donetimes] 次,共能完成 [maxtimes] 次"
challenge:
format: "[description]"
parameters: "[Level]"
description: "打开挑战菜单"
complete: "&B已完成"
exp-reward: "&6经验奖励[reward]"
first-time-rewards: "&6初次完成奖励"
gui-title: "&a挑战"
incomplete: "未完成"
item-take-warning: "&c当您完成这个挑战时所|&c有必需品都会被取走"
items-closeby: "&c所有必需品必须在您的岛|&c上并且要离您很近"
level: "&F等级[level]"
max-reached: "达到上限 [donetimes] 次,共能完成 [maxtimes] 次"
money-reward: "&6金钱奖励$[reward]"
name: "挑战名"
name-has-completed: "[name] 已经完成了挑战 [challenge]"
navigation: "点击查看 [level] 的挑战!"
repeatable: "本挑战可以被重复完成 [maxtimes] 次"
not-repeatable: "本挑战不能被重复完成!"
repeat-rewards: "&6重复奖励"
rewards: "&F奖励"
to-complete: "还需要完成 [challengesToDo] 次 [thisLevel] 挑战来解锁这个等级!"
you-completed: "您完成了挑战 [challenge]"
you-repeated: "您再次完成了挑战 [challenge] "
completechallenge:
challange-completed: "挑战:[challengename] 已经被 [name] 完成"
error:
could-not-save: "&c无法保存挑战"
island-level: "&c您的岛屿必须达到 [number] 级才能完成挑战!"
items-not-there: "&c所有必需品必须在您的岛上并且要离您很近"
no-items-clicked: "&c您没有点选任何东西。正在取消。"
not-close-enough: "&c您必须站在距离所需物品 [number] 个方块内。"
not-enough-items: "&c您没有足够的 [items] 来完成挑战!"
not-on-island: "&c您必须在您的岛上才能这么做"
reward-problem: "&c给予奖励发生错误。请联系管理员检查日志"
you-still-need: "&c您仍需要 [amount] × [item]"
help:
command: "/challenges&f显示挑战"
config-reloaded: "已从文件重新加载配置。"
reset-all-challenges: "重置玩家的所有挑战"
reset-challenge: "标记一个挑战为未完成"
reset-challenge-for-all: "全局为每位玩家重置(可选重复)一个挑战"
resetallchallenges:
success: "[name] 已经重置了所有的挑战。"
resetchallenge:
challenge-reset: "挑战:[challengename] 已经被 [name] 重置"
error-challenge-does-not-exist: "挑战不存在或尚未被完成"
admin:
parameters: ""
description: "挑战管理员"
import:
parameters: "[overwrite]"
description: "从 challenges.yml 导入挑战"
no-file: "&c无法找到用来导入的文件 challenges.yml"
no-load: "&c错误无法加载 challenges.yml。[message]"
no-levels: "警告challenges.yml 中没有等级定义"
levels: "正在导入等级:[levels]"
number: "已导入 [number] 个挑战"
skipping: "'[challenge]' 已经存在 - 正在跳过"
overwriting: "正在覆盖 '[challenge]'"
imported: "已导入 '[challenge]'"
complete:
description: "标记挑战为已完成"
parameters: "<player> <unique challenge name>"
unknown-challenge: "&c未知挑战"
create:
description: "&6构建"
description-item-color: "&B"
inventory:
parameters: "[challenge name]"
description: "创建一个来自物品栏的挑战"
surrounding:
parameters: "[challenge name]"
description: "创建一个来自周围环境的挑战"
hit-things: "左键敲击物体来将其加入必需品列表。右键完成。"
error:
no-name: "您必须输入挑战名"
challenge-created: "已创建 [challenge]"
you-added: "您向挑战中添加了一个 [thing]"
seticon:
error:
no-such-challenge: "&c没有此挑战名"
description: "将挑战图标设置为当前手中物品"
parameters: "[challenge name]"
gui-title: "&a挑战管理员"