mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-26 20:45:53 +01:00
Fixes.
This commit is contained in:
parent
fd3e7a928f
commit
fcd8078249
@ -52,6 +52,8 @@ challenges:
|
||||
parameters: ""
|
||||
description: "admin command to create challenges"
|
||||
create:
|
||||
description: "&6Collect:"
|
||||
description-item-color: "&B"
|
||||
inventory:
|
||||
parameters: "[challenge name]"
|
||||
description: "create an inventory challenge"
|
||||
|
@ -56,6 +56,7 @@ public class ChallengesAddon extends Addon {
|
||||
new ChallengesCommand(this);
|
||||
new ChallengesAdminCommand(this);
|
||||
// Done
|
||||
/*
|
||||
Gson gson = new Gson();
|
||||
Challenges challenges = new Challenges();
|
||||
challenges.setChallengeType(ChallengeType.SURROUNDING);
|
||||
@ -120,6 +121,7 @@ public class ChallengesAddon extends Addon {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,6 +21,7 @@ import bskyblock.addon.challenges.panel.ChallengesPanels;
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.configuration.BSBConfig;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
public class ChallengesManager {
|
||||
|
||||
@ -70,6 +71,7 @@ public class ChallengesManager {
|
||||
newChallenge.setIcon(new ItemStack(Material.EMPTY_MAP));
|
||||
newChallenge.setFreeChallenge(true);
|
||||
newChallenge.setLevel(FREE);
|
||||
newChallenge.setDescription(createDescription(user, requiredItems));
|
||||
|
||||
// Move all the items back to the player's inventory
|
||||
inventory.forEach(item -> {
|
||||
@ -91,6 +93,21 @@ public class ChallengesManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a simple example description of the requirements
|
||||
* @param user - user of this command
|
||||
* @param requiredItems - list of items
|
||||
* @return Description list
|
||||
*/
|
||||
private List<String> createDescription(User user, List<ItemStack> requiredItems) {
|
||||
List<String> result = new ArrayList<>();
|
||||
result.add(user.getTranslation("challenges.admin.create.description"));
|
||||
for (ItemStack item : requiredItems) {
|
||||
result.add(user.getTranslation("challenges.admin.create.description-item-color") + item.getAmount() + " x " + Util.prettifyText(item.getType().toString()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a surrounding challenge
|
||||
* @param challengeInfo - info on the challenge from the builder
|
||||
@ -195,6 +212,7 @@ public class ChallengesManager {
|
||||
public void load() {
|
||||
// Load the challenges
|
||||
challengeList.clear();
|
||||
Bukkit.getLogger().info("Loading challenges...");
|
||||
for (Challenges challenge : chConfig.loadConfigObjects()) {
|
||||
Bukkit.getLogger().info("Loading challenge " + challenge.getFriendlyName() + " level " + challenge.getLevel());
|
||||
// See if we have this level already
|
||||
|
Loading…
Reference in New Issue
Block a user