mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-01 06:53:37 +01:00
Rework Challenge, ChallengeLevel and ChallengesPlayerData classes.
Challenge now will not know their world, as it is not necessary. Remove ICON type, as it is useless. Rename Level to Other, as under it will be not only level things. Rename slot to order, as it was weird that users could define slot but not order. Order is easier to understand and use. ChallengesLevel now knows all their levels. Each challenge level only will be for single world. Rename some variables. ChallengesPlayerData was just adapted with changes in challenges and level classes.
This commit is contained in:
parent
dba5a44461
commit
f75e4e080c
@ -16,10 +16,13 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import world.bentobox.bentobox.util.ItemParser;
|
||||
import world.bentobox.challenges.database.object.ChallengeLevel;
|
||||
import world.bentobox.challenges.database.object.Challenge;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Imports challenges
|
||||
@ -64,13 +67,13 @@ public class ChallengesImportManager
|
||||
user.sendMessage("challenges.admin.import.no-load","[message]", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
makeLevels(user);
|
||||
makeLevels(user, world, overwrite);
|
||||
makeChallenges(user, world, overwrite);
|
||||
addon.getChallengesManager().save();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void makeLevels(User user) {
|
||||
private void makeLevels(User user, World world, boolean overwrite) {
|
||||
// Parse the levels
|
||||
String levels = chal.getString("challenges.levels", "");
|
||||
if (!levels.isEmpty()) {
|
||||
@ -82,15 +85,16 @@ public class ChallengesImportManager
|
||||
challengeLevel.setFriendlyName(level);
|
||||
challengeLevel.setUniqueId(level);
|
||||
challengeLevel.setOrder(order++);
|
||||
challengeLevel.setWaiveramount(chal.getInt("challenges.waiveramount"));
|
||||
challengeLevel.setWorld(Util.getWorld(world).getName());
|
||||
challengeLevel.setWaiverAmount(chal.getInt("challenges.waiveramount"));
|
||||
// Check if there is a level reward
|
||||
ConfigurationSection unlock = chal.getConfigurationSection("challenges.levelUnlock." + level);
|
||||
if (unlock != null) {
|
||||
challengeLevel.setUnlockMessage(unlock.getString("message"));
|
||||
challengeLevel.setRewardDescription(unlock.getString("rewardDesc",""));
|
||||
challengeLevel.setRewardText(unlock.getString("rewardDesc",""));
|
||||
challengeLevel.setRewardItems(parseItems(unlock.getString("itemReward","")));
|
||||
challengeLevel.setMoneyReward(unlock.getInt("moneyReward"));
|
||||
challengeLevel.setExpReward(unlock.getInt("expReward"));
|
||||
challengeLevel.setRewardMoney(unlock.getInt("moneyReward"));
|
||||
challengeLevel.setRewardExperience(unlock.getInt("expReward"));
|
||||
challengeLevel.setRewardCommands(unlock.getStringList("commands"));
|
||||
}
|
||||
addon.getChallengesManager().storeLevel(challengeLevel);
|
||||
@ -103,7 +107,6 @@ public class ChallengesImportManager
|
||||
/**
|
||||
* Imports challenges
|
||||
* @param overwrite
|
||||
* @param args
|
||||
*/
|
||||
private void makeChallenges(User user, World world, boolean overwrite) {
|
||||
int size = 0;
|
||||
@ -115,41 +118,42 @@ public class ChallengesImportManager
|
||||
newChallenge.setDeployed(true);
|
||||
ConfigurationSection details = chals.getConfigurationSection(challenge);
|
||||
newChallenge.setFriendlyName(details.getString("friendlyname", challenge));
|
||||
newChallenge.setWorld(Util.getWorld(world).getName());
|
||||
newChallenge.setDescription(addon.getChallengesManager().stringSplit(details.getString("description", "")));
|
||||
newChallenge.setIcon(new ParseItem(addon, details.getString("icon") + ":1").getItem());
|
||||
newChallenge.setLevel(details.getString("level", ChallengesManager.FREE));
|
||||
newChallenge.setIcon(ItemParser.parse(details.getString("icon") + ":1"));
|
||||
newChallenge.setChallengeType(Challenge.ChallengeType.valueOf(details.getString("type","INVENTORY").toUpperCase()));
|
||||
newChallenge.setTakeItems(details.getBoolean("takeItems",true));
|
||||
newChallenge.setRewardText(details.getString("rewardText", ""));
|
||||
newChallenge.setRewardCommands(details.getStringList("rewardcommands"));
|
||||
newChallenge.setRewardMoney(details.getInt("moneyReward",0));
|
||||
newChallenge.setRewardExp(details.getInt("expReward"));
|
||||
newChallenge.setRewardExperience(details.getInt("expReward"));
|
||||
newChallenge.setRepeatable(details.getBoolean("repeatable"));
|
||||
newChallenge.setRepeatRewardText(details.getString("repeatRewardText",""));
|
||||
newChallenge.setRepeatMoneyReward(details.getInt("repearMoneyReward"));
|
||||
newChallenge.setRepeatExpReward(details.getInt("repeatExpReward"));
|
||||
newChallenge.setRepeatExperienceReward(details.getInt("repeatExpReward"));
|
||||
newChallenge.setRepeatRewardCommands(details.getStringList("repeatrewardcommands"));
|
||||
newChallenge.setMaxTimes(details.getInt("maxtimes"));
|
||||
// TODO reset allowed
|
||||
newChallenge.setReqMoney(details.getInt("requiredMoney"));
|
||||
newChallenge.setReqExp(details.getInt("requiredExp"));
|
||||
newChallenge.setRequiredMoney(details.getInt("requiredMoney"));
|
||||
newChallenge.setRequiredExperience(details.getInt("requiredExp"));
|
||||
String reqItems = details.getString("requiredItems","");
|
||||
if (newChallenge.getChallengeType().equals(Challenge.ChallengeType.INVENTORY)) {
|
||||
newChallenge.setRequiredItems(parseItems(reqItems));
|
||||
} else if (newChallenge.getChallengeType().equals(Challenge.ChallengeType.LEVEL)) {
|
||||
newChallenge.setReqIslandlevel(Long.parseLong(reqItems));
|
||||
} else if (newChallenge.getChallengeType().equals(Challenge.ChallengeType.OTHER)) {
|
||||
newChallenge.setRequiredIslandLevel(Long.parseLong(reqItems));
|
||||
} else if (newChallenge.getChallengeType().equals(Challenge.ChallengeType.ISLAND)) {
|
||||
parseEntities(newChallenge, reqItems);
|
||||
}
|
||||
newChallenge.setRewardItems(parseItems(details.getString("itemReward")));
|
||||
newChallenge.setRepeatItemReward(parseItems(details.getString("repeatItemReward")));
|
||||
// Save
|
||||
this.addon.getChallengesManager().addChallengeToLevel(newChallenge,
|
||||
addon.getChallengesManager().getLevel(Util.getWorld(world).getName() + "_" + details.getString("level")));
|
||||
|
||||
if (addon.getChallengesManager().storeChallenge(newChallenge, overwrite, user, false)) {
|
||||
size++;
|
||||
}
|
||||
}
|
||||
addon.getChallengesManager().sortChallenges();
|
||||
|
||||
user.sendMessage("challenges.admin.import.number", "[number]", String.valueOf(size));
|
||||
}
|
||||
|
||||
@ -180,7 +184,7 @@ public class ChallengesImportManager
|
||||
List<ItemStack> result = new ArrayList<>();
|
||||
if (!reqList.isEmpty()) {
|
||||
for (String s : reqList.split(" ")) {
|
||||
ItemStack item = new ParseItem(addon,s).getItem();
|
||||
ItemStack item = ItemParser.parse(s);
|
||||
if (item != null) {
|
||||
result.add(item);
|
||||
}
|
||||
@ -188,7 +192,4 @@ public class ChallengesImportManager
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -80,7 +80,7 @@ public class ChallengesManager {
|
||||
*/
|
||||
public long checkChallengeTimes(User user, Challenge challenge, World world) {
|
||||
addPlayer(user);
|
||||
return playerData.get(user.getUniqueId()).getTimes(world, challenge.getUniqueId());
|
||||
return playerData.get(user.getUniqueId()).getTimes(challenge.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,7 +189,7 @@ public class ChallengesManager {
|
||||
*/
|
||||
public List<String> getAllChallengesList(World world) {
|
||||
List<String> result = new ArrayList<>();
|
||||
challengeMap.values().forEach(ch -> ch.stream().filter(c -> c.getWorld().equals(Util.getWorld(world).getName())).forEach(c -> result.add(c.getUniqueId())));
|
||||
challengeMap.values().forEach(ch -> ch.stream().filter(c -> c.getUniqueId().startsWith(Util.getWorld(world).getName())).forEach(c -> result.add(c.getUniqueId())));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -230,10 +230,10 @@ public class ChallengesManager {
|
||||
for (Entry<ChallengeLevel, Set<Challenge>> entry : this.challengeMap.entrySet())
|
||||
{
|
||||
// Check how much challenges must be done in previous level.
|
||||
int challengesToDo = Math.max(0, entry.getKey().getWaiveramount() - doneChallengeCount);
|
||||
int challengesToDo = Math.max(0, entry.getKey().getWaiverAmount() - doneChallengeCount);
|
||||
|
||||
doneChallengeCount = (int) entry.getValue().stream().filter(
|
||||
ch -> playerData.isChallengeDone(world, ch.getUniqueId())).count();
|
||||
ch -> playerData.isChallengeDone(ch.getUniqueId())).count();
|
||||
|
||||
// Create result class with the data
|
||||
result.add(new LevelStatus(
|
||||
@ -270,7 +270,7 @@ public class ChallengesManager {
|
||||
Optional<ChallengeLevel> lv = challengeMap.keySet().stream().filter(l -> l.getUniqueId().equalsIgnoreCase(level)).findFirst();
|
||||
// Get the challenges applicable to this world
|
||||
return lv.isPresent() ? challengeMap.get(lv.get()).stream()
|
||||
.filter(c -> c.getWorld().equalsIgnoreCase(worldName) || c.getWorld().isEmpty()).collect(Collectors.toSet())
|
||||
.filter(c -> c.getUniqueId().startsWith(worldName)).collect(Collectors.toSet())
|
||||
: new HashSet<>();
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ public class ChallengesManager {
|
||||
*/
|
||||
public boolean isChallenge(World world, String name) {
|
||||
for (Set<Challenge> ch : challengeMap.values()) {
|
||||
if (ch.stream().filter(c -> c.getWorld().equals(Util.getWorld(world).getName())).anyMatch(c -> c.getUniqueId().equalsIgnoreCase(name))) {
|
||||
if (ch.stream().filter(c -> c.getUniqueId().startsWith(Util.getWorld(world).getName())).anyMatch(c -> c.getUniqueId().equalsIgnoreCase(name))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -328,13 +328,12 @@ public class ChallengesManager {
|
||||
|
||||
/**
|
||||
* Checks if a challenge is complete or not
|
||||
* @param uniqueId - unique ID - player's UUID
|
||||
* @param challengeName - Challenge uniqueId
|
||||
* @return - true if completed
|
||||
*/
|
||||
public boolean isChallengeComplete(User user, String challengeName, World world) {
|
||||
addPlayer(user);
|
||||
return playerData.get(user.getUniqueId()).isChallengeDone(world, challengeName);
|
||||
return playerData.get(user.getUniqueId()).isChallengeDone(challengeName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -396,7 +395,7 @@ public class ChallengesManager {
|
||||
*/
|
||||
public void setChallengeComplete(User user, String challengeUniqueId, World world) {
|
||||
addPlayer(user);
|
||||
playerData.get(user.getUniqueId()).setChallengeDone(world, challengeUniqueId);
|
||||
playerData.get(user.getUniqueId()).setChallengeDone(challengeUniqueId);
|
||||
// Save
|
||||
savePlayer(user.getUniqueId());
|
||||
}
|
||||
@ -409,7 +408,7 @@ public class ChallengesManager {
|
||||
*/
|
||||
public void setResetChallenge(User user, String challengeUniqueId, World world) {
|
||||
addPlayer(user);
|
||||
playerData.get(user.getUniqueId()).setChallengeTimes(world, challengeUniqueId, 0);
|
||||
playerData.get(user.getUniqueId()).setChallengeTimes(challengeUniqueId, 0);
|
||||
// Save
|
||||
savePlayer(user.getUniqueId());
|
||||
}
|
||||
@ -637,4 +636,17 @@ public class ChallengesManager {
|
||||
|
||||
return playerList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ChallengeLevel getLevel(String level)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void addChallengeToLevel(Challenge newChallenge, ChallengeLevel level)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,13 @@
|
||||
package world.bentobox.challenges.database.object;
|
||||
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import world.bentobox.bentobox.api.configuration.ConfigComment;
|
||||
import world.bentobox.bentobox.database.objects.DataObject;
|
||||
@ -14,223 +18,455 @@ import world.bentobox.challenges.ChallengesManager;
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class ChallengeLevel implements DataObject, Comparable<ChallengeLevel> {
|
||||
public class ChallengeLevel implements DataObject, Comparable<ChallengeLevel>
|
||||
{
|
||||
/**
|
||||
* Constructor ChallengeLevel creates a new ChallengeLevel instance.
|
||||
*/
|
||||
public ChallengeLevel()
|
||||
{
|
||||
}
|
||||
|
||||
public ChallengeLevel() {}
|
||||
|
||||
@ConfigComment("A friendly name for the level. If blank, level name is used.")
|
||||
private String friendlyName = "";
|
||||
|
||||
@ConfigComment("Worlds that this level applies in. String list.")
|
||||
private List<String> worlds = new ArrayList<>();
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Variables
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
@ConfigComment("Commands to run when this level is completed")
|
||||
private List<String> rewardCommands = new ArrayList<>();
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Level name")
|
||||
@Expose
|
||||
private String uniqueId = ChallengesManager.FREE;
|
||||
|
||||
@ConfigComment("The number of undone challenges that can be left on this level before unlocking next level")
|
||||
private int waiveramount = 1;
|
||||
|
||||
@ConfigComment("The ordering of the levels, lowest to highest")
|
||||
private int order = 0;
|
||||
|
||||
@ConfigComment("The message shown when unlocking this level")
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("A friendly name for the level. If blank, level name is used.")
|
||||
@Expose
|
||||
private String friendlyName = "";
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("ItemStack that represents current level. Will be used as icon in GUIs.")
|
||||
@Expose
|
||||
private ItemStack icon = new ItemStack(Material.BOOK);
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("World that this level applies in. String.")
|
||||
@Expose
|
||||
private String world = "";
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("The ordering of the level, lowest to highest")
|
||||
@Expose
|
||||
private int order;
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("The number of undone challenges that can be left on this level before")
|
||||
@ConfigComment("unlocking next level.")
|
||||
@Expose
|
||||
private int waiverAmount = 1;
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("The message shown when unlocking this level. Single line string.")
|
||||
@Expose
|
||||
private String unlockMessage = "";
|
||||
|
||||
@ConfigComment("Unlock reward description")
|
||||
private String rewardDescription = "";
|
||||
|
||||
@ConfigComment("List of reward itemstacks")
|
||||
private List<ItemStack> rewardItems;
|
||||
|
||||
@ConfigComment("Unlock experience reward")
|
||||
private int expReward;
|
||||
|
||||
@ConfigComment("Unlock money reward")
|
||||
private int moneyReward;
|
||||
|
||||
public String getFriendlyName() {
|
||||
return friendlyName;
|
||||
}
|
||||
|
||||
public List<String> getRewardCommands() {
|
||||
return rewardCommands = new ArrayList<>();
|
||||
}
|
||||
@ConfigComment("")
|
||||
@ConfigComment("")
|
||||
@ConfigComment("If this is blank, the reward text will be auto-generated, otherwise")
|
||||
@ConfigComment("this will be used.")
|
||||
@Expose
|
||||
private String rewardText = "";
|
||||
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("List of items the player will receive on completing level.")
|
||||
@ConfigComment("ItemStack List.")
|
||||
@Expose
|
||||
private List<ItemStack> rewardItems = new ArrayList<>();
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Experience point reward on completing level.")
|
||||
@Expose
|
||||
private int rewardExperience = 0;
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Money reward. Economy plugin or addon required for this option.")
|
||||
@Expose
|
||||
private int rewardMoney = 0;
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Commands to run when the player completes all challenges in current")
|
||||
@ConfigComment("level. String List")
|
||||
@Expose
|
||||
private List<String> rewardCommands = new ArrayList<>();
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Set of all challenges that is linked with current level.")
|
||||
@ConfigComment("String Set")
|
||||
@Expose
|
||||
private Set<String> challenges = new HashSet<>();
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Getters
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the uniqueId value.
|
||||
* @return the value of uniqueId.
|
||||
* @see DataObject#getUniqueId()
|
||||
*/
|
||||
@Override
|
||||
public String getUniqueId() {
|
||||
public String getUniqueId()
|
||||
{
|
||||
return uniqueId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of undone tasks that can be left on a level before unlocking next level
|
||||
* @return
|
||||
* This method returns the friendlyName value.
|
||||
* @return the value of friendlyName.
|
||||
*/
|
||||
public int getWaiveramount() {
|
||||
return waiveramount;
|
||||
public String getFriendlyName()
|
||||
{
|
||||
return friendlyName;
|
||||
}
|
||||
|
||||
public void setFriendlyName(String friendlyName) {
|
||||
this.friendlyName = friendlyName;
|
||||
|
||||
/**
|
||||
* This method returns the icon value.
|
||||
* @return the value of icon.
|
||||
*/
|
||||
public ItemStack getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setRewardCommands(List<String> rewardCommands) {
|
||||
this.rewardCommands = rewardCommands;
|
||||
|
||||
/**
|
||||
* This method returns the world value.
|
||||
* @return the value of world.
|
||||
*/
|
||||
public String getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUniqueId(String uniqueId) {
|
||||
this.uniqueId = uniqueId;
|
||||
}
|
||||
|
||||
public void setWaiveramount(int waiveramount) {
|
||||
this.waiveramount = waiveramount;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
/**
|
||||
* This method returns the order value.
|
||||
* @return the value of order.
|
||||
*/
|
||||
public int getOrder()
|
||||
{
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ChallengeLevel o) {
|
||||
return Integer.compare(this.order, o.order);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rewardDescription
|
||||
*/
|
||||
public String getRewardDescription() {
|
||||
return rewardDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rewardDescription the rewardDescription to set
|
||||
* This method returns the waiverAmount value.
|
||||
* @return the value of waiverAmount.
|
||||
*/
|
||||
public void setRewardDescription(String rewardDescription) {
|
||||
this.rewardDescription = rewardDescription;
|
||||
public int getWaiverAmount()
|
||||
{
|
||||
return waiverAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rewardItems
|
||||
*/
|
||||
public List<ItemStack> getRewardItems() {
|
||||
return rewardItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rewardItems the rewardItems to set
|
||||
* This method returns the unlockMessage value.
|
||||
* @return the value of unlockMessage.
|
||||
*/
|
||||
public void setRewardItems(List<ItemStack> rewardItems) {
|
||||
this.rewardItems = rewardItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the expReward
|
||||
*/
|
||||
public int getExpReward() {
|
||||
return expReward;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param expReward the expReward to set
|
||||
*/
|
||||
public void setExpReward(int expReward) {
|
||||
this.expReward = expReward;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the moneyReward
|
||||
*/
|
||||
public int getMoneyReward() {
|
||||
return moneyReward;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param moneyReward the moneyReward to set
|
||||
*/
|
||||
public void setMoneyReward(int moneyReward) {
|
||||
this.moneyReward = moneyReward;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unlockMessage
|
||||
*/
|
||||
public String getUnlockMessage() {
|
||||
public String getUnlockMessage()
|
||||
{
|
||||
return unlockMessage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param unlockMessage the unlockMessage to set
|
||||
* This method returns the rewardText value.
|
||||
* @return the value of rewardText.
|
||||
*/
|
||||
public void setUnlockMessage(String unlockMessage) {
|
||||
public String getRewardText()
|
||||
{
|
||||
return rewardText;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the rewardItems value.
|
||||
* @return the value of rewardItems.
|
||||
*/
|
||||
public List<ItemStack> getRewardItems()
|
||||
{
|
||||
return rewardItems;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the rewardExperience value.
|
||||
* @return the value of rewardExperience.
|
||||
*/
|
||||
public int getRewardExperience()
|
||||
{
|
||||
return rewardExperience;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the rewardMoney value.
|
||||
* @return the value of rewardMoney.
|
||||
*/
|
||||
public int getRewardMoney()
|
||||
{
|
||||
return rewardMoney;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the rewardCommands value.
|
||||
* @return the value of rewardCommands.
|
||||
*/
|
||||
public List<String> getRewardCommands()
|
||||
{
|
||||
return rewardCommands;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the challenges value.
|
||||
* @return the value of challenges.
|
||||
*/
|
||||
public Set<String> getChallenges()
|
||||
{
|
||||
return challenges;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Setters
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the uniqueId value.
|
||||
* @param uniqueId the uniqueId new value.
|
||||
*
|
||||
* @see DataObject#setUniqueId(String)
|
||||
*/
|
||||
@Override
|
||||
public void setUniqueId(String uniqueId)
|
||||
{
|
||||
this.uniqueId = uniqueId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the friendlyName value.
|
||||
* @param friendlyName the friendlyName new value.
|
||||
*
|
||||
*/
|
||||
public void setFriendlyName(String friendlyName)
|
||||
{
|
||||
this.friendlyName = friendlyName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the icon value.
|
||||
* @param icon the icon new value.
|
||||
*
|
||||
*/
|
||||
public void setIcon(ItemStack icon)
|
||||
{
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the world value.
|
||||
* @param world the world new value.
|
||||
*
|
||||
*/
|
||||
public void setWorld(String world)
|
||||
{
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the order value.
|
||||
* @param order the order new value.
|
||||
*
|
||||
*/
|
||||
public void setOrder(int order)
|
||||
{
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the waiverAmount value.
|
||||
* @param waiverAmount the waiverAmount new value.
|
||||
*
|
||||
*/
|
||||
public void setWaiverAmount(int waiverAmount)
|
||||
{
|
||||
this.waiverAmount = waiverAmount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the unlockMessage value.
|
||||
* @param unlockMessage the unlockMessage new value.
|
||||
*
|
||||
*/
|
||||
public void setUnlockMessage(String unlockMessage)
|
||||
{
|
||||
this.unlockMessage = unlockMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the worlds
|
||||
*/
|
||||
public List<String> getWorlds() {
|
||||
return worlds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param worlds the worlds to set
|
||||
* This method sets the rewardText value.
|
||||
* @param rewardText the rewardText new value.
|
||||
*
|
||||
*/
|
||||
public void setWorlds(List<String> worlds) {
|
||||
this.worlds = worlds;
|
||||
public void setRewardText(String rewardText)
|
||||
{
|
||||
this.rewardText = rewardText;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
|
||||
/**
|
||||
* This method sets the rewardItems value.
|
||||
* @param rewardItems the rewardItems new value.
|
||||
*
|
||||
*/
|
||||
public void setRewardItems(List<ItemStack> rewardItems)
|
||||
{
|
||||
this.rewardItems = rewardItems;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the rewardExperience value.
|
||||
* @param rewardExperience the rewardExperience new value.
|
||||
*
|
||||
*/
|
||||
public void setRewardExperience(int rewardExperience)
|
||||
{
|
||||
this.rewardExperience = rewardExperience;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the rewardMoney value.
|
||||
* @param rewardMoney the rewardMoney new value.
|
||||
*
|
||||
*/
|
||||
public void setRewardMoney(int rewardMoney)
|
||||
{
|
||||
this.rewardMoney = rewardMoney;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the rewardCommands value.
|
||||
* @param rewardCommands the rewardCommands new value.
|
||||
*
|
||||
*/
|
||||
public void setRewardCommands(List<String> rewardCommands)
|
||||
{
|
||||
this.rewardCommands = rewardCommands;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the challenges value.
|
||||
* @param challenges the challenges new value.
|
||||
*
|
||||
*/
|
||||
public void setChallenges(Set<String> challenges)
|
||||
{
|
||||
this.challenges = challenges;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Other methods
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
public int compareTo(ChallengeLevel o)
|
||||
{
|
||||
if (this.equals(o))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.getWorld().equals(o.getWorld()))
|
||||
{
|
||||
if (this.order == o.getOrder())
|
||||
{
|
||||
return this.getUniqueId().compareTo(o.getUniqueId());
|
||||
}
|
||||
else
|
||||
{
|
||||
return Integer.compare(this.order, o.getOrder());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.getWorld().compareTo(o.getWorld());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof ChallengeLevel)) {
|
||||
|
||||
if (!(obj instanceof ChallengeLevel))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ChallengeLevel other = (ChallengeLevel) obj;
|
||||
if (uniqueId == null) {
|
||||
if (other.uniqueId != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!uniqueId.equals(other.uniqueId)) {
|
||||
return false;
|
||||
|
||||
if (uniqueId == null)
|
||||
{
|
||||
return other.uniqueId == null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return uniqueId.equals(other.uniqueId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public ItemStack getIcon()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void setIcon(ItemStack newIcon)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package world.bentobox.challenges.database.object;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -20,173 +17,265 @@ import world.bentobox.bentobox.util.Util;
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class ChallengesPlayerData implements DataObject {
|
||||
public class ChallengesPlayerData implements DataObject
|
||||
{
|
||||
/**
|
||||
* Constructor ChallengesPlayerData creates a new ChallengesPlayerData instance.
|
||||
*/
|
||||
public ChallengesPlayerData()
|
||||
{
|
||||
}
|
||||
|
||||
@Expose
|
||||
private String uniqueId = "";
|
||||
/**
|
||||
* Challenge map, where key = unique challenge name and Value = number of times completed
|
||||
*/
|
||||
@Expose
|
||||
private Map<String, Integer> challengeStatus = new HashMap<>();
|
||||
@Expose
|
||||
private Map<String, Long> challengesTimestamp = new HashMap<>();
|
||||
@Expose
|
||||
private Set<String> levelsDone = new HashSet<>();
|
||||
|
||||
// Required for bean instantiation
|
||||
public ChallengesPlayerData() {}
|
||||
/**
|
||||
* Creates a player data entry
|
||||
*
|
||||
* @param uniqueId - the player's UUID in string format
|
||||
*/
|
||||
public ChallengesPlayerData(String uniqueId)
|
||||
{
|
||||
this.uniqueId = uniqueId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a challenge as having been completed. Will increment the number of times and timestamp
|
||||
* @param world - world of challenge
|
||||
* @param challengeName - unique challenge name
|
||||
*/
|
||||
public void setChallengeDone(World world, String challengeName) {
|
||||
String name = Util.getWorld(world).getName() + challengeName;
|
||||
int times = challengeStatus.getOrDefault(name, 0) + 1;
|
||||
challengeStatus.put(name, times);
|
||||
challengesTimestamp.put(name, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of times a challenge has been done
|
||||
* @param world - world of challenge
|
||||
* @param challengeName - unique challenge name
|
||||
* @param times - the number of times to set
|
||||
*
|
||||
*/
|
||||
public void setChallengeTimes(World world, String challengeName, int times) {
|
||||
String name = Util.getWorld(world).getName() + challengeName;
|
||||
challengeStatus.put(name, times);
|
||||
challengesTimestamp.put(name, System.currentTimeMillis());
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Variables
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Check if a challenge has been done
|
||||
* @param challengeName - unique challenge name
|
||||
* @return true if done at least once
|
||||
*/
|
||||
public boolean isChallengeDone(World world, String challengeName) {
|
||||
return getTimes(world, challengeName) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check how many times a challenge has been done
|
||||
* @param challengeName - unique challenge name
|
||||
* @return - number of times
|
||||
*/
|
||||
public int getTimes(World world, String challengeName) {
|
||||
return challengeStatus.getOrDefault(Util.getWorld(world).getName() + challengeName, 0);
|
||||
}
|
||||
/**
|
||||
* This variable stores each player UUID as string.
|
||||
*/
|
||||
@Expose
|
||||
private String uniqueId = "";
|
||||
|
||||
/**
|
||||
* Creates a player data entry
|
||||
* @param uniqueId - the player's UUID in string format
|
||||
*/
|
||||
public ChallengesPlayerData(String uniqueId) {
|
||||
this.uniqueId = uniqueId;
|
||||
}
|
||||
/**
|
||||
* Challenge map, where key = unique challenge name and Value = number of times
|
||||
* completed
|
||||
*/
|
||||
@Expose
|
||||
private Map<String, Integer> challengeStatus = new HashMap<>();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see world.bentobox.bbox.database.objects.DataObject#getUniqueId()
|
||||
*/
|
||||
@Override
|
||||
public String getUniqueId() {
|
||||
return uniqueId;
|
||||
}
|
||||
/**
|
||||
* Map of challenges completion time where key is challenges unique id and value is
|
||||
* timestamp when challenge was completed last time.
|
||||
*/
|
||||
@Expose
|
||||
private Map<String, Long> challengesTimestamp = new HashMap<>();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see world.bentobox.bbox.database.objects.DataObject#setUniqueId(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setUniqueId(String uniqueId) {
|
||||
this.uniqueId = uniqueId;
|
||||
}
|
||||
/**
|
||||
* Set of Strings that contains all challenge levels that are completed.
|
||||
*/
|
||||
@Expose
|
||||
private Set<String> levelsDone = new HashSet<>();
|
||||
|
||||
/**
|
||||
* @return the challengeStatus
|
||||
*/
|
||||
public Map<String, Integer> getChallengeStatus() {
|
||||
return challengeStatus;
|
||||
}
|
||||
/**
|
||||
* @param challengeStatus the challengeStatus to set
|
||||
*/
|
||||
public void setChallengeStatus(Map<String, Integer> challengeStatus) {
|
||||
this.challengeStatus = challengeStatus;
|
||||
}
|
||||
/**
|
||||
* @return the challengesTimestamp
|
||||
*/
|
||||
public Map<String, Long> getChallengesTimestamp() {
|
||||
return challengesTimestamp;
|
||||
}
|
||||
/**
|
||||
* @param challengesTimestamp the challengesTimestamp to set
|
||||
*/
|
||||
public void setChallengesTimestamp(Map<String, Long> challengesTimestamp) {
|
||||
this.challengesTimestamp = challengesTimestamp;
|
||||
}
|
||||
/**
|
||||
* @return the levelsDone
|
||||
*/
|
||||
public Set<String> getLevelsDone() {
|
||||
return levelsDone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param levelsDone the levelsDone to set
|
||||
*/
|
||||
public void setLevelsDone(Set<String> levelsDone) {
|
||||
this.levelsDone = levelsDone;
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Getters
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof ChallengesPlayerData)) {
|
||||
return false;
|
||||
}
|
||||
ChallengesPlayerData other = (ChallengesPlayerData) obj;
|
||||
if (uniqueId == null) {
|
||||
if (other.uniqueId != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!uniqueId.equals(other.uniqueId)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @return uniqueID
|
||||
* @see DataObject#getUniqueId()
|
||||
*/
|
||||
@Override
|
||||
public String getUniqueId()
|
||||
{
|
||||
return uniqueId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets all challenges and levels in world for this player
|
||||
* @param world
|
||||
*/
|
||||
public void reset(World world) {
|
||||
String worldName = Util.getWorld(world).getName();
|
||||
challengeStatus.keySet().removeIf(n -> n.startsWith(worldName));
|
||||
challengesTimestamp.keySet().removeIf(n -> n.startsWith(worldName));
|
||||
levelsDone.removeIf(n -> n.startsWith(worldName));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* This method returns the challengeStatus value.
|
||||
* @return the value of challengeStatus.
|
||||
*/
|
||||
public Map<String, Integer> getChallengeStatus()
|
||||
{
|
||||
return challengeStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the challengesTimestamp value.
|
||||
* @return the value of challengesTimestamp.
|
||||
*/
|
||||
public Map<String, Long> getChallengesTimestamp()
|
||||
{
|
||||
return challengesTimestamp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the levelsDone value.
|
||||
* @return the value of levelsDone.
|
||||
*/
|
||||
public Set<String> getLevelsDone()
|
||||
{
|
||||
return levelsDone;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Setters
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* @param uniqueId - unique ID the uniqueId to set
|
||||
* @see DataObject#setUniqueId(String)
|
||||
*/
|
||||
@Override
|
||||
public void setUniqueId(String uniqueId)
|
||||
{
|
||||
this.uniqueId = uniqueId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the challengeStatus value.
|
||||
* @param challengeStatus the challengeStatus new value.
|
||||
*
|
||||
*/
|
||||
public void setChallengeStatus(Map<String, Integer> challengeStatus)
|
||||
{
|
||||
this.challengeStatus = challengeStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the challengesTimestamp value.
|
||||
* @param challengesTimestamp the challengesTimestamp new value.
|
||||
*
|
||||
*/
|
||||
public void setChallengesTimestamp(Map<String, Long> challengesTimestamp)
|
||||
{
|
||||
this.challengesTimestamp = challengesTimestamp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets the levelsDone value.
|
||||
* @param levelsDone the levelsDone new value.
|
||||
*
|
||||
*/
|
||||
public void setLevelsDone(Set<String> levelsDone)
|
||||
{
|
||||
this.levelsDone = levelsDone;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Other Methods
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Resets all challenges and levels in world for this player
|
||||
*
|
||||
* @param world world which challenges must be reset.
|
||||
*/
|
||||
public void reset(World world)
|
||||
{
|
||||
String worldName = Util.getWorld(world).getName();
|
||||
challengeStatus.keySet().removeIf(n -> n.startsWith(worldName));
|
||||
challengesTimestamp.keySet().removeIf(n -> n.startsWith(worldName));
|
||||
levelsDone.removeIf(n -> n.startsWith(worldName));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark a challenge as having been completed. Will increment the number of times and
|
||||
* timestamp
|
||||
*
|
||||
* @param challengeName - unique challenge name
|
||||
*/
|
||||
public void setChallengeDone(String challengeName)
|
||||
{
|
||||
int times = challengeStatus.getOrDefault(challengeName, 0) + 1;
|
||||
challengeStatus.put(challengeName, times);
|
||||
challengesTimestamp.put(challengeName, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the number of times a challenge has been done
|
||||
*
|
||||
* @param challengeName - unique challenge name
|
||||
* @param times - the number of times to set
|
||||
*/
|
||||
public void setChallengeTimes(String challengeName, int times)
|
||||
{
|
||||
challengeStatus.put(challengeName, times);
|
||||
challengesTimestamp.put(challengeName, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a challenge has been done
|
||||
*
|
||||
* @param challengeName - unique challenge name
|
||||
* @return true if done at least once
|
||||
*/
|
||||
public boolean isChallengeDone(String challengeName)
|
||||
{
|
||||
return this.getTimes(challengeName) > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check how many times a challenge has been done
|
||||
*
|
||||
* @param challengeName - unique challenge name
|
||||
* @return - number of times
|
||||
*/
|
||||
public int getTimes(String challengeName)
|
||||
{
|
||||
return challengeStatus.getOrDefault(challengeName, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see Object#hashCode()
|
||||
* @return object hashCode value.
|
||||
*/
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
* @param obj Other object.
|
||||
* @return boolean that indicate if objects are equals.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(obj instanceof ChallengesPlayerData))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ChallengesPlayerData other = (ChallengesPlayerData) obj;
|
||||
|
||||
if (uniqueId == null)
|
||||
{
|
||||
return other.uniqueId == null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return uniqueId.equals(other.uniqueId);
|
||||
}
|
||||
}
|
||||
}
|
@ -85,7 +85,6 @@ public class ChallengesPanels {
|
||||
* Creates a panel item for challenge if appropriate and adds it to panelBuilder
|
||||
* @param panelBuilder
|
||||
* @param challenge
|
||||
* @param user
|
||||
*/
|
||||
private void createItem(PanelBuilder panelBuilder, Challenge challenge) {
|
||||
// Check completion
|
||||
@ -100,16 +99,13 @@ public class ChallengesPanels {
|
||||
.description(challengeDescription(challenge))
|
||||
.glow(completed)
|
||||
.clickHandler((panel, player, c, s) -> {
|
||||
if (!challenge.getChallengeType().equals(ChallengeType.ICON)) {
|
||||
new TryToComplete(addon).user(player).manager(manager).challenge(challenge)
|
||||
new TryToComplete(addon).user(player).manager(manager).challenge(challenge)
|
||||
.world(world).permPrefix(permPrefix).label(label).build();
|
||||
//new TryToComplete(addon, player, manager, challenge, world, permPrefix, label);
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.build();
|
||||
if (challenge.getSlot() >= 0) {
|
||||
panelBuilder.item(challenge.getSlot(),item);
|
||||
if (challenge.getOrder() >= 0) {
|
||||
panelBuilder.item(challenge.getOrder(),item);
|
||||
} else {
|
||||
panelBuilder.item(item);
|
||||
}
|
||||
@ -161,7 +157,6 @@ public class ChallengesPanels {
|
||||
* Creates the challenge description for the "item" in the inventory
|
||||
*
|
||||
* @param challenge
|
||||
* @param player
|
||||
* @return List of strings splitting challenge string into 25 chars long
|
||||
*/
|
||||
private List<String> challengeDescription(Challenge challenge) {
|
||||
@ -210,7 +205,7 @@ public class ChallengesPanels {
|
||||
// First time
|
||||
moneyReward = challenge.getRewardMoney();
|
||||
rewardText = challenge.getRewardText();
|
||||
expReward = challenge.getRewardExp();
|
||||
expReward = challenge.getRewardExperience();
|
||||
if (!rewardText.isEmpty()) {
|
||||
result.addAll(splitTrans(user, "challenges.first-time-rewards"));
|
||||
}
|
||||
@ -218,7 +213,7 @@ public class ChallengesPanels {
|
||||
// Repeat challenge
|
||||
moneyReward = challenge.getRepeatMoneyReward();
|
||||
rewardText = challenge.getRepeatRewardText();
|
||||
expReward = challenge.getRepeatExpReward();
|
||||
expReward = challenge.getRepeatExperienceReward();
|
||||
if (!rewardText.isEmpty()) {
|
||||
result.addAll(splitTrans(user, "challenges.repeat-rewards"));
|
||||
}
|
||||
|
@ -107,7 +107,6 @@ public class ChallengesPanels2 {
|
||||
* Creates a panel item for challenge if appropriate and adds it to panelBuilder
|
||||
* @param panelBuilder
|
||||
* @param challenge
|
||||
* @param requester
|
||||
*/
|
||||
private void createItem(PanelBuilder panelBuilder, Challenge challenge) {
|
||||
// For admin, glow means activated. For user, glow means done
|
||||
@ -138,33 +137,27 @@ public class ChallengesPanels2 {
|
||||
if (mode.equals(Mode.ADMIN)) {
|
||||
// Admin click
|
||||
itemBuilder.clickHandler((panel, player, c, s) -> {
|
||||
if (!challenge.getChallengeType().equals(ChallengeType.ICON)) {
|
||||
new AdminGUI(addon, player, challenge, world, permPrefix, label);
|
||||
}
|
||||
new AdminGUI(addon, player, challenge, world, permPrefix, label);
|
||||
return true;
|
||||
});
|
||||
|
||||
} else if (mode.equals(Mode.EDIT)) {
|
||||
// Admin edit click
|
||||
itemBuilder.clickHandler((panel, player, c, s) -> {
|
||||
if (!challenge.getChallengeType().equals(ChallengeType.ICON)) {
|
||||
new AdminEditGUI(addon, player, target, challenge, world, permPrefix, label);
|
||||
}
|
||||
new AdminEditGUI(addon, player, target, challenge, world, permPrefix, label);
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
// Player click
|
||||
itemBuilder.clickHandler((panel, player, c, s) -> {
|
||||
if (!challenge.getChallengeType().equals(ChallengeType.ICON)) {
|
||||
new TryToComplete(addon, player, manager, challenge, world, permPrefix, label);
|
||||
}
|
||||
new TryToComplete(addon, player, manager, challenge, world, permPrefix, label);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
// If the challenge has a specific slot allocated, use it
|
||||
if (challenge.getSlot() >= 0) {
|
||||
panelBuilder.item(challenge.getSlot(),itemBuilder.build());
|
||||
if (challenge.getOrder() >= 0) {
|
||||
panelBuilder.item(challenge.getOrder(),itemBuilder.build());
|
||||
} else {
|
||||
panelBuilder.item(itemBuilder.build());
|
||||
}
|
||||
@ -216,7 +209,6 @@ public class ChallengesPanels2 {
|
||||
* Creates the challenge description for the "item" in the inventory
|
||||
*
|
||||
* @param challenge
|
||||
* @param player
|
||||
* @return List of strings splitting challenge string into 25 chars long
|
||||
*/
|
||||
private List<String> challengeDescription(Challenge challenge) {
|
||||
@ -287,7 +279,7 @@ public class ChallengesPanels2 {
|
||||
// First time
|
||||
moneyReward = challenge.getRewardMoney();
|
||||
rewardText = challenge.getRewardText();
|
||||
expReward = challenge.getRewardExp();
|
||||
expReward = challenge.getRewardExperience();
|
||||
if (!rewardText.isEmpty()) {
|
||||
result.addAll(splitTrans(requester, "challenges.first-time-rewards"));
|
||||
}
|
||||
@ -296,7 +288,7 @@ public class ChallengesPanels2 {
|
||||
// Repeat challenge
|
||||
moneyReward = challenge.getRepeatMoneyReward();
|
||||
rewardText = challenge.getRepeatRewardText();
|
||||
expReward = challenge.getRepeatExpReward();
|
||||
expReward = challenge.getRepeatExperienceReward();
|
||||
if (!rewardText.isEmpty()) {
|
||||
result.addAll(splitTrans(requester, "challenges.repeat-rewards"));
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class RequiredPanel implements ClickHandler, PanelListener {
|
||||
.clickHandler(this)
|
||||
.build()).forEach(pb::item);
|
||||
return pb.user(user).build();
|
||||
case LEVEL:
|
||||
case OTHER:
|
||||
|
||||
break;
|
||||
default:
|
||||
@ -137,8 +137,6 @@ public class RequiredPanel implements ClickHandler, PanelListener {
|
||||
}
|
||||
// Save changes
|
||||
switch (challenge.getChallengeType()) {
|
||||
case ICON:
|
||||
break;
|
||||
case INVENTORY:
|
||||
List<ItemStack> reqItems = new ArrayList<>();
|
||||
// Skip first item
|
||||
@ -154,7 +152,7 @@ public class RequiredPanel implements ClickHandler, PanelListener {
|
||||
break;
|
||||
case ISLAND:
|
||||
break;
|
||||
case LEVEL:
|
||||
case OTHER:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -97,7 +97,7 @@ public class TryToComplete {
|
||||
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRewardMoney()));
|
||||
|
||||
// Give exp
|
||||
user.getPlayer().giveExp(challenge.getRewardExp());
|
||||
user.getPlayer().giveExp(challenge.getRewardExperience());
|
||||
// Run commands
|
||||
runCommands(challenge.getRewardCommands());
|
||||
user.sendMessage("challenges.you-completed", "[challenge]", challenge.getFriendlyName());
|
||||
@ -118,7 +118,7 @@ public class TryToComplete {
|
||||
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRepeatMoneyReward()));
|
||||
|
||||
// Give exp
|
||||
user.getPlayer().giveExp(challenge.getRepeatExpReward());
|
||||
user.getPlayer().giveExp(challenge.getRepeatExperienceReward());
|
||||
// Run commands
|
||||
runCommands(challenge.getRepeatRewardCommands());
|
||||
user.sendMessage("challenges.you-repeated", "[challenge]", challenge.getFriendlyName());
|
||||
@ -162,7 +162,7 @@ public class TryToComplete {
|
||||
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRewardMoney()));
|
||||
|
||||
// Give exp
|
||||
user.getPlayer().giveExp(challenge.getRewardExp());
|
||||
user.getPlayer().giveExp(challenge.getRewardExperience());
|
||||
// Run commands
|
||||
runCommands(challenge.getRewardCommands());
|
||||
user.sendMessage("challenges.you-completed", "[challenge]", challenge.getFriendlyName());
|
||||
@ -183,7 +183,7 @@ public class TryToComplete {
|
||||
vaultHook -> vaultHook.deposit(this.user, this.challenge.getRepeatMoneyReward()));
|
||||
|
||||
// Give exp
|
||||
user.getPlayer().giveExp(challenge.getRepeatExpReward());
|
||||
user.getPlayer().giveExp(challenge.getRepeatExperienceReward());
|
||||
// Run commands
|
||||
runCommands(challenge.getRepeatRewardCommands());
|
||||
user.sendMessage("challenges.you-repeated", "[challenge]", challenge.getFriendlyName());
|
||||
@ -199,7 +199,7 @@ public class TryToComplete {
|
||||
*/
|
||||
private ChallengeResult checkIfCanCompleteChallenge() {
|
||||
// Check the world
|
||||
if (!Util.getWorld(user.getWorld()).getName().equalsIgnoreCase(challenge.getWorld())) {
|
||||
if (!challenge.getUniqueId().startsWith(Util.getWorld(world).getName())) {
|
||||
user.sendMessage("general.errors.wrong-world");
|
||||
return new ChallengeResult();
|
||||
}
|
||||
@ -215,7 +215,7 @@ public class TryToComplete {
|
||||
}
|
||||
// Check repeatability
|
||||
if (manager.isChallengeComplete(user, challenge.getUniqueId(), world)
|
||||
&& (!challenge.isRepeatable() || challenge.getChallengeType().equals(ChallengeType.LEVEL)
|
||||
&& (!challenge.isRepeatable() || challenge.getChallengeType().equals(ChallengeType.OTHER)
|
||||
|| challenge.getChallengeType().equals(ChallengeType.ISLAND))) {
|
||||
user.sendMessage("challenges.not-repeatable");
|
||||
return new ChallengeResult();
|
||||
@ -226,24 +226,24 @@ public class TryToComplete {
|
||||
|
||||
if (vaultHook.isPresent())
|
||||
{
|
||||
if (!vaultHook.get().has(this.user, this.challenge.getReqMoney()))
|
||||
if (!vaultHook.get().has(this.user, this.challenge.getRequiredMoney()))
|
||||
{
|
||||
this.user.sendMessage("challenges.not-enough-money", "[money]", Integer.toString(this.challenge.getReqMoney()));
|
||||
this.user.sendMessage("challenges.not-enough-money", "[money]", Integer.toString(this.challenge.getRequiredMoney()));
|
||||
return new ChallengeResult();
|
||||
}
|
||||
}
|
||||
|
||||
// Check exp
|
||||
if (this.user.getPlayer().getTotalExperience() < this.challenge.getReqExp())
|
||||
if (this.user.getPlayer().getTotalExperience() < this.challenge.getRequiredExperience())
|
||||
{
|
||||
this.user.sendMessage("challenges.not-enough-exp", "[xp]", Integer.toString(this.challenge.getReqExp()));
|
||||
this.user.sendMessage("challenges.not-enough-exp", "[xp]", Integer.toString(this.challenge.getRequiredExperience()));
|
||||
return new ChallengeResult();
|
||||
}
|
||||
|
||||
switch (challenge.getChallengeType()) {
|
||||
case INVENTORY:
|
||||
return checkInventory();
|
||||
case LEVEL:
|
||||
case OTHER:
|
||||
return checkLevel();
|
||||
case ISLAND:
|
||||
return checkSurrounding();
|
||||
@ -303,9 +303,9 @@ public class TryToComplete {
|
||||
|
||||
if (vaultHook.isPresent() &&
|
||||
this.challenge.isTakeMoney() &&
|
||||
this.challenge.getReqMoney() > 0)
|
||||
this.challenge.getRequiredMoney() > 0)
|
||||
{
|
||||
vaultHook.get().withdraw(this.user, this.challenge.getReqMoney());
|
||||
vaultHook.get().withdraw(this.user, this.challenge.getRequiredMoney());
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,12 +346,12 @@ public class TryToComplete {
|
||||
// Check if the level addon is installed or not
|
||||
long level = addon.getAddonByName("Level")
|
||||
.map(l -> ((Level)l).getIslandLevel(world, user.getUniqueId())).orElse(0L);
|
||||
if (level >= challenge.getReqIslandlevel()) {
|
||||
if (level >= challenge.getRequiredIslandLevel()) {
|
||||
// process money removal
|
||||
this.removeMoney();
|
||||
return new ChallengeResult().setMeetsRequirements();
|
||||
} else {
|
||||
user.sendMessage("challenges.error.island-level", TextVariables.NUMBER, String.valueOf(challenge.getReqIslandlevel()));
|
||||
user.sendMessage("challenges.error.island-level", TextVariables.NUMBER, String.valueOf(challenge.getRequiredIslandLevel()));
|
||||
return new ChallengeResult();
|
||||
}
|
||||
}
|
||||
@ -428,7 +428,6 @@ public class TryToComplete {
|
||||
private boolean meetsRequirements;
|
||||
private boolean repeat;
|
||||
/**
|
||||
* @param meetsRequirements the meetsRequirements to set
|
||||
*/
|
||||
public ChallengeResult setMeetsRequirements() {
|
||||
this.meetsRequirements = true;
|
||||
|
@ -102,7 +102,7 @@ public class EditChallengeGUI extends CommonGUI
|
||||
case ISLAND:
|
||||
this.buildIslandRequirementsPanel(panelBuilder);
|
||||
break;
|
||||
case LEVEL:
|
||||
case OTHER:
|
||||
this.buildOtherRequirementsPanel(panelBuilder);
|
||||
break;
|
||||
}
|
||||
@ -320,7 +320,7 @@ public class EditChallengeGUI extends CommonGUI
|
||||
{
|
||||
icon = new ItemStack(Material.CHEST);
|
||||
}
|
||||
else if (this.challenge.getChallengeType().equals(Challenge.ChallengeType.LEVEL))
|
||||
else if (this.challenge.getChallengeType().equals(Challenge.ChallengeType.OTHER))
|
||||
{
|
||||
icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
||||
}
|
||||
@ -427,13 +427,13 @@ public class EditChallengeGUI extends CommonGUI
|
||||
description = Collections.singletonList(
|
||||
this.user.getTranslation("challenges.gui.admin.descriptions.order",
|
||||
"[value]",
|
||||
Integer.toString(this.challenge.getSlot())));
|
||||
Integer.toString(this.challenge.getOrder())));
|
||||
icon = new ItemStack(Material.DROPPER);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new NumberGUI(this.user, this.challenge.getSlot(), -1, 54, (status, value) -> {
|
||||
new NumberGUI(this.user, this.challenge.getOrder(), -1, 54, (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challenge.setSlot(value);
|
||||
this.challenge.setOrder(value);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -640,13 +640,13 @@ public class EditChallengeGUI extends CommonGUI
|
||||
case REQUIRED_PERMISSIONS:
|
||||
{
|
||||
name = this.user.getTranslation("challenges.gui.admin.buttons.permissions");
|
||||
description = new ArrayList<>(this.challenge.getReqPerms());
|
||||
description = new ArrayList<>(this.challenge.getRequiredPermissions());
|
||||
icon = new ItemStack(Material.REDSTONE_LAMP);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new StringListGUI(this.user, this.challenge.getReqPerms(), (status, value) -> {
|
||||
new StringListGUI(this.user, this.challenge.getRequiredPermissions(), (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challenge.setReqPerms(new HashSet<>(value));
|
||||
this.challenge.setRequiredPermissions(new HashSet<>(value));
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -713,13 +713,13 @@ public class EditChallengeGUI extends CommonGUI
|
||||
description = Collections.singletonList(
|
||||
this.user.getTranslation("challenges.gui.admin.descriptions.required-exp",
|
||||
"[value]",
|
||||
Integer.toString(this.challenge.getMaxTimes())));
|
||||
Integer.toString(this.challenge.getRequiredExperience())));
|
||||
icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new NumberGUI(this.user, this.challenge.getReqExp(), 0, (status, value) -> {
|
||||
new NumberGUI(this.user, this.challenge.getRequiredExperience(), 0, (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challenge.setReqExp(value);
|
||||
this.challenge.setRequiredExperience(value);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -758,13 +758,13 @@ public class EditChallengeGUI extends CommonGUI
|
||||
description = Collections.singletonList(
|
||||
this.user.getTranslation("challenges.gui.admin.descriptions.required-level",
|
||||
"[value]",
|
||||
Long.toString(this.challenge.getReqIslandlevel())));
|
||||
Long.toString(this.challenge.getRequiredIslandLevel())));
|
||||
icon = new ItemStack(Material.BEACON);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new NumberGUI(this.user, (int) this.challenge.getReqIslandlevel(), (status, value) -> {
|
||||
new NumberGUI(this.user, (int) this.challenge.getRequiredIslandLevel(), (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challenge.setReqIslandlevel(value);
|
||||
this.challenge.setRequiredIslandLevel(value);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -781,13 +781,13 @@ public class EditChallengeGUI extends CommonGUI
|
||||
description = Collections.singletonList(
|
||||
this.user.getTranslation("challenges.gui.admin.descriptions.required-money",
|
||||
"[value]",
|
||||
Integer.toString(this.challenge.getReqMoney())));
|
||||
Integer.toString(this.challenge.getRequiredMoney())));
|
||||
icon = new ItemStack(Material.GOLD_INGOT);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new NumberGUI(this.user, this.challenge.getReqMoney(), 0, (status, value) -> {
|
||||
new NumberGUI(this.user, this.challenge.getRequiredMoney(), 0, (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challenge.setReqMoney(value);
|
||||
this.challenge.setRequiredMoney(value);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -874,13 +874,13 @@ public class EditChallengeGUI extends CommonGUI
|
||||
description = Collections.singletonList(
|
||||
this.user.getTranslation("challenges.gui.admin.descriptions.reward-exp",
|
||||
"[value]",
|
||||
Integer.toString(this.challenge.getRewardExp())));
|
||||
Integer.toString(this.challenge.getRewardExperience())));
|
||||
icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new NumberGUI(this.user, this.challenge.getReqExp(), 0, (status, value) -> {
|
||||
new NumberGUI(this.user, this.challenge.getRewardExperience(), 0, (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challenge.setRewardExp(value);
|
||||
this.challenge.setRewardExperience(value);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -1035,13 +1035,13 @@ public class EditChallengeGUI extends CommonGUI
|
||||
description = Collections.singletonList(
|
||||
this.user.getTranslation("challenges.gui.admin.descriptions.repeat-reward-exp",
|
||||
"[value]",
|
||||
Integer.toString(this.challenge.getRepeatExpReward())));
|
||||
Integer.toString(this.challenge.getRepeatExperienceReward())));
|
||||
icon = new ItemStack(Material.GLASS_BOTTLE);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new NumberGUI(this.user, this.challenge.getRepeatExpReward(), 0, (status, value) -> {
|
||||
new NumberGUI(this.user, this.challenge.getRepeatExperienceReward(), 0, (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challenge.setRepeatExpReward(value);
|
||||
this.challenge.setRepeatExperienceReward(value);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -1234,4 +1234,4 @@ public class EditChallengeGUI extends CommonGUI
|
||||
* Variable holds current active menu.
|
||||
*/
|
||||
private MenuType currentMenuType;
|
||||
}
|
||||
}
|
@ -398,13 +398,13 @@ public class EditLevelGUI extends CommonGUI
|
||||
description = Collections.singletonList(
|
||||
this.user.getTranslation("challenges.gui.admin.descriptions.waiver-amount",
|
||||
"[value]",
|
||||
Integer.toString(this.challengeLevel.getWaiveramount())));
|
||||
Integer.toString(this.challengeLevel.getWaiverAmount())));
|
||||
icon = new ItemStack(Material.REDSTONE_TORCH);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new NumberGUI(this.user, this.challengeLevel.getWaiveramount(), 0, (status, value) -> {
|
||||
new NumberGUI(this.user, this.challengeLevel.getWaiverAmount(), 0, (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challengeLevel.setWaiveramount(value);
|
||||
this.challengeLevel.setWaiverAmount(value);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -419,14 +419,14 @@ public class EditLevelGUI extends CommonGUI
|
||||
case REWARD_DESCRIPTION:
|
||||
{
|
||||
name = this.user.getTranslation("challenges.gui.admin.buttons.reward-text");
|
||||
description = Collections.singletonList(this.challengeLevel.getRewardDescription());
|
||||
description = Collections.singletonList(this.challengeLevel.getRewardText());
|
||||
icon = new ItemStack(Material.WRITTEN_BOOK);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new AnvilGUI(this.addon.getPlugin(),
|
||||
this.user.getPlayer(),
|
||||
this.challengeLevel.getRewardDescription(),
|
||||
this.challengeLevel.getRewardText(),
|
||||
(player, reply) -> {
|
||||
this.challengeLevel.setRewardDescription(reply);
|
||||
this.challengeLevel.setRewardText(reply);
|
||||
this.build();
|
||||
return reply;
|
||||
});
|
||||
@ -468,13 +468,13 @@ public class EditLevelGUI extends CommonGUI
|
||||
description = Collections.singletonList(
|
||||
this.user.getTranslation("challenges.gui.admin.descriptions.reward-exp",
|
||||
"[value]",
|
||||
Integer.toString(this.challengeLevel.getExpReward())));
|
||||
Integer.toString(this.challengeLevel.getRewardExperience())));
|
||||
icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new NumberGUI(this.user, this.challengeLevel.getExpReward(), 0, (status, value) -> {
|
||||
new NumberGUI(this.user, this.challengeLevel.getRewardExperience(), 0, (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challengeLevel.setExpReward(value);
|
||||
this.challengeLevel.setRewardExperience(value);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -491,13 +491,13 @@ public class EditLevelGUI extends CommonGUI
|
||||
description = Collections.singletonList(
|
||||
this.user.getTranslation("challenges.gui.admin.descriptions.reward-money",
|
||||
"[value]",
|
||||
Integer.toString(this.challengeLevel.getMoneyReward())));
|
||||
Integer.toString(this.challengeLevel.getRewardMoney())));
|
||||
icon = new ItemStack(Material.GOLD_INGOT);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
new NumberGUI(this.user, this.challengeLevel.getMoneyReward(), 0, (status, value) -> {
|
||||
new NumberGUI(this.user, this.challengeLevel.getRewardMoney(), 0, (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
this.challengeLevel.setMoneyReward(value);
|
||||
this.challengeLevel.setRewardMoney(value);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -544,7 +544,7 @@ public class EditLevelGUI extends CommonGUI
|
||||
new SelectChallengeGUI(this.user, challengeList, (status, value) -> {
|
||||
if (status)
|
||||
{
|
||||
manager.linkChallenge(this.challengeLevel, value);
|
||||
manager.addChallengeToLevel(value, this.challengeLevel);
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -636,4 +636,4 @@ public class EditLevelGUI extends CommonGUI
|
||||
* Variable holds current active menu.
|
||||
*/
|
||||
private MenuType currentMenuType;
|
||||
}
|
||||
}
|
@ -443,13 +443,13 @@ public class ChallengesGUI extends CommonGUI
|
||||
{
|
||||
rewardText = challenge.getRewardText();
|
||||
rewardMoney = challenge.getRewardMoney();
|
||||
rewardExperience = challenge.getRewardExp();
|
||||
rewardExperience = challenge.getRewardExperience();
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardText = challenge.getRepeatRewardText();
|
||||
rewardMoney = challenge.getRepeatMoneyReward();
|
||||
rewardExperience = challenge.getRepeatExpReward();
|
||||
rewardExperience = challenge.getRepeatExperienceReward();
|
||||
}
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user