Load some rewards as LinkedList, may fix #641

This commit is contained in:
BuildTools 2019-01-16 23:13:38 -05:00
parent ef5f297928
commit 070da2d24a
2 changed files with 22 additions and 22 deletions

View File

@ -922,14 +922,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
if (config.contains("quests." + questKey + ".rewards.commands")) {
if (Quests.checkList(config.getList("quests." + questKey + ".rewards.commands"), String.class)) {
rews.setCommands(config.getStringList("quests." + questKey + ".rewards.commands"));
rews.setCommands((LinkedList<String>) config.getStringList("quests." + questKey + ".rewards.commands"));
} else {
skipQuestProcess("commands: Reward in Quest " + quest.getName() + " is not a list of commands!");
}
}
if (config.contains("quests." + questKey + ".rewards.permissions")) {
if (Quests.checkList(config.getList("quests." + questKey + ".rewards.permissions"), String.class)) {
rews.setPermissions(config.getStringList("quests." + questKey + ".rewards.permissions"));
rews.setPermissions((LinkedList<String>) config.getStringList("quests." + questKey + ".rewards.permissions"));
} else {
skipQuestProcess("permissions: Reward in Quest " + quest.getName() + " is not a list of permissions!");
}
@ -953,8 +954,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
skipQuestProcess("" + skill + " in mcmmo-skills: Reward in Quest " + quest.getName() + " is not a valid mcMMO skill name!");
}
}
rews.setMcmmoSkills(config.getStringList("quests." + questKey + ".rewards.mcmmo-skills"));
rews.setMcmmoAmounts(config.getIntegerList("quests." + questKey + ".rewards.mcmmo-levels"));
rews.setMcmmoSkills((LinkedList<String>) config.getStringList("quests." + questKey + ".rewards.mcmmo-skills"));
rews.setMcmmoAmounts((LinkedList<Integer>) config.getIntegerList("quests." + questKey + ".rewards.mcmmo-levels"));
} else {
skipQuestProcess("mcmmo-levels: Reward in Quest " + quest.getName() + " is not a list of numbers!");
}
@ -978,8 +979,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
skipQuestProcess("" + heroClass + " in heroes-exp-classes: Reward in Quest " + quest.getName() + " is not a valid Heroes class name!");
}
}
rews.setHeroesClasses(config.getStringList("quests." + questKey + ".rewards.heroes-exp-classes"));
rews.setHeroesAmounts(config.getDoubleList("quests." + questKey + ".rewards.heroes-exp-amounts"));
rews.setHeroesClasses((LinkedList<String>) config.getStringList("quests." + questKey + ".rewards.heroes-exp-classes"));
rews.setHeroesAmounts((LinkedList<Double>) config.getDoubleList("quests." + questKey + ".rewards.heroes-exp-amounts"));
} else {
skipQuestProcess("heroes-exp-amounts: Reward in Quest " + quest.getName() + " is not a list of experience amounts (decimal numbers)!");
}
@ -1001,7 +1002,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
skipQuestProcess("" + loot + " in phat-loots: Reward in Quest " + quest.getName() + " is not a valid PhatLoot name!");
}
}
rews.setPhatLoots(config.getStringList("quests." + questKey + ".rewards.phat-loots"));
rews.setPhatLoots((LinkedList<String>) config.getStringList("quests." + questKey + ".rewards.phat-loots"));
} else {
skipQuestProcess("phat-loots: Reward in Quest " + quest.getName() + " is not a list of PhatLoots!");
}
@ -2653,7 +2654,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return hero.getHeroClass().getName().equalsIgnoreCase(primaryClass);
}
@SuppressWarnings("deprecation")
public boolean testSecondaryHeroesClass(String secondaryClass, UUID uuid) {
Hero hero = getHero(uuid);
return hero.getSecondClass().getName().equalsIgnoreCase(secondaryClass);

View File

@ -23,14 +23,14 @@ public class Rewards {
private int money = 0;
private int questPoints = 0;
private int exp = 0;
private List<String> commands = new LinkedList<String>();
private List<String> permissions = new LinkedList<String>();
private LinkedList<String> commands = new LinkedList<String>();
private LinkedList<String> permissions = new LinkedList<String>();
private LinkedList<ItemStack> items = new LinkedList<ItemStack>();
private List<String> mcmmoSkills = new LinkedList<String>();
private List<Integer> mcmmoAmounts = new LinkedList<Integer>();
private List<String> heroesClasses = new LinkedList<String>();
private List<Double> heroesAmounts = new LinkedList<Double>();
private List<String> phatLoots = new LinkedList<String>();
private LinkedList<String> mcmmoSkills = new LinkedList<String>();
private LinkedList<Integer> mcmmoAmounts = new LinkedList<Integer>();
private LinkedList<String> heroesClasses = new LinkedList<String>();
private LinkedList<Double> heroesAmounts = new LinkedList<Double>();
private LinkedList<String> phatLoots = new LinkedList<String>();
private Map<String, Map<String, Object>> customRewards = new HashMap<String, Map<String, Object>>();
public int getMoney() {
@ -54,13 +54,13 @@ public class Rewards {
public List<String> getCommands() {
return commands;
}
public void setCommands(List<String> commands) {
public void setCommands(LinkedList<String> commands) {
this.commands = commands;
}
public List<String> getPermissions() {
return permissions;
}
public void setPermissions(List<String> permissions) {
public void setPermissions(LinkedList<String> permissions) {
this.permissions = permissions;
}
public LinkedList<ItemStack> getItems() {
@ -72,31 +72,31 @@ public class Rewards {
public List<String> getMcmmoSkills() {
return mcmmoSkills;
}
public void setMcmmoSkills(List<String> mcmmoSkills) {
public void setMcmmoSkills(LinkedList<String> mcmmoSkills) {
this.mcmmoSkills = mcmmoSkills;
}
public List<Integer> getMcmmoAmounts() {
return mcmmoAmounts;
}
public void setMcmmoAmounts(List<Integer> mcmmoAmounts) {
public void setMcmmoAmounts(LinkedList<Integer> mcmmoAmounts) {
this.mcmmoAmounts = mcmmoAmounts;
}
public List<String> getHeroesClasses() {
return heroesClasses;
}
public void setHeroesClasses(List<String> heroesClasses) {
public void setHeroesClasses(LinkedList<String> heroesClasses) {
this.heroesClasses = heroesClasses;
}
public List<Double> getHeroesAmounts() {
return heroesAmounts;
}
public void setHeroesAmounts(List<Double> heroesAmounts) {
public void setHeroesAmounts(LinkedList<Double> heroesAmounts) {
this.heroesAmounts = heroesAmounts;
}
public List<String> getPhatLoots() {
return phatLoots;
}
public void setPhatLoots(List<String> phatLoots) {
public void setPhatLoots(LinkedList<String> phatLoots) {
this.phatLoots = phatLoots;
}
public Map<String, Map<String, Object>> getCustomRewards() {