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