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 (config.contains("quests." + questKey + ".rewards.commands")) {
if (Quests.checkList(config.getList("quests." + questKey + ".rewards.commands"), String.class)) { 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 { } else {
skipQuestProcess("commands: Reward in Quest " + quest.getName() + " is not a list of commands!"); skipQuestProcess("commands: Reward in Quest " + quest.getName() + " is not a list of commands!");
} }
} }
if (config.contains("quests." + questKey + ".rewards.permissions")) { if (config.contains("quests." + questKey + ".rewards.permissions")) {
if (Quests.checkList(config.getList("quests." + questKey + ".rewards.permissions"), String.class)) { 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 { } else {
skipQuestProcess("permissions: Reward in Quest " + quest.getName() + " is not a list of permissions!"); 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!"); 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.setMcmmoSkills((LinkedList<String>) config.getStringList("quests." + questKey + ".rewards.mcmmo-skills"));
rews.setMcmmoAmounts(config.getIntegerList("quests." + questKey + ".rewards.mcmmo-levels")); rews.setMcmmoAmounts((LinkedList<Integer>) config.getIntegerList("quests." + questKey + ".rewards.mcmmo-levels"));
} else { } else {
skipQuestProcess("mcmmo-levels: Reward in Quest " + quest.getName() + " is not a list of numbers!"); 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!"); 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.setHeroesClasses((LinkedList<String>) config.getStringList("quests." + questKey + ".rewards.heroes-exp-classes"));
rews.setHeroesAmounts(config.getDoubleList("quests." + questKey + ".rewards.heroes-exp-amounts")); rews.setHeroesAmounts((LinkedList<Double>) config.getDoubleList("quests." + questKey + ".rewards.heroes-exp-amounts"));
} else { } else {
skipQuestProcess("heroes-exp-amounts: Reward in Quest " + quest.getName() + " is not a list of experience amounts (decimal numbers)!"); 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!"); 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 { } else {
skipQuestProcess("phat-loots: Reward in Quest " + quest.getName() + " is not a list of PhatLoots!"); 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); return hero.getHeroClass().getName().equalsIgnoreCase(primaryClass);
} }
@SuppressWarnings("deprecation")
public boolean testSecondaryHeroesClass(String secondaryClass, UUID uuid) { public boolean testSecondaryHeroesClass(String secondaryClass, UUID uuid) {
Hero hero = getHero(uuid); Hero hero = getHero(uuid);
return hero.getSecondClass().getName().equalsIgnoreCase(secondaryClass); return hero.getSecondClass().getName().equalsIgnoreCase(secondaryClass);

View File

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