Update block variable names

This commit is contained in:
PikaMug 2019-07-01 14:10:34 -04:00
parent 8f0fa2525c
commit 9015571680
2 changed files with 75 additions and 75 deletions

View File

@ -984,19 +984,19 @@ public class QuestFactory implements ConversationAbandonedListener {
ConfigurationSection stages = cs.createSection("stages"); ConfigurationSection stages = cs.createSection("stages");
ConfigurationSection ordered = stages.createSection("ordered"); ConfigurationSection ordered = stages.createSection("ordered");
String pref; String pref;
LinkedList<Integer> breakIds; LinkedList<Integer> breakNames;
LinkedList<Integer> breakAmounts; LinkedList<Integer> breakAmounts;
LinkedList<Short> breakDurability; LinkedList<Short> breakDurability;
LinkedList<Integer> damageIds; LinkedList<Integer> damageNames;
LinkedList<Integer> damageAmounts; LinkedList<Integer> damageAmounts;
LinkedList<Short> damageDurability; LinkedList<Short> damageDurability;
LinkedList<Integer> placeIds; LinkedList<Integer> placeNames;
LinkedList<Integer> placeAmounts; LinkedList<Integer> placeAmounts;
LinkedList<Short> placeDurability; LinkedList<Short> placeDurability;
LinkedList<Integer> useIds; LinkedList<Integer> useNames;
LinkedList<Integer> useAmounts; LinkedList<Integer> useAmounts;
LinkedList<Short> useDurability; LinkedList<Short> useDurability;
LinkedList<Integer> cutIds; LinkedList<Integer> cutNames;
LinkedList<Integer> cutAmounts; LinkedList<Integer> cutAmounts;
LinkedList<Short> cutDurability; LinkedList<Short> cutDurability;
LinkedList<ItemStack> deliveryItems; LinkedList<ItemStack> deliveryItems;
@ -1046,19 +1046,19 @@ public class QuestFactory implements ConversationAbandonedListener {
for (int i = 1; i <= StagesPrompt.getStages(cc); i++) { for (int i = 1; i <= StagesPrompt.getStages(cc); i++) {
pref = "stage" + i; pref = "stage" + i;
ConfigurationSection stage = ordered.createSection("" + i); ConfigurationSection stage = ordered.createSection("" + i);
breakIds = null; breakNames = null;
breakAmounts = null; breakAmounts = null;
breakDurability = null; breakDurability = null;
damageIds = null; damageNames = null;
damageAmounts = null; damageAmounts = null;
damageDurability = null; damageDurability = null;
placeIds = null; placeNames = null;
placeAmounts = null; placeAmounts = null;
placeDurability = null; placeDurability = null;
useIds = null; useNames = null;
useAmounts = null; useAmounts = null;
useDurability = null; useDurability = null;
cutIds = null; cutNames = null;
cutAmounts = null; cutAmounts = null;
cutDurability = null; cutDurability = null;
craftItems = null; craftItems = null;
@ -1106,27 +1106,27 @@ public class QuestFactory implements ConversationAbandonedListener {
startMessage = null; startMessage = null;
completeMessage = null; completeMessage = null;
if (cc.getSessionData(pref + CK.S_BREAK_NAMES) != null) { if (cc.getSessionData(pref + CK.S_BREAK_NAMES) != null) {
breakIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_NAMES); breakNames = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_NAMES);
breakAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_AMOUNTS); breakAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_AMOUNTS);
breakDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_BREAK_DURABILITY); breakDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_BREAK_DURABILITY);
} }
if (cc.getSessionData(pref + CK.S_DAMAGE_NAMES) != null) { if (cc.getSessionData(pref + CK.S_DAMAGE_NAMES) != null) {
damageIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_NAMES); damageNames = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_NAMES);
damageAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS); damageAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS);
damageDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_DAMAGE_DURABILITY); damageDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
} }
if (cc.getSessionData(pref + CK.S_PLACE_NAMES) != null) { if (cc.getSessionData(pref + CK.S_PLACE_NAMES) != null) {
placeIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_NAMES); placeNames = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_NAMES);
placeAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_AMOUNTS); placeAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_AMOUNTS);
placeDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_PLACE_DURABILITY); placeDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_PLACE_DURABILITY);
} }
if (cc.getSessionData(pref + CK.S_USE_NAMES) != null) { if (cc.getSessionData(pref + CK.S_USE_NAMES) != null) {
useIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_NAMES); useNames = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_NAMES);
useAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_AMOUNTS); useAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_AMOUNTS);
useDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_USE_DURABILITY); useDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_USE_DURABILITY);
} }
if (cc.getSessionData(pref + CK.S_CUT_NAMES) != null) { if (cc.getSessionData(pref + CK.S_CUT_NAMES) != null) {
cutIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_NAMES); cutNames = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_NAMES);
cutAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_AMOUNTS); cutAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_AMOUNTS);
cutDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_CUT_DURABILITY); cutDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_CUT_DURABILITY);
} }
@ -1226,28 +1226,28 @@ public class QuestFactory implements ConversationAbandonedListener {
if (cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE) != null) { if (cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE) != null) {
completeMessage = (String) cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE); completeMessage = (String) cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE);
} }
if (breakIds != null && breakIds.isEmpty() == false) { if (breakNames != null && breakNames.isEmpty() == false) {
stage.set("break-block-names", breakIds); stage.set("break-block-names", breakNames);
stage.set("break-block-amounts", breakAmounts); stage.set("break-block-amounts", breakAmounts);
stage.set("break-block-durability", breakDurability); stage.set("break-block-durability", breakDurability);
} }
if (damageIds != null && damageIds.isEmpty() == false) { if (damageNames != null && damageNames.isEmpty() == false) {
stage.set("damage-block-names", damageIds); stage.set("damage-block-names", damageNames);
stage.set("damage-block-amounts", damageAmounts); stage.set("damage-block-amounts", damageAmounts);
stage.set("damage-block-durability", damageDurability); stage.set("damage-block-durability", damageDurability);
} }
if (placeIds != null && placeIds.isEmpty() == false) { if (placeNames != null && placeNames.isEmpty() == false) {
stage.set("place-block-names", placeIds); stage.set("place-block-names", placeNames);
stage.set("place-block-amounts", placeAmounts); stage.set("place-block-amounts", placeAmounts);
stage.set("place-block-durability", placeDurability); stage.set("place-block-durability", placeDurability);
} }
if (useIds != null && useIds.isEmpty() == false) { if (useNames != null && useNames.isEmpty() == false) {
stage.set("use-block-names", useIds); stage.set("use-block-names", useNames);
stage.set("use-block-amounts", useAmounts); stage.set("use-block-amounts", useAmounts);
stage.set("use-block-durability", useDurability); stage.set("use-block-durability", useDurability);
} }
if (cutIds != null && cutIds.isEmpty() == false) { if (cutNames != null && cutNames.isEmpty() == false) {
stage.set("cut-block-names", cutIds); stage.set("cut-block-names", cutNames);
stage.set("cut-block-amounts", cutAmounts); stage.set("cut-block-amounts", cutAmounts);
stage.set("cut-block-durability", cutDurability); stage.set("cut-block-durability", cutDurability);
} }

View File

@ -1851,21 +1851,21 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
ConfigurationSection questStages = config.getConfigurationSection("quests." + questKey + ".stages.ordered"); ConfigurationSection questStages = config.getConfigurationSection("quests." + questKey + ".stages.ordered");
for (String s2 : questStages.getKeys(false)) { for (String s2 : questStages.getKeys(false)) {
Stage oStage = new Stage(); Stage oStage = new Stage();
List<String> breaknames = new LinkedList<String>(); List<String> breakNames = new LinkedList<String>();
List<Integer> breakamounts = new LinkedList<Integer>(); List<Integer> breakAmounts = new LinkedList<Integer>();
List<Short> breakdurability = new LinkedList<Short>(); List<Short> breakDurability = new LinkedList<Short>();
List<String> damagenames = new LinkedList<String>(); List<String> damageNames = new LinkedList<String>();
List<Integer> damageamounts = new LinkedList<Integer>(); List<Integer> damageAmounts = new LinkedList<Integer>();
List<Short> damagedurability = new LinkedList<Short>(); List<Short> damageDurability = new LinkedList<Short>();
List<String> placenames = new LinkedList<String>(); List<String> placeNames = new LinkedList<String>();
List<Integer> placeamounts = new LinkedList<Integer>(); List<Integer> placeAmounts = new LinkedList<Integer>();
List<Short> placedurability = new LinkedList<Short>(); List<Short> placeDurability = new LinkedList<Short>();
List<String> usenames = new LinkedList<String>(); List<String> useNames = new LinkedList<String>();
List<Integer> useamounts = new LinkedList<Integer>(); List<Integer> useAmounts = new LinkedList<Integer>();
List<Short> usedurability = new LinkedList<Short>(); List<Short> useDurability = new LinkedList<Short>();
List<String> cutnames = new LinkedList<String>(); List<String> cutNames = new LinkedList<String>();
List<Integer> cutamounts = new LinkedList<Integer>(); List<Integer> cutAmounts = new LinkedList<Integer>();
List<Short> cutdurability = new LinkedList<Short>(); List<Short> cutDurability = new LinkedList<Short>();
List<EntityType> mobsToKill = new LinkedList<EntityType>(); List<EntityType> mobsToKill = new LinkedList<EntityType>();
List<Integer> mobNumToKill = new LinkedList<Integer>(); List<Integer> mobNumToKill = new LinkedList<Integer>();
List<Location> locationsToKillWithin = new LinkedList<Location>(); List<Location> locationsToKillWithin = new LinkedList<Location>();
@ -1893,13 +1893,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names"), String.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names"), String.class)) {
breaknames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names"); breakNames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names");
} else { } else {
stageFailed("break-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!"); stageFailed("break-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!");
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".break-block-amounts")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".break-block-amounts")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-amounts"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-amounts"), Integer.class)) {
breakamounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-amounts"); breakAmounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-amounts");
} else { } else {
stageFailed("break-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("break-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -1908,7 +1908,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".break-block-durability")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".break-block-durability")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-durability"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-durability"), Integer.class)) {
breakdurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-durability"); breakDurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-durability");
} else { } else {
stageFailed("break-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("break-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -1917,13 +1917,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
} }
int breakIndex = 0; int breakIndex = 0;
for (String s : breaknames) { for (String s : breakNames) {
ItemStack is; ItemStack is;
if (breakdurability.get(breakIndex) != -1) { if (breakDurability.get(breakIndex) != -1) {
is = ItemUtil.processItemStack(s, breakamounts.get(breakIndex), breakdurability.get(breakIndex)); is = ItemUtil.processItemStack(s, breakAmounts.get(breakIndex), breakDurability.get(breakIndex));
} else { } else {
// Legacy // Legacy
is = ItemUtil.processItemStack(s, breakamounts.get(breakIndex), (short) 0); is = ItemUtil.processItemStack(s, breakAmounts.get(breakIndex), (short) 0);
} }
if (Material.matchMaterial(s) != null) { if (Material.matchMaterial(s) != null) {
oStage.blocksToBreak.add(is); oStage.blocksToBreak.add(is);
@ -1934,13 +1934,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-names")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-names")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-names"), String.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-names"), String.class)) {
damagenames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-names"); damageNames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-names");
} else { } else {
stageFailed("damage-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!"); stageFailed("damage-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!");
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-amounts")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-amounts")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-amounts"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-amounts"), Integer.class)) {
damageamounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-amounts"); damageAmounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-amounts");
} else { } else {
stageFailed("damage-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("damage-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -1949,7 +1949,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-durability")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-durability")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-durability"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-durability"), Integer.class)) {
damagedurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-durability"); damageDurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".damage-block-durability");
} else { } else {
stageFailed("damage-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("damage-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -1958,13 +1958,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
} }
int damageIndex = 0; int damageIndex = 0;
for (String s : damagenames) { for (String s : damageNames) {
ItemStack is; ItemStack is;
if (damagedurability.get(damageIndex) != -1) { if (damageDurability.get(damageIndex) != -1) {
is = ItemUtil.processItemStack(s, damageamounts.get(damageIndex), damagedurability.get(damageIndex)); is = ItemUtil.processItemStack(s, damageAmounts.get(damageIndex), damageDurability.get(damageIndex));
} else { } else {
// Legacy // Legacy
is = ItemUtil.processItemStack(s, damageamounts.get(damageIndex), (short) 0); is = ItemUtil.processItemStack(s, damageAmounts.get(damageIndex), (short) 0);
} }
if (Material.matchMaterial(s) != null) { if (Material.matchMaterial(s) != null) {
oStage.blocksToDamage.add(is); oStage.blocksToDamage.add(is);
@ -1975,13 +1975,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".place-block-names")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".place-block-names")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-names"), String.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-names"), String.class)) {
placenames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-names"); placeNames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-names");
} else { } else {
stageFailed("place-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!"); stageFailed("place-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!");
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".place-block-amounts")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".place-block-amounts")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-amounts"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-amounts"), Integer.class)) {
placeamounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-amounts"); placeAmounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-amounts");
} else { } else {
stageFailed("place-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("place-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -1990,7 +1990,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".place-block-durability")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".place-block-durability")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-durability"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-durability"), Integer.class)) {
placedurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-durability"); placeDurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".place-block-durability");
} else { } else {
stageFailed("place-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("place-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -1999,13 +1999,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
} }
int placeIndex = 0; int placeIndex = 0;
for (String s : placenames) { for (String s : placeNames) {
ItemStack is; ItemStack is;
if (placedurability.get(placeIndex) != -1) { if (placeDurability.get(placeIndex) != -1) {
is = ItemUtil.processItemStack(s, placeamounts.get(placeIndex), placedurability.get(placeIndex)); is = ItemUtil.processItemStack(s, placeAmounts.get(placeIndex), placeDurability.get(placeIndex));
} else { } else {
// Legacy // Legacy
is = ItemUtil.processItemStack(s, placeamounts.get(placeIndex), (short) 0); is = ItemUtil.processItemStack(s, placeAmounts.get(placeIndex), (short) 0);
} }
if (Material.matchMaterial(s) != null) { if (Material.matchMaterial(s) != null) {
oStage.blocksToPlace.add(is); oStage.blocksToPlace.add(is);
@ -2016,13 +2016,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".use-block-names")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".use-block-names")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-names"), String.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-names"), String.class)) {
usenames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-names"); useNames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-names");
} else { } else {
stageFailed("use-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!"); stageFailed("use-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!");
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".use-block-amounts")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".use-block-amounts")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-amounts"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-amounts"), Integer.class)) {
useamounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-amounts"); useAmounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-amounts");
} else { } else {
stageFailed("use-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("use-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -2031,7 +2031,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".use-block-durability")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".use-block-durability")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-durability"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-durability"), Integer.class)) {
usedurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-durability"); useDurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".use-block-durability");
} else { } else {
stageFailed("use-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("use-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -2040,13 +2040,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
} }
int useIndex = 0; int useIndex = 0;
for (String s : usenames) { for (String s : useNames) {
ItemStack is; ItemStack is;
if (usedurability.get(useIndex) != -1) { if (useDurability.get(useIndex) != -1) {
is = ItemUtil.processItemStack(s, useamounts.get(useIndex), usedurability.get(useIndex)); is = ItemUtil.processItemStack(s, useAmounts.get(useIndex), useDurability.get(useIndex));
} else { } else {
// Legacy // Legacy
is = ItemUtil.processItemStack(s, useamounts.get(useIndex), (short) 0); is = ItemUtil.processItemStack(s, useAmounts.get(useIndex), (short) 0);
} }
if (Material.matchMaterial(s) != null) { if (Material.matchMaterial(s) != null) {
oStage.blocksToUse.add(is); oStage.blocksToUse.add(is);
@ -2057,13 +2057,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-names")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-names")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-names"), String.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-names"), String.class)) {
cutnames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-names"); cutNames = config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-names");
} else { } else {
stageFailed("cut-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!"); stageFailed("cut-block-names: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of strings!");
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-amounts")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-amounts")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-amounts"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-amounts"), Integer.class)) {
cutamounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-amounts"); cutAmounts = config.getIntegerList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-amounts");
} else { } else {
stageFailed("cut-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("cut-block-amounts: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -2072,7 +2072,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-durability")) { if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-durability")) {
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-durability"), Integer.class)) { if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-durability"), Integer.class)) {
cutdurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-durability"); cutDurability = config.getShortList("quests." + questKey + ".stages.ordered." + s2 + ".cut-block-durability");
} else { } else {
stageFailed("cut-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!"); stageFailed("cut-block-durability: in Stage " + s2 + " of Quest " + quest.getName() + " is not a list of numbers!");
} }
@ -2081,13 +2081,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
} }
int cutIndex = 0; int cutIndex = 0;
for (String s : cutnames) { for (String s : cutNames) {
ItemStack is; ItemStack is;
if (cutdurability.get(cutIndex) != -1) { if (cutDurability.get(cutIndex) != -1) {
is = ItemUtil.processItemStack(s, cutamounts.get(cutIndex), cutdurability.get(cutIndex)); is = ItemUtil.processItemStack(s, cutAmounts.get(cutIndex), cutDurability.get(cutIndex));
} else { } else {
// Legacy // Legacy
is = ItemUtil.processItemStack(s, cutamounts.get(cutIndex), (short) 0); is = ItemUtil.processItemStack(s, cutAmounts.get(cutIndex), (short) 0);
} }
if (Material.matchMaterial(s) != null) { if (Material.matchMaterial(s) != null) {
oStage.blocksToCut.add(is); oStage.blocksToCut.add(is);