diff --git a/src/main/java/me/blackvein/quests/PlayerListener.java b/src/main/java/me/blackvein/quests/PlayerListener.java index 1b97799e7..b06880d02 100644 --- a/src/main/java/me/blackvein/quests/PlayerListener.java +++ b/src/main/java/me/blackvein/quests/PlayerListener.java @@ -235,56 +235,56 @@ public class PlayerListener implements Listener, ColorUtil { Block block = evt.getClickedBlock(); Location loc = block.getLocation(); plugin.questFactory.selectedBlockStarts.put(evt.getPlayer(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")"); + evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")"); } else if (plugin.eventFactory.selectedExplosionLocations.containsKey(evt.getPlayer())) { Block block = evt.getClickedBlock(); Location loc = block.getLocation(); plugin.eventFactory.selectedExplosionLocations.put(evt.getPlayer(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")"); + evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")"); } else if (plugin.eventFactory.selectedEffectLocations.containsKey(evt.getPlayer())) { Block block = evt.getClickedBlock(); Location loc = block.getLocation(); plugin.eventFactory.selectedEffectLocations.put(evt.getPlayer(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")"); + evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")"); } else if (plugin.eventFactory.selectedMobLocations.containsKey(evt.getPlayer())) { Block block = evt.getClickedBlock(); Location loc = block.getLocation(); plugin.eventFactory.selectedMobLocations.put(evt.getPlayer(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")"); + evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")"); } else if (plugin.eventFactory.selectedLightningLocations.containsKey(evt.getPlayer())) { Block block = evt.getClickedBlock(); Location loc = block.getLocation(); plugin.eventFactory.selectedLightningLocations.put(evt.getPlayer(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")"); + evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")"); } else if (plugin.eventFactory.selectedTeleportLocations.containsKey(evt.getPlayer())) { Block block = evt.getClickedBlock(); Location loc = block.getLocation(); plugin.eventFactory.selectedTeleportLocations.put(evt.getPlayer(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")"); + evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")"); } else if (plugin.questFactory.selectedKillLocations.containsKey(evt.getPlayer())) { Block block = evt.getClickedBlock(); Location loc = block.getLocation(); plugin.questFactory.selectedKillLocations.put(evt.getPlayer(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")"); + evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")"); } else if (plugin.questFactory.selectedReachLocations.containsKey(evt.getPlayer())) { Block block = evt.getClickedBlock(); Location loc = block.getLocation(); plugin.questFactory.selectedReachLocations.put(evt.getPlayer(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")"); + evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")"); } else if (player.isConversing() == false) { diff --git a/src/main/java/me/blackvein/quests/Quest.java b/src/main/java/me/blackvein/quests/Quest.java index a61a72fb2..73686cfa7 100644 --- a/src/main/java/me/blackvein/quests/Quest.java +++ b/src/main/java/me/blackvein/quests/Quest.java @@ -405,17 +405,17 @@ public class Quest { } else if (i.getDurability() != 0) { if (i.getEnchantments().isEmpty()) { - player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount()); + player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount()); } else { - player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem")); + player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem")); } } else { if (i.getEnchantments().isEmpty()) { - player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount()); + player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ChatColor.GRAY + " x " + i.getAmount()); } else { - player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem")); + player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem")); } } @@ -436,17 +436,17 @@ public class Quest { } else if (i.getDurability() != 0) { if (i.getEnchantments().isEmpty()) { - player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount()); + player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount()); } else { - player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem")); + player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem")); } } else { if (i.getEnchantments().isEmpty()) { - player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount()); + player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ChatColor.GRAY + " x " + i.getAmount()); } else { - player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem")); + player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem")); } } diff --git a/src/main/java/me/blackvein/quests/QuestData.java b/src/main/java/me/blackvein/quests/QuestData.java index 102aa0d75..91f6837b9 100644 --- a/src/main/java/me/blackvein/quests/QuestData.java +++ b/src/main/java/me/blackvein/quests/QuestData.java @@ -182,10 +182,10 @@ public class QuestData { }; - public Map potionsBrewed = new HashMap() { + public Map potionsBrewed = new HashMap() { @Override - public Integer put(Integer key, Integer val) { + public Integer put(String key, Integer val) { Integer data = super.put(key, val); if (doJournalUpdate) quester.updateJournal(); return data; @@ -205,7 +205,7 @@ public class QuestData { } @Override - public void putAll(Map m) { + public void putAll(Map m) { super.putAll(m); if (doJournalUpdate) quester.updateJournal(); } diff --git a/src/main/java/me/blackvein/quests/QuestFactory.java b/src/main/java/me/blackvein/quests/QuestFactory.java index f05f2fd88..b6ce9c36a 100644 --- a/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/src/main/java/me/blackvein/quests/QuestFactory.java @@ -12,13 +12,12 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import me.blackvein.quests.prompts.ItemStackPrompt; +import me.blackvein.quests.prompts.ItemStackPrompt; import me.blackvein.quests.prompts.RequirementsPrompt; import me.blackvein.quests.prompts.RewardsPrompt; import me.blackvein.quests.prompts.StagesPrompt; import me.blackvein.quests.util.CK; -import static me.blackvein.quests.util.ColorUtil.PURPLE; import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.Lang; import net.citizensnpcs.api.CitizensAPI; @@ -51,7 +50,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { ConversationFactory convoCreator; File questsFile; - @SuppressWarnings("LeakingThisInConstructor") + //TODO - @SuppressWarnings("LeakingThisInConstructor") public QuestFactory(Quests plugin) { quests = plugin; @@ -1085,7 +1084,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { } } - public static void saveQuest(ConversationContext cc, ConfigurationSection cs) { + @SuppressWarnings("unchecked") + public static void saveQuest(ConversationContext cc, ConfigurationSection cs) { String edit = null; if (cc.getSessionData(CK.ED_QUEST_EDIT) != null) { @@ -1459,28 +1459,28 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { startMessage = null; completeMessage = null; - if (cc.getSessionData(pref + CK.S_BREAK_IDS) != null) { - breakIds = (LinkedList) cc.getSessionData(pref + CK.S_BREAK_IDS); + if (cc.getSessionData(pref + CK.S_BREAK_NAMES) != null) { + breakIds = (LinkedList) cc.getSessionData(pref + CK.S_BREAK_NAMES); breakAmounts = (LinkedList) cc.getSessionData(pref + CK.S_BREAK_AMOUNTS); } - if (cc.getSessionData(pref + CK.S_DAMAGE_IDS) != null) { - damageIds = (LinkedList) cc.getSessionData(pref + CK.S_DAMAGE_IDS); + if (cc.getSessionData(pref + CK.S_DAMAGE_NAMES) != null) { + damageIds = (LinkedList) cc.getSessionData(pref + CK.S_DAMAGE_NAMES); damageAmounts = (LinkedList) cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS); } - if (cc.getSessionData(pref + CK.S_PLACE_IDS) != null) { - placeIds = (LinkedList) cc.getSessionData(pref + CK.S_PLACE_IDS); + if (cc.getSessionData(pref + CK.S_PLACE_NAMES) != null) { + placeIds = (LinkedList) cc.getSessionData(pref + CK.S_PLACE_NAMES); placeAmounts = (LinkedList) cc.getSessionData(pref + CK.S_PLACE_AMOUNTS); } - if (cc.getSessionData(pref + CK.S_USE_IDS) != null) { - useIds = (LinkedList) cc.getSessionData(pref + CK.S_USE_IDS); + if (cc.getSessionData(pref + CK.S_USE_NAMES) != null) { + useIds = (LinkedList) cc.getSessionData(pref + CK.S_USE_NAMES); useAmounts = (LinkedList) cc.getSessionData(pref + CK.S_USE_AMOUNTS); } - if (cc.getSessionData(pref + CK.S_CUT_IDS) != null) { - cutIds = (LinkedList) cc.getSessionData(pref + CK.S_CUT_IDS); + if (cc.getSessionData(pref + CK.S_CUT_NAMES) != null) { + cutIds = (LinkedList) cc.getSessionData(pref + CK.S_CUT_NAMES); cutAmounts = (LinkedList) cc.getSessionData(pref + CK.S_CUT_AMOUNTS); } @@ -1494,7 +1494,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (cc.getSessionData(pref + CK.S_ENCHANT_TYPES) != null) { enchantments = (LinkedList) cc.getSessionData(pref + CK.S_ENCHANT_TYPES); - enchantmentIds = (LinkedList) cc.getSessionData(pref + CK.S_ENCHANT_IDS); + enchantmentIds = (LinkedList) cc.getSessionData(pref + CK.S_ENCHANT_NAMES); enchantmentAmounts = (LinkedList) cc.getSessionData(pref + CK.S_ENCHANT_AMOUNTS); } @@ -1593,34 +1593,34 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { } if (breakIds != null && breakIds.isEmpty() == false) { - stage.set("break-block-ids", breakIds); + stage.set("break-block-names", breakIds); stage.set("break-block-amounts", breakAmounts); } if (damageIds != null && damageIds.isEmpty() == false) { - stage.set("damage-block-ids", damageIds); + stage.set("damage-block-names", damageIds); stage.set("damage-block-amounts", damageAmounts); } if (placeIds != null && placeIds.isEmpty() == false) { - stage.set("place-block-ids", placeIds); + stage.set("place-block-names", placeIds); stage.set("place-block-amounts", placeAmounts); } if (useIds != null && useIds.isEmpty() == false) { - stage.set("use-block-ids", useIds); + stage.set("use-block-names", useIds); stage.set("use-block-amounts", useAmounts); } if (cutIds != null && cutIds.isEmpty() == false) { - stage.set("cut-block-ids", cutIds); + stage.set("cut-block-names", cutIds); stage.set("cut-block-amounts", cutAmounts); } stage.set("fish-to-catch", fish); stage.set("players-to-kill", players); stage.set("enchantments", enchantments); - stage.set("enchantment-item-ids", enchantmentIds); + stage.set("enchantment-item-names", enchantmentIds); stage.set("enchantment-amounts", enchantmentAmounts); if (deliveryItems != null && deliveryItems.isEmpty() == false) { LinkedList items = new LinkedList(); @@ -1712,7 +1712,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { rews.set("commands", commandRews); rews.set("mcmmo-skills", mcMMOSkillRews); rews.set("mcmmo-levels", mcMMOSkillAmounts); - rews.set("rpgitem-ids", RPGItemRews); + rews.set("rpgitem-names", RPGItemRews); rews.set("rpgitem-amounts", RPGItemAmounts); rews.set("heroes-exp-classes", heroesClassRews); rews.set("heroes-exp-amounts", heroesExpRews); @@ -1881,85 +1881,85 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (stage.blocksToBreak != null) { - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); LinkedList amnts = new LinkedList(); for (Entry e : stage.blocksToBreak.entrySet()) { - ids.add(((Material) e.getKey()).getId()); + names.add(((Material) e.getKey()).name()); amnts.add((Integer) e.getValue()); } - cc.setSessionData(pref + CK.S_BREAK_IDS, ids); + cc.setSessionData(pref + CK.S_BREAK_NAMES, names); cc.setSessionData(pref + CK.S_BREAK_AMOUNTS, amnts); } if (stage.blocksToDamage != null) { - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); LinkedList amnts = new LinkedList(); for (Entry e : stage.blocksToDamage.entrySet()) { - ids.add(((Material) e.getKey()).getId()); + names.add(((Material) e.getKey()).name()); amnts.add((Integer) e.getValue()); } - cc.setSessionData(pref + CK.S_DAMAGE_IDS, ids); + cc.setSessionData(pref + CK.S_DAMAGE_NAMES, names); cc.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, amnts); } if (stage.blocksToPlace != null) { - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); LinkedList amnts = new LinkedList(); for (Entry e : stage.blocksToPlace.entrySet()) { - ids.add(((Material) e.getKey()).getId()); + names.add(((Material) e.getKey()).name()); amnts.add((Integer) e.getValue()); } - cc.setSessionData(pref + CK.S_PLACE_IDS, ids); + cc.setSessionData(pref + CK.S_PLACE_NAMES, names); cc.setSessionData(pref + CK.S_PLACE_AMOUNTS, amnts); } if (stage.blocksToUse != null) { - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); LinkedList amnts = new LinkedList(); for (Entry e : stage.blocksToUse.entrySet()) { - ids.add(((Material) e.getKey()).getId()); + names.add(((Material) e.getKey()).name()); amnts.add((Integer) e.getValue()); } - cc.setSessionData(pref + CK.S_USE_IDS, ids); + cc.setSessionData(pref + CK.S_USE_NAMES, names); cc.setSessionData(pref + CK.S_USE_AMOUNTS, amnts); } if (stage.blocksToCut != null) { - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); LinkedList amnts = new LinkedList(); for (Entry e : stage.blocksToCut.entrySet()) { - ids.add(((Material) e.getKey()).getId()); + names.add(((Material) e.getKey()).name()); amnts.add((Integer) e.getValue()); } - cc.setSessionData(pref + CK.S_CUT_IDS, ids); + cc.setSessionData(pref + CK.S_CUT_NAMES, names); cc.setSessionData(pref + CK.S_CUT_AMOUNTS, amnts); } @@ -1975,7 +1975,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (stage.itemsToEnchant.isEmpty() == false) { LinkedList enchants = new LinkedList(); - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); LinkedList amounts = new LinkedList(); for (Entry, Integer> e : stage.itemsToEnchant.entrySet()) { @@ -1983,7 +1983,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { amounts.add(e.getValue()); for (Entry e2 : e.getKey().entrySet()) { - ids.add(e2.getValue().getId()); + names.add(e2.getValue().name()); enchants.add(Quester.prettyEnchantmentString(e2.getKey())); } @@ -1991,7 +1991,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { } cc.setSessionData(pref + CK.S_ENCHANT_TYPES, enchants); - cc.setSessionData(pref + CK.S_ENCHANT_IDS, ids); + cc.setSessionData(pref + CK.S_ENCHANT_NAMES, names); cc.setSessionData(pref + CK.S_ENCHANT_AMOUNTS, amounts); } diff --git a/src/main/java/me/blackvein/quests/Quester.java b/src/main/java/me/blackvein/quests/Quester.java index 8786e8764..1d3c4aa12 100644 --- a/src/main/java/me/blackvein/quests/Quester.java +++ b/src/main/java/me/blackvein/quests/Quester.java @@ -42,7 +42,9 @@ public class Quester { public String questToTake; public LinkedHashMap currentQuests = new LinkedHashMap() { - @Override + private static final long serialVersionUID = 6361484975823846780L; + + @Override public Integer put(Quest key, Integer val) { Integer data = super.put(key, val); updateJournal(); @@ -73,7 +75,9 @@ public class Quester { Quests plugin; public LinkedList completedQuests = new LinkedList() { - @Override + private static final long serialVersionUID = -269110128568487000L; + + @Override public boolean add(String e) { boolean b = super.add(e); updateJournal(); @@ -133,7 +137,9 @@ public class Quester { Map amountsCompleted = new HashMap() { - public void hardClear() { + private static final long serialVersionUID = 5475202358792520975L; + + public void hardClear() { super.clear(); } @@ -168,7 +174,9 @@ public class Quester { Map questData = new HashMap() { - @Override + private static final long serialVersionUID = -4607112433003926066L; + + @Override public QuestData put(Quest key, QuestData val) { QuestData data = super.put(key, val); updateJournal(); @@ -415,11 +423,11 @@ public class Quester { if (e2.getValue() < e.getValue()) { - unfinishedObjectives.add(ChatColor.GREEN + Lang.get("damage") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + unfinishedObjectives.add(ChatColor.GREEN + Lang.get("damage") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } else { - finishedObjectives.add(ChatColor.GRAY + Lang.get("damage") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + finishedObjectives.add(ChatColor.GRAY + Lang.get("damage") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } @@ -437,11 +445,11 @@ public class Quester { if (e2.getValue() < e.getValue()) { - unfinishedObjectives.add(ChatColor.GREEN + Lang.get("break") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + unfinishedObjectives.add(ChatColor.GREEN + Lang.get("break") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } else { - finishedObjectives.add(ChatColor.GRAY + Lang.get("break") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + finishedObjectives.add(ChatColor.GRAY + Lang.get("break") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } @@ -459,11 +467,11 @@ public class Quester { if (e2.getValue() < e.getValue()) { - unfinishedObjectives.add(ChatColor.GREEN + Lang.get("place") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + unfinishedObjectives.add(ChatColor.GREEN + Lang.get("place") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } else { - finishedObjectives.add(ChatColor.GRAY + Lang.get("place") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + finishedObjectives.add(ChatColor.GRAY + Lang.get("place") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } @@ -481,11 +489,11 @@ public class Quester { if (e2.getValue() < e.getValue()) { - unfinishedObjectives.add(ChatColor.GREEN + Lang.get("use") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + unfinishedObjectives.add(ChatColor.GREEN + Lang.get("use") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } else { - finishedObjectives.add(ChatColor.GRAY + Lang.get("use") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + finishedObjectives.add(ChatColor.GRAY + Lang.get("use") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } @@ -503,11 +511,11 @@ public class Quester { if (e2.getValue() < e.getValue()) { - unfinishedObjectives.add(ChatColor.GREEN + Lang.get("cut") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + unfinishedObjectives.add(ChatColor.GREEN + Lang.get("cut") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } else { - finishedObjectives.add(ChatColor.GRAY + Lang.get("cut") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue()); + finishedObjectives.add(ChatColor.GRAY + Lang.get("cut") + " " + Quester.prettyItemString(e2.getKey().name()) + ": " + e2.getValue() + "/" + e.getValue()); } @@ -576,14 +584,14 @@ public class Quester { if (num1 < num2) { String obj = Lang.get("enchantItem"); - obj = obj.replaceAll("", Quester.prettyItemString(mat.getId())); + obj = obj.replaceAll("", Quester.prettyItemString(mat.name())); obj = obj.replaceAll("", Quester.prettyEnchantmentString(enchantment)); unfinishedObjectives.add(ChatColor.GREEN + obj + ": " + num1 + "/" + num2); } else { String obj = Lang.get("enchantItem"); - obj = obj.replaceAll("", Quester.prettyItemString(mat.getId())); + obj = obj.replaceAll("", Quester.prettyItemString(mat.name())); obj = obj.replaceAll("", Quester.prettyEnchantmentString(enchantment)); finishedObjectives.add(ChatColor.GRAY + obj + ": " + num1 + "/" + num2); @@ -1350,7 +1358,7 @@ public class Quester { } else if (objective.equalsIgnoreCase("damageBlock")) { - String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("damage") + " " + prettyItemString(material.getId()); + String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("damage") + " " + prettyItemString(material.name()); message = message + " " + getCurrentStage(quest).blocksToDamage.get(material) + "/" + getCurrentStage(quest).blocksToDamage.get(material); p.sendMessage(message); if (testComplete(quest)) { @@ -1359,7 +1367,7 @@ public class Quester { } else if (objective.equalsIgnoreCase("breakBlock")) { - String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("break") + " " + prettyItemString(material.getId()); + String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("break") + " " + prettyItemString(material.name()); message = message + " " + getCurrentStage(quest).blocksToBreak.get(material) + "/" + getCurrentStage(quest).blocksToBreak.get(material); p.sendMessage(message); if (testComplete(quest)) { @@ -1368,7 +1376,7 @@ public class Quester { } else if (objective.equalsIgnoreCase("placeBlock")) { - String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("place") + " " + prettyItemString(material.getId()); + String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("place") + " " + prettyItemString(material.name()); message = message + " " + getCurrentStage(quest).blocksToPlace.get(material) + "/" + getCurrentStage(quest).blocksToPlace.get(material); p.sendMessage(message); if (testComplete(quest)) { @@ -1377,7 +1385,7 @@ public class Quester { } else if (objective.equalsIgnoreCase("useBlock")) { - String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("use") + " " + prettyItemString(material.getId()); + String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("use") + " " + prettyItemString(material.name()); message = message + " " + getCurrentStage(quest).blocksToUse.get(material) + "/" + getCurrentStage(quest).blocksToUse.get(material); p.sendMessage(message); if (testComplete(quest)) { @@ -1386,7 +1394,7 @@ public class Quester { } else if (objective.equalsIgnoreCase("cutBlock")) { - String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("cut") + " " + prettyItemString(material.getId()); + String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("cut") + " " + prettyItemString(material.name()); message = message + " " + getCurrentStage(quest).blocksToCut.get(material) + "/" + getCurrentStage(quest).blocksToCut.get(material); p.sendMessage(message); if (testComplete(quest)) { @@ -1405,7 +1413,7 @@ public class Quester { } else if (objective.equalsIgnoreCase("enchantItem")) { String obj = Lang.get("enchantItem"); - obj = obj.replaceAll("", prettyItemString(material.getId())); + obj = obj.replaceAll("", prettyItemString(material.name())); obj = obj.replaceAll("", Quester.prettyEnchantmentString(enchantment)); String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj; for (Map map : getCurrentStage(quest).itemsToEnchant.keySet()) { @@ -1850,8 +1858,8 @@ public class Quester { return capitalized; } - public static String prettyItemString(int itemID) { - String baseString = Material.getMaterial(itemID).toString(); + public static String prettyItemString(String itemName) { + String baseString = Material.getMaterial(itemName).toString(); String[] substrings = baseString.split("_"); String prettyString = ""; int size = 1; @@ -2070,75 +2078,75 @@ public class Quester { if (getQuestData(quest).blocksDamaged.isEmpty() == false) { - LinkedList blockIds = new LinkedList(); + LinkedList blockNames = new LinkedList(); LinkedList blockAmounts = new LinkedList(); for (Material m : getQuestData(quest).blocksDamaged.keySet()) { - blockIds.add(m.getId()); + blockNames.add(m.name()); blockAmounts.add(getQuestData(quest).blocksDamaged.get(m)); } - questSec.set("blocks-damaged-ids", blockIds); + questSec.set("blocks-damaged-names", blockNames); questSec.set("blocks-damaged-amounts", blockAmounts); } if (getQuestData(quest).blocksBroken.isEmpty() == false) { - LinkedList blockIds = new LinkedList(); + LinkedList blockNames = new LinkedList(); LinkedList blockAmounts = new LinkedList(); for (Material m : getQuestData(quest).blocksBroken.keySet()) { - blockIds.add(m.getId()); + blockNames.add(m.name()); blockAmounts.add(getQuestData(quest).blocksBroken.get(m)); } - questSec.set("blocks-broken-ids", blockIds); + questSec.set("blocks-broken-names", blockNames); questSec.set("blocks-broken-amounts", blockAmounts); } if (getQuestData(quest).blocksPlaced.isEmpty() == false) { - LinkedList blockIds = new LinkedList(); + LinkedList blockNames = new LinkedList(); LinkedList blockAmounts = new LinkedList(); for (Material m : getQuestData(quest).blocksPlaced.keySet()) { - blockIds.add(m.getId()); + blockNames.add(m.name()); blockAmounts.add(getQuestData(quest).blocksPlaced.get(m)); } - questSec.set("blocks-placed-ids", blockIds); + questSec.set("blocks-placed-names", blockNames); questSec.set("blocks-placed-amounts", blockAmounts); } if (getQuestData(quest).blocksUsed.isEmpty() == false) { - LinkedList blockIds = new LinkedList(); + LinkedList blockNames = new LinkedList(); LinkedList blockAmounts = new LinkedList(); for (Material m : getQuestData(quest).blocksUsed.keySet()) { - blockIds.add(m.getId()); + blockNames.add(m.name()); blockAmounts.add(getQuestData(quest).blocksUsed.get(m)); } - questSec.set("blocks-used-ids", blockIds); + questSec.set("blocks-used-names", blockNames); questSec.set("blocks-used-amounts", blockAmounts); } if (getQuestData(quest).blocksCut.isEmpty() == false) { - LinkedList blockIds = new LinkedList(); + LinkedList blockNames = new LinkedList(); LinkedList blockAmounts = new LinkedList(); for (Material m : getQuestData(quest).blocksCut.keySet()) { - blockIds.add(m.getId()); + blockNames.add(m.name()); blockAmounts.add(getQuestData(quest).blocksCut.get(m)); } - questSec.set("blocks-cut-ids", blockIds); + questSec.set("blocks-cut-names", blockNames); questSec.set("blocks-cut-amounts", blockAmounts); } @@ -2154,7 +2162,7 @@ public class Quester { if (getQuestData(quest).itemsEnchanted.isEmpty() == false) { LinkedList enchantments = new LinkedList(); - LinkedList itemIds = new LinkedList(); + LinkedList itemNames = new LinkedList(); LinkedList enchAmounts = new LinkedList(); for (Entry, Integer> e : getQuestData(quest).itemsEnchanted.entrySet()) { @@ -2164,14 +2172,14 @@ public class Quester { for (Entry e2 : enchMap.entrySet()) { enchantments.add(Quester.prettyEnchantmentString((Enchantment) e2.getKey())); - itemIds.add(((Material) e2.getValue()).getId()); + itemNames.add(((Material) e2.getValue()).name()); } } questSec.set("enchantments", enchantments); - questSec.set("enchantment-item-ids", itemIds); + questSec.set("enchantment-item-names", itemNames); questSec.set("times-enchanted", enchAmounts); } @@ -2293,17 +2301,17 @@ public class Quester { if (getQuestData(quest).potionsBrewed.isEmpty() == false) { - LinkedList potionIds = new LinkedList(); + LinkedList potionNames = new LinkedList(); LinkedList potionAmounts = new LinkedList(); - for (Entry entry : getQuestData(quest).potionsBrewed.entrySet()) { + for (Entry entry : getQuestData(quest).potionsBrewed.entrySet()) { - potionIds.add(entry.getKey()); + potionNames.add(entry.getKey()); potionAmounts.add(entry.getValue()); } - questSec.set("potions-brewed-ids", potionIds); + questSec.set("potions-brewed-names", potionNames); questSec.set("potions-brewed-amounts", potionAmounts); } @@ -2577,66 +2585,66 @@ public class Quester { addEmpties(quest); - if (questSec.contains("blocks-damaged-ids")) { + if (questSec.contains("blocks-damaged-names")) { - List ids = questSec.getIntegerList("blocks-damaged-ids"); + List names = questSec.getStringList("blocks-damaged-names"); List amounts = questSec.getIntegerList("blocks-damaged-amounts"); - for (int i : ids) { + for (String s : names) { - getQuestData(quest).blocksDamaged.put(Material.getMaterial(i), amounts.get(ids.indexOf(i))); + getQuestData(quest).blocksDamaged.put(Material.matchMaterial(s), amounts.get(names.indexOf(s))); } } - if (questSec.contains("blocks-broken-ids")) { + if (questSec.contains("blocks-broken-names")) { - List ids = questSec.getIntegerList("blocks-broken-ids"); + List names = questSec.getStringList("blocks-broken-names"); List amounts = questSec.getIntegerList("blocks-broken-amounts"); - for (int i : ids) { + for (String s : names) { - getQuestData(quest).blocksBroken.put(Material.getMaterial(i), amounts.get(ids.indexOf(i))); + getQuestData(quest).blocksBroken.put(Material.matchMaterial(s), amounts.get(names.indexOf(s))); } } - if (questSec.contains("blocks-placed-ids")) { + if (questSec.contains("blocks-placed-names")) { - List ids = questSec.getIntegerList("blocks-placed-ids"); + List names = questSec.getStringList("blocks-placed-names"); List amounts = questSec.getIntegerList("blocks-placed-amounts"); - for (int i : ids) { + for (String s : names) { - getQuestData(quest).blocksPlaced.put(Material.getMaterial(i), amounts.get(ids.indexOf(i))); + getQuestData(quest).blocksPlaced.put(Material.matchMaterial(s), amounts.get(names.indexOf(s))); } } - if (questSec.contains("blocks-used-ids")) { + if (questSec.contains("blocks-used-names")) { - List ids = questSec.getIntegerList("blocks-used-ids"); + List names = questSec.getStringList("blocks-used-names"); List amounts = questSec.getIntegerList("blocks-used-amounts"); - for (int i : ids) { + for (String s : names) { - getQuestData(quest).blocksUsed.put(Material.getMaterial(i), amounts.get(ids.indexOf(i))); + getQuestData(quest).blocksUsed.put(Material.matchMaterial(s), amounts.get(names.indexOf(s))); } } - if (questSec.contains("blocks-cut-ids")) { + if (questSec.contains("blocks-cut-names")) { - List ids = questSec.getIntegerList("blocks-cut-ids"); + List names = questSec.getStringList("blocks-cut-names"); List amounts = questSec.getIntegerList("blocks-cut-amounts"); - for (int i : ids) { + for (String s : names) { - getQuestData(quest).blocksCut.put(Material.getMaterial(i), amounts.get(ids.indexOf(i))); + getQuestData(quest).blocksCut.put(Material.matchMaterial(s), amounts.get(names.indexOf(s))); } @@ -2668,14 +2676,14 @@ public class Quester { LinkedList amounts = new LinkedList(); List enchantNames = questSec.getStringList("enchantments"); - List ids = questSec.getIntegerList("enchantment-item-ids"); + List names = questSec.getStringList("enchantment-item-names"); List times = questSec.getIntegerList("times-enchanted"); for (String s : enchantNames) { enchantments.add(Quests.getEnchantment(s)); - materials.add(Material.getMaterial(ids.get(enchantNames.indexOf(s)))); + materials.add(Material.matchMaterial(names.get(enchantNames.indexOf(s)))); amounts.add(times.get(enchantNames.indexOf(s))); } @@ -2819,14 +2827,14 @@ public class Quester { } - if (questSec.contains("potions-brewed-ids")) { + if (questSec.contains("potions-brewed-names")) { - List ids = questSec.getIntegerList("potions-brewed-ids"); + List names = questSec.getStringList("potions-brewed-names"); List amounts = questSec.getIntegerList("potions-brewed-amounts"); - for (int i : ids) { + for (String s : names) { - getQuestData(quest).potionsBrewed.put(i, amounts.get(ids.indexOf(i))); + getQuestData(quest).potionsBrewed.put(s, amounts.get(names.indexOf(s))); } @@ -2926,51 +2934,51 @@ public static ConfigurationSection getLegacyQuestData(FileConfiguration questSec ConfigurationSection newData = questSec.createSection("questData"); - if (questSec.contains("blocks-damaged-ids")) { + if (questSec.contains("blocks-damaged-names")) { - List ids = questSec.getIntegerList("blocks-damaged-ids"); + List names = questSec.getStringList("blocks-damaged-names"); List amounts = questSec.getIntegerList("blocks-damaged-amounts"); - newData.set(questName + ".blocks-damaged-ids", ids); + newData.set(questName + ".blocks-damaged-names", names); newData.set(questName + ".blocks-damaged-amounts", amounts); } - if (questSec.contains("blocks-broken-ids")) { + if (questSec.contains("blocks-broken-names")) { - List ids = questSec.getIntegerList("blocks-broken-ids"); + List names = questSec.getStringList("blocks-broken-names"); List amounts = questSec.getIntegerList("blocks-broken-amounts"); - newData.set(questName + ".blocks-broken-ids", ids); + newData.set(questName + ".blocks-broken-names", names); newData.set(questName + ".blocks-broken-amounts", amounts); } - if (questSec.contains("blocks-placed-ids")) { + if (questSec.contains("blocks-placed-names")) { - List ids = questSec.getIntegerList("blocks-placed-ids"); + List names = questSec.getStringList("blocks-placed-names"); List amounts = questSec.getIntegerList("blocks-placed-amounts"); - newData.set(questName + ".blocks-placed-ids", ids); + newData.set(questName + ".blocks-placed-names", names); newData.set(questName + ".blocks-placed-amounts", amounts); } - if (questSec.contains("blocks-used-ids")) { + if (questSec.contains("blocks-used-names")) { - List ids = questSec.getIntegerList("blocks-used-ids"); + List names = questSec.getStringList("blocks-used-names"); List amounts = questSec.getIntegerList("blocks-used-amounts"); - newData.set(questName + ".blocks-used-ids", ids); + newData.set(questName + ".blocks-used-names", names); newData.set(questName + ".blocks-used-amounts", amounts); } - if (questSec.contains("blocks-cut-ids")) { + if (questSec.contains("blocks-cut-names")) { - List ids = questSec.getIntegerList("blocks-cut-ids"); + List names = questSec.getStringList("blocks-cut-names"); List amounts = questSec.getIntegerList("blocks-cut-amounts"); - newData.set(questName + ".blocks-cut-ids", ids); + newData.set(questName + ".blocks-cut-names", names); newData.set(questName + ".blocks-cut-amounts", amounts); } @@ -2993,11 +3001,11 @@ public static ConfigurationSection getLegacyQuestData(FileConfiguration questSec if (questSec.contains("enchantments")) { List enchantNames = questSec.getStringList("enchantments"); - List ids = questSec.getIntegerList("enchantment-item-ids"); + List names = questSec.getStringList("enchantment-item-names"); List times = questSec.getIntegerList("times-enchanted"); newData.set(questName + ".enchantments", enchantNames); - newData.set(questName + ".enchantment-item-ids", ids); + newData.set(questName + ".enchantment-item-names", names); newData.set(questName + ".times-enchanted", times); } @@ -3062,12 +3070,12 @@ public static ConfigurationSection getLegacyQuestData(FileConfiguration questSec } - if (questSec.contains("potions-brewed-ids")) { + if (questSec.contains("potions-brewed-names")) { - List ids = questSec.getIntegerList("potions-brewed-ids"); + List names = questSec.getStringList("potions-brewed-names"); List amounts = questSec.getIntegerList("potions-brewed-amounts"); - newData.set(questName + ".potions-brewed-ids", ids); + newData.set(questName + ".potions-brewed-names", names); newData.set(questName + ".potions-brewed-amounts", amounts); } diff --git a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java index 5cfb22a53..e6628d43e 100644 --- a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java @@ -5,8 +5,8 @@ import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; -import me.blackvein.quests.CustomObjective; +import me.blackvein.quests.CustomObjective; import me.blackvein.quests.util.ColorUtil; import me.blackvein.quests.Event; import me.blackvein.quests.QuestFactory; @@ -18,8 +18,8 @@ import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.MiscUtil; import net.aufdemrand.denizen.scripts.ScriptRegistry; import net.citizensnpcs.api.CitizensPlugin; -import org.bukkit.DyeColor; +import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -60,71 +60,71 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { String text = PINK + "- " + AQUA + (String) context.getSessionData(CK.Q_NAME) + PINK + " | " + Lang.get("stageEditorStage") + " " + PURPLE + stageNum + PINK + " -\n"; - if (context.getSessionData(pref + CK.S_BREAK_IDS) == null) { + if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) { text += PINK + "" + BOLD + "1 " + RESET + PURPLE + "- " + Lang.get("stageEditorBreakBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n"; } else { text += PINK + "" + BOLD + "1 " + RESET + PURPLE + "- " + Lang.get("stageEditorBreakBlocks") + "\n"; - LinkedList ids = (LinkedList) context.getSessionData(pref + CK.S_BREAK_IDS); + LinkedList names = (LinkedList) context.getSessionData(pref + CK.S_BREAK_NAMES); LinkedList amnts = (LinkedList) context.getSessionData(pref + CK.S_BREAK_AMOUNTS); - for (int i = 0; i < ids.size(); i++) { - text += GRAY + " - " + BLUE + Quester.prettyItemString(ids.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; + for (int i = 0; i < names.size(); i++) { + text += GRAY + " - " + BLUE + Quester.prettyItemString(names.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; } } - if (context.getSessionData(pref + CK.S_DAMAGE_IDS) == null) { + if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null) { text += PINK + "" + BOLD + "2 " + RESET + PURPLE + "- " + Lang.get("stageEditorDamageBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n"; } else { text += PINK + "" + BOLD + "2 " + RESET + PURPLE + "- " + Lang.get("stageEditorDamageBlocks") + "\n"; - LinkedList ids = (LinkedList) context.getSessionData(pref + CK.S_DAMAGE_IDS); + LinkedList names = (LinkedList) context.getSessionData(pref + CK.S_DAMAGE_NAMES); LinkedList amnts = (LinkedList) context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS); - for (int i = 0; i < ids.size(); i++) { - text += GRAY + " - " + BLUE + Quester.prettyItemString(ids.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; + for (int i = 0; i < names.size(); i++) { + text += GRAY + " - " + BLUE + Quester.prettyItemString(names.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; } } - if (context.getSessionData(pref + CK.S_PLACE_IDS) == null) { + if (context.getSessionData(pref + CK.S_PLACE_NAMES) == null) { text += PINK + "" + BOLD + "3 " + RESET + PURPLE + "- " + Lang.get("stageEditorPlaceBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n"; } else { text += PINK + "" + BOLD + "3 " + RESET + PURPLE + "- " + Lang.get("stageEditorPlaceBlocks") + "\n"; - LinkedList ids = (LinkedList) context.getSessionData(pref + CK.S_PLACE_IDS); + LinkedList names = (LinkedList) context.getSessionData(pref + CK.S_PLACE_NAMES); LinkedList amnts = (LinkedList) context.getSessionData(pref + CK.S_PLACE_AMOUNTS); - for (int i = 0; i < ids.size(); i++) { - text += GRAY + " - " + BLUE + Quester.prettyItemString(ids.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; + for (int i = 0; i < names.size(); i++) { + text += GRAY + " - " + BLUE + Quester.prettyItemString(names.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; } } - if (context.getSessionData(pref + CK.S_USE_IDS) == null) { + if (context.getSessionData(pref + CK.S_USE_NAMES) == null) { text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + Lang.get("stageEditorUseBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n"; } else { text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + Lang.get("stageEditorUseBlocks") + "\n"; - LinkedList ids = (LinkedList) context.getSessionData(pref + CK.S_USE_IDS); + LinkedList names = (LinkedList) context.getSessionData(pref + CK.S_USE_NAMES); LinkedList amnts = (LinkedList) context.getSessionData(pref + CK.S_USE_AMOUNTS); - for (int i = 0; i < ids.size(); i++) { - text += GRAY + " - " + BLUE + Quester.prettyItemString(ids.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; + for (int i = 0; i < names.size(); i++) { + text += GRAY + " - " + BLUE + Quester.prettyItemString(names.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; } } - if (context.getSessionData(pref + CK.S_CUT_IDS) == null) { + if (context.getSessionData(pref + CK.S_CUT_NAMES) == null) { text += PINK + "" + BOLD + "5 " + RESET + PURPLE + "- " + Lang.get("stageEditorCutBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n"; } else { text += PINK + "" + BOLD + "5 " + RESET + PURPLE + "- " + Lang.get("stageEditorCutBlocks") + "\n"; - LinkedList ids = (LinkedList) context.getSessionData(pref + CK.S_CUT_IDS); + LinkedList names = (LinkedList) context.getSessionData(pref + CK.S_CUT_NAMES); LinkedList amnts = (LinkedList) context.getSessionData(pref + CK.S_CUT_AMOUNTS); - for (int i = 0; i < ids.size(); i++) { - text += GRAY + " - " + BLUE + Quester.prettyItemString(ids.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; + for (int i = 0; i < names.size(); i++) { + text += GRAY + " - " + BLUE + Quester.prettyItemString(names.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; } } @@ -149,11 +149,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { text += PINK + "" + BOLD + "8 " + RESET + PURPLE + "- " + Lang.get("stageEditorEnchantItems") + "\n"; LinkedList enchants = (LinkedList) context.getSessionData(pref + CK.S_ENCHANT_TYPES); - LinkedList items = (LinkedList) context.getSessionData(pref + CK.S_ENCHANT_IDS); + LinkedList names = (LinkedList) context.getSessionData(pref + CK.S_ENCHANT_NAMES); LinkedList amnts = (LinkedList) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS); for (int i = 0; i < enchants.size(); i++) { - text += GRAY + " - " + BLUE + Quester.prettyItemString(items.get(i)) + GRAY + " " + Lang.get("with") + " " + AQUA + Quester.prettyString(enchants.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; + text += GRAY + " - " + BLUE + Quester.prettyItemString(names.get(i)) + GRAY + " " + Lang.get("with") + " " + AQUA + Quester.prettyString(enchants.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n"; } } @@ -516,7 +516,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { @@ -561,11 +562,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getPasswordDisplays(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getPasswordDisplays(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS); } - private LinkedList> getPasswordPhrases(ConversationContext context) { + @SuppressWarnings("unchecked") + private LinkedList> getPasswordPhrases(ConversationContext context) { return (LinkedList>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES); } @@ -590,7 +593,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) != null) { - List displays = (List) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS); + @SuppressWarnings("unchecked") + List displays = (List) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS); displays.add(input); context.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, displays); @@ -630,7 +634,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) != null) { - LinkedList> phrases = (LinkedList>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES); + @SuppressWarnings("unchecked") + LinkedList> phrases = (LinkedList>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES); LinkedList newPhrases = new LinkedList(); newPhrases.addAll(Arrays.asList(input.split("\\|"))); phrases.add(newPhrases); @@ -698,17 +703,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { public String getPromptText(ConversationContext context) { String text = GOLD + "- " + Lang.get("stageEditorBreakBlocks") + " -\n"; - if (context.getSessionData(pref + CK.S_BREAK_IDS) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + " (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - " + Lang.get("stageEditorSetBlockAmounts") + " (" + Lang.get("noIdsSet") + ")\n"; + if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetBlockAmounts") + " (" + Lang.get("noNameSet") + ")\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } else { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + "\n"; - for (Integer i : getBlockIds(context)) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n"; + for (String s : getBlockNames(context)) { - text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + "\n"; + text += GRAY + " - " + AQUA + Quester.prettyItemString(s) + "\n"; } @@ -734,21 +739,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { - return new BreakBlockIdsPrompt(); + return new BreakBlockNamesPrompt(); } else if (input.equalsIgnoreCase("2")) { - if (context.getSessionData(pref + CK.S_BREAK_IDS) == null) { - context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockIds")); + if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) { + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames")); return new BreakBlockListPrompt(); } else { return new BreakBlockAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorBreakBlocksCleared")); - context.setSessionData(pref + CK.S_BREAK_IDS, null); + context.setSessionData(pref + CK.S_BREAK_NAMES, null); context.setSessionData(pref + CK.S_BREAK_AMOUNTS, null); return new BreakBlockListPrompt(); } else if (input.equalsIgnoreCase("4")) { @@ -756,8 +762,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int one; int two; - if (context.getSessionData(pref + CK.S_BREAK_IDS) != null) { - one = ((List) context.getSessionData(pref + CK.S_BREAK_IDS)).size(); + if (context.getSessionData(pref + CK.S_BREAK_NAMES) != null) { + one = ((List) context.getSessionData(pref + CK.S_BREAK_NAMES)).size(); } else { one = 0; } @@ -779,20 +785,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getBlockIds(ConversationContext context) { - return (List) context.getSessionData(pref + CK.S_BREAK_IDS); + @SuppressWarnings("unchecked") + private List getBlockNames(ConversationContext context) { + return (List) context.getSessionData(pref + CK.S_BREAK_NAMES); } - private List getBlockAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getBlockAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_BREAK_AMOUNTS); } } - private class BreakBlockIdsPrompt extends StringPrompt { + private class BreakBlockNamesPrompt extends StringPrompt { @Override public String getPromptText(ConversationContext context) { - return YELLOW + Lang.get("stageEditorEnterBlockIds"); + return YELLOW + Lang.get("stageEditorEnterBlockNames"); } @Override @@ -801,33 +809,33 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); for (String s : args) { try { - if (Material.getMaterial(Integer.parseInt(s)) != null) { + if (Material.getMaterial(s) != null) { - if (ids.contains(Integer.parseInt(s)) == false) { - ids.add(Integer.parseInt(s)); + if (names.contains(s) == false) { + names.add(s); } else { context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorContainsDuplicates")); - return new BreakBlockIdsPrompt(); + return new BreakBlockNamesPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockID")); - return new BreakBlockIdsPrompt(); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockName")); + return new BreakBlockNamesPrompt(); } } catch (NumberFormatException e) { context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNotListofNumbers") + "\n" + PINK + s); - return new BreakBlockIdsPrompt(); + return new BreakBlockNamesPrompt(); } } - context.setSessionData(pref + CK.S_BREAK_IDS, ids); + context.setSessionData(pref + CK.S_BREAK_NAMES, names); } @@ -889,17 +897,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { public String getPromptText(ConversationContext context) { String text = GOLD + "- " + Lang.get("stageEditorDamageBlocks") + " -\n"; - if (context.getSessionData(pref + CK.S_DAMAGE_IDS) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + " (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - " + Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noIdsSet") + ")\n"; + if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noNamesSet") + ")\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } else { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + "\n"; - for (Integer i : getBlockIds(context)) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n"; + for (String s : getBlockNames(context)) { - text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + "\n"; + text += GRAY + " - " + AQUA + Quester.prettyItemString(s) + "\n"; } @@ -925,21 +933,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { - return new DamageBlockIdsPrompt(); + return new DamageBlockNamesPrompt(); } else if (input.equalsIgnoreCase("2")) { - if (context.getSessionData(pref + CK.S_DAMAGE_IDS) == null) { - context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockIds")); + if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null) { + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames")); return new DamageBlockListPrompt(); } else { return new DamageBlockAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorDamageBlocksCleared")); - context.setSessionData(pref + CK.S_DAMAGE_IDS, null); + context.setSessionData(pref + CK.S_DAMAGE_NAMES, null); context.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, null); return new DamageBlockListPrompt(); } else if (input.equalsIgnoreCase("4")) { @@ -947,8 +956,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int one; int two; - if (context.getSessionData(pref + CK.S_DAMAGE_IDS) != null) { - one = ((List) context.getSessionData(pref + CK.S_DAMAGE_IDS)).size(); + if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) != null) { + one = ((List) context.getSessionData(pref + CK.S_DAMAGE_NAMES)).size(); } else { one = 0; } @@ -970,20 +979,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getBlockIds(ConversationContext context) { - return (List) context.getSessionData(pref + CK.S_DAMAGE_IDS); + @SuppressWarnings("unchecked") + private List getBlockNames(ConversationContext context) { + return (List) context.getSessionData(pref + CK.S_DAMAGE_NAMES); } - private List getBlockAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getBlockAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS); } } - private class DamageBlockIdsPrompt extends StringPrompt { + private class DamageBlockNamesPrompt extends StringPrompt { @Override public String getPromptText(ConversationContext context) { - return YELLOW + Lang.get("stageEditorEnterBlockIds"); + return YELLOW + Lang.get("stageEditorEnterBlockNames"); } @Override @@ -992,33 +1003,33 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); for (String s : args) { try { - if (Material.getMaterial(Integer.parseInt(s)) != null) { + if (Material.getMaterial(s) != null) { - if (ids.contains(Integer.parseInt(s)) == false) { - ids.add(Integer.parseInt(s)); + if (names.contains(s) == false) { + names.add(s); } else { context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorListContainsDuplicates")); - return new DamageBlockIdsPrompt(); + return new DamageBlockNamesPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockID")); - return new DamageBlockIdsPrompt(); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockName")); + return new DamageBlockNamesPrompt(); } } catch (NumberFormatException e) { context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); - return new DamageBlockIdsPrompt(); + return new DamageBlockNamesPrompt(); } } - context.setSessionData(pref + CK.S_DAMAGE_IDS, ids); + context.setSessionData(pref + CK.S_DAMAGE_NAMES, names); } @@ -1080,17 +1091,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { public String getPromptText(ConversationContext context) { String text = GOLD + "- " + Lang.get("stageEditorPlaceBlocks") + " -\n"; - if (context.getSessionData(pref + CK.S_PLACE_IDS) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + " (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - " + Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noIdsSet") + ")\n"; + if (context.getSessionData(pref + CK.S_PLACE_NAMES) == null) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noNamesSet") + ")\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } else { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + "\n"; - for (Integer i : getBlockIds(context)) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n"; + for (String s : getBlockNames(context)) { - text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + "\n"; + text += GRAY + " - " + AQUA + Quester.prettyItemString(s) + "\n"; } @@ -1116,21 +1127,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { - return new PlaceBlockIdsPrompt(); + return new PlaceBlockNamesPrompt(); } else if (input.equalsIgnoreCase("2")) { - if (context.getSessionData(pref + CK.S_PLACE_IDS) == null) { - context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockIds")); + if (context.getSessionData(pref + CK.S_PLACE_NAMES) == null) { + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames")); return new PlaceBlockListPrompt(); } else { return new PlaceBlockAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorPlaceBlocksCleared")); - context.setSessionData(pref + CK.S_PLACE_IDS, null); + context.setSessionData(pref + CK.S_PLACE_NAMES, null); context.setSessionData(pref + CK.S_PLACE_AMOUNTS, null); return new PlaceBlockListPrompt(); } else if (input.equalsIgnoreCase("4")) { @@ -1138,8 +1150,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int one; int two; - if (context.getSessionData(pref + CK.S_PLACE_IDS) != null) { - one = ((List) context.getSessionData(pref + CK.S_PLACE_IDS)).size(); + if (context.getSessionData(pref + CK.S_PLACE_NAMES) != null) { + one = ((List) context.getSessionData(pref + CK.S_PLACE_NAMES)).size(); } else { one = 0; } @@ -1161,20 +1173,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getBlockIds(ConversationContext context) { - return (List) context.getSessionData(pref + CK.S_PLACE_IDS); + @SuppressWarnings("unchecked") + private List getBlockNames(ConversationContext context) { + return (List) context.getSessionData(pref + CK.S_PLACE_NAMES); } - private List getBlockAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getBlockAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_PLACE_AMOUNTS); } } - private class PlaceBlockIdsPrompt extends StringPrompt { + private class PlaceBlockNamesPrompt extends StringPrompt { @Override public String getPromptText(ConversationContext context) { - return YELLOW + Lang.get("stageEditorEnterBlockIds"); + return YELLOW + Lang.get("stageEditorEnterBlockNames"); } @Override @@ -1183,33 +1197,33 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); for (String s : args) { try { - if (Material.getMaterial(Integer.parseInt(s)) != null) { + if (Material.getMaterial(s) != null) { - if (ids.contains(Integer.parseInt(s)) == false) { - ids.add(Integer.parseInt(s)); + if (names.contains(s) == false) { + names.add(s); } else { context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorListContainsDuplicates")); - return new PlaceBlockIdsPrompt(); + return new PlaceBlockNamesPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorInvalidBlockID")); - return new PlaceBlockIdsPrompt(); + context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorInvalidBlockName")); + return new PlaceBlockNamesPrompt(); } } catch (NumberFormatException e) { context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); - return new PlaceBlockIdsPrompt(); + return new PlaceBlockNamesPrompt(); } } - context.setSessionData(pref + CK.S_PLACE_IDS, ids); + context.setSessionData(pref + CK.S_PLACE_NAMES, names); } @@ -1271,17 +1285,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { public String getPromptText(ConversationContext context) { String text = GOLD + "- " + Lang.get("stageEditorUseBlocks") + " -\n"; - if (context.getSessionData(pref + CK.S_USE_IDS) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + " (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noIdsSet") + ")\n"; + if (context.getSessionData(pref + CK.S_USE_NAMES) == null) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noNamesSet") + ")\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } else { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + "\n"; - for (Integer i : getBlockIds(context)) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n"; + for (String s : getBlockNames(context)) { - text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + "\n"; + text += GRAY + " - " + AQUA + Quester.prettyItemString(s) + "\n"; } @@ -1307,21 +1321,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { - return new UseBlockIdsPrompt(); + return new UseBlockNamesPrompt(); } else if (input.equalsIgnoreCase("2")) { - if (context.getSessionData(pref + CK.S_USE_IDS) == null) { - context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockIds")); + if (context.getSessionData(pref + CK.S_USE_NAMES) == null) { + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames")); return new UseBlockListPrompt(); } else { return new UseBlockAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorUseBlocksCleared")); - context.setSessionData(pref + CK.S_USE_IDS, null); + context.setSessionData(pref + CK.S_USE_NAMES, null); context.setSessionData(pref + CK.S_USE_AMOUNTS, null); return new UseBlockListPrompt(); } else if (input.equalsIgnoreCase("4")) { @@ -1329,8 +1344,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int one; int two; - if (context.getSessionData(pref + CK.S_USE_IDS) != null) { - one = ((List) context.getSessionData(pref + CK.S_USE_IDS)).size(); + if (context.getSessionData(pref + CK.S_USE_NAMES) != null) { + one = ((List) context.getSessionData(pref + CK.S_USE_NAMES)).size(); } else { one = 0; } @@ -1352,20 +1367,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getBlockIds(ConversationContext context) { - return (List) context.getSessionData(pref + CK.S_USE_IDS); + @SuppressWarnings("unchecked") + private List getBlockNames(ConversationContext context) { + return (List) context.getSessionData(pref + CK.S_USE_NAMES); } - private List getBlockAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getBlockAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_USE_AMOUNTS); } } - private class UseBlockIdsPrompt extends StringPrompt { + private class UseBlockNamesPrompt extends StringPrompt { @Override public String getPromptText(ConversationContext context) { - return YELLOW + Lang.get("stageEditorEnterBlockIds"); + return YELLOW + Lang.get("stageEditorEnterBlockNames"); } @Override @@ -1374,33 +1391,33 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); for (String s : args) { try { - if (Material.getMaterial(Integer.parseInt(s)) != null) { + if (Material.getMaterial(s) != null) { - if (ids.contains(Integer.parseInt(s)) == false) { - ids.add(Integer.parseInt(s)); + if (names.contains(s) == false) { + names.add(s); } else { context.getForWhom().sendRawMessage(RED + " " + Lang.get("stageEditorContainsDuplicates")); - return new UseBlockIdsPrompt(); + return new UseBlockNamesPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockID")); - return new UseBlockIdsPrompt(); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockName")); + return new UseBlockNamesPrompt(); } } catch (NumberFormatException e) { context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); - return new UseBlockIdsPrompt(); + return new UseBlockNamesPrompt(); } } - context.setSessionData(pref + CK.S_USE_IDS, ids); + context.setSessionData(pref + CK.S_USE_NAMES, names); } @@ -1462,17 +1479,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { public String getPromptText(ConversationContext context) { String text = GOLD + "- " + Lang.get("stageEditorCutBlocks") + " -\n"; - if (context.getSessionData(pref + CK.S_CUT_IDS) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + " (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - " + Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noIdsSet") + ")\n"; + if (context.getSessionData(pref + CK.S_CUT_NAMES) == null) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noNamesSet") + ")\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } else { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + "\n"; - for (Integer i : getBlockIds(context)) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n"; + for (String s : getBlockNames(context)) { - text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + "\n"; + text += GRAY + " - " + AQUA + Quester.prettyItemString(s) + "\n"; } @@ -1498,21 +1515,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { - return new CutBlockIdsPrompt(); + return new CutBlockNamesPrompt(); } else if (input.equalsIgnoreCase("2")) { - if (context.getSessionData(pref + CK.S_CUT_IDS) == null) { - context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockIds")); + if (context.getSessionData(pref + CK.S_CUT_NAMES) == null) { + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames")); return new CutBlockListPrompt(); } else { return new CutBlockAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorCutBlocksCleared")); - context.setSessionData(pref + CK.S_CUT_IDS, null); + context.setSessionData(pref + CK.S_CUT_NAMES, null); context.setSessionData(pref + CK.S_CUT_AMOUNTS, null); return new CutBlockListPrompt(); } else if (input.equalsIgnoreCase("4")) { @@ -1520,8 +1538,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int one; int two; - if (context.getSessionData(pref + CK.S_CUT_IDS) != null) { - one = ((List) context.getSessionData(pref + CK.S_CUT_IDS)).size(); + if (context.getSessionData(pref + CK.S_CUT_NAMES) != null) { + one = ((List) context.getSessionData(pref + CK.S_CUT_NAMES)).size(); } else { one = 0; } @@ -1543,20 +1561,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getBlockIds(ConversationContext context) { - return (List) context.getSessionData(pref + CK.S_CUT_IDS); + @SuppressWarnings("unchecked") + private List getBlockNames(ConversationContext context) { + return (List) context.getSessionData(pref + CK.S_CUT_NAMES); } - private List getBlockAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getBlockAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_CUT_AMOUNTS); } } - private class CutBlockIdsPrompt extends StringPrompt { + private class CutBlockNamesPrompt extends StringPrompt { @Override public String getPromptText(ConversationContext context) { - return YELLOW + Lang.get("stageEditorEnterBlockIds"); + return YELLOW + Lang.get("stageEditorEnterBlockNames"); } @Override @@ -1565,33 +1585,33 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); for (String s : args) { try { - if (Material.getMaterial(Integer.parseInt(s)) != null) { + if (Material.getMaterial(s) != null) { - if (ids.contains(Integer.parseInt(s)) == false) { - ids.add(Integer.parseInt(s)); + if (names.contains(s) == false) { + names.add(s); } else { context.getForWhom().sendRawMessage(RED + " " + Lang.get("stageEditorListContainsDuplicates")); - return new CutBlockIdsPrompt(); + return new CutBlockNamesPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockID")); - return new CutBlockIdsPrompt(); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockName")); + return new CutBlockNamesPrompt(); } } catch (NumberFormatException e) { context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); - return new CutBlockIdsPrompt(); + return new CutBlockNamesPrompt(); } } - context.setSessionData(pref + CK.S_CUT_IDS, ids); + context.setSessionData(pref + CK.S_CUT_NAMES, names); } @@ -1709,7 +1729,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { String text = GOLD + "- " + Lang.get("stageEditorEnchantItems") + " -\n"; if (context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null) { text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetEnchantments") + " (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - " + Lang.get("stageEditorSetItemIds") + " (" + Lang.get("stageEditorNoEnchantmentsSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetItemNames") + " (" + Lang.get("stageEditorNoEnchantmentsSet") + ")\n"; text += GRAY + "3 - " + Lang.get("stageEditorSetEnchantAmounts") + " (" + Lang.get("stageEditorNoEnchantmentsSet") + ")\n"; text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done"); @@ -1722,14 +1742,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - if (context.getSessionData(pref + CK.S_ENCHANT_IDS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetItemIds") + " (" + Lang.get("noneSet") + ")\n"; + if (context.getSessionData(pref + CK.S_ENCHANT_NAMES) == null) { + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetItemNames") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetItemIds") + "\n"; - for (Integer i : getEnchantItems(context)) { + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetItemNames") + "\n"; + for (String s : getEnchantItems(context)) { - text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + "\n"; + text += GRAY + " - " + AQUA + Quester.prettyItemString(s) + "\n"; } @@ -1757,7 +1777,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { @@ -1779,7 +1800,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } else if (input.equalsIgnoreCase("4")) { context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorEnchantmentsCleared")); context.setSessionData(pref + CK.S_ENCHANT_TYPES, null); - context.setSessionData(pref + CK.S_ENCHANT_IDS, null); + context.setSessionData(pref + CK.S_ENCHANT_NAMES, null); context.setSessionData(pref + CK.S_ENCHANT_AMOUNTS, null); return new EnchantmentListPrompt(); } else if (input.equalsIgnoreCase("5")) { @@ -1789,13 +1810,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int three; if (context.getSessionData(pref + CK.S_ENCHANT_TYPES) != null) { - one = ((List) context.getSessionData(pref + CK.S_ENCHANT_TYPES)).size(); + one = ((List) context.getSessionData(pref + CK.S_ENCHANT_TYPES)).size(); } else { one = 0; } - if (context.getSessionData(pref + CK.S_ENCHANT_IDS) != null) { - two = ((List) context.getSessionData(pref + CK.S_ENCHANT_IDS)).size(); + if (context.getSessionData(pref + CK.S_ENCHANT_NAMES) != null) { + two = ((List) context.getSessionData(pref + CK.S_ENCHANT_NAMES)).size(); } else { two = 0; } @@ -1818,15 +1839,18 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getEnchantTypes(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getEnchantTypes(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_ENCHANT_TYPES); } - private List getEnchantItems(ConversationContext context) { - return (List) context.getSessionData(pref + CK.S_ENCHANT_IDS); + @SuppressWarnings("unchecked") + private List getEnchantItems(ConversationContext context) { + return (List) context.getSessionData(pref + CK.S_ENCHANT_NAMES); } - private List getEnchantAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getEnchantAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS); } } @@ -1896,7 +1920,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + Lang.get("stageEditorItemIDsPrompt"); + return YELLOW + Lang.get("stageEditorItemNamesPrompt"); } @Override @@ -1905,22 +1929,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); - LinkedList ids = new LinkedList(); + LinkedList names = new LinkedList(); for (String s : args) { try { - if (Material.getMaterial(Integer.parseInt(s)) != null) { + if (Material.getMaterial(s) != null) { - if (ids.contains(Integer.parseInt(s)) == false) { - ids.add(Integer.parseInt(s)); + if (names.contains(s) == false) { + names.add(s); } else { context.getForWhom().sendRawMessage(RED + " " + Lang.get("stageEditorListContainsDuplicates")); return new EnchantItemsPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidItemID")); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidItemName")); return new EnchantItemsPrompt(); } @@ -1931,7 +1955,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - context.setSessionData(pref + CK.S_ENCHANT_IDS, ids); + context.setSessionData(pref + CK.S_ENCHANT_NAMES, names); } @@ -2072,7 +2096,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { @@ -2128,15 +2153,18 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getItems(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getItems(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_DELIVERY_ITEMS); } - private List getDeliveryNPCs(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getDeliveryNPCs(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_DELIVERY_NPCS); } - private List getDeliveryMessages(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getDeliveryMessages(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_DELIVERY_MESSAGES); } } @@ -2315,7 +2343,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { @@ -2360,11 +2389,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getNPCIds(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getNPCIds(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_NPCS_TO_KILL); } - private List getKillAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getKillAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS); } } @@ -2554,7 +2585,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { @@ -2661,23 +2693,28 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getMobTypes(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getMobTypes(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_MOB_TYPES); } - private List getMobAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getMobAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_MOB_AMOUNTS); } - private List getKillLocations(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getKillLocations(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS); } - private List getKillRadii(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getKillRadii(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS); } - private List getKillLocationNames(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getKillLocationNames(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES); } } @@ -2791,7 +2828,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override public Prompt acceptInput(ConversationContext context, String input) { Player player = (Player) context.getForWhom(); @@ -2864,7 +2902,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { radii.add(i); } catch (NumberFormatException e) { - player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorInvalidItemID")); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorInvalidItemName")); return new MobRadiiPrompt(); } @@ -2967,7 +3005,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { @@ -3030,15 +3069,18 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getLocations(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getLocations(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_REACH_LOCATIONS); } - private List getLocationRadii(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getLocationRadii(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS); } - private List getLocationNames(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getLocationNames(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES); } } @@ -3052,7 +3094,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override public Prompt acceptInput(ConversationContext context, String input) { Player player = (Player) context.getForWhom(); @@ -3214,7 +3257,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { @@ -3261,11 +3305,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getTameTypes(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getTameTypes(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_TAME_TYPES); } - private List getTameAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getTameAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_TAME_AMOUNTS); } } @@ -3419,7 +3465,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext context, String input) { if (input.equalsIgnoreCase("1")) { @@ -3466,11 +3513,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - private List getShearColors(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getShearColors(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_SHEAR_COLORS); } - private List getShearAmounts(ConversationContext context) { + @SuppressWarnings("unchecked") + private List getShearAmounts(ConversationContext context) { return (List) context.getSessionData(pref + CK.S_SHEAR_AMOUNTS); } } @@ -3484,8 +3533,6 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { final DyeColor[] colArr = DyeColor.values(); for (int i = 0; i < colArr.length; i++) { - final DyeColor col = colArr[i]; - if (i < (colArr.length - 1)) { cols += Quests.getDyeString(colArr[i]) + ", "; } else { @@ -3580,7 +3627,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override public String getPromptText(ConversationContext context) { String text = GREEN + "- " + Lang.get("stageEditorStageEvents") + " -\n"; @@ -3958,7 +4006,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return text; } - @Override + @SuppressWarnings("unchecked") + @Override public Prompt acceptInput(ConversationContext context, String input) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { @@ -4089,12 +4138,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = DARKAQUA + "- " + Lang.get("stageEditorDenizenScript") + " -"; + //TODO Figure out why Blackvein left this unused + @SuppressWarnings("unused") + String text = DARKAQUA + "- " + Lang.get("stageEditorDenizenScript") + " -"; for (String s : ScriptRegistry._getScriptNames()) { text += AQUA + "- " + s + "\n"; } - + return YELLOW + Lang.get("stageEditorScriptPrompt"); } @@ -4233,7 +4284,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return text + YELLOW + Lang.get("stageEditorCustomPrompt"); } - @Override + @SuppressWarnings("unchecked") + @Override public Prompt acceptInput(ConversationContext context, String input) { if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { @@ -4321,7 +4373,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { String text = BOLD + "" + AQUA + "- "; - LinkedList list = (LinkedList) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES); + @SuppressWarnings("unchecked") + LinkedList list = (LinkedList) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES); String objName = list.getLast(); @@ -4343,7 +4396,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - @Override + @SuppressWarnings("unchecked") + @Override public Prompt acceptInput(ConversationContext context, String input) { try { @@ -4383,7 +4437,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { private class ObjectiveCustomDataListPrompt extends StringPrompt { - @Override + @SuppressWarnings("unchecked") + @Override public String getPromptText(ConversationContext context) { String text = BOLD + "" + AQUA + "- "; @@ -4424,7 +4479,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public Prompt acceptInput(ConversationContext context, String input) { - LinkedList> datamapList = (LinkedList>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA); + @SuppressWarnings("unchecked") + LinkedList> datamapList = (LinkedList>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA); Map datamap = datamapList.getLast(); int numInput; @@ -4472,7 +4528,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { public String getPromptText(ConversationContext context) { String text = ""; String temp = (String) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP); - Map descriptions = (Map) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS); + @SuppressWarnings("unchecked") + Map descriptions = (Map) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS); if (descriptions.get(temp) != null) { text += GOLD + descriptions.get(temp) + "\n"; } @@ -4485,7 +4542,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public Prompt acceptInput(ConversationContext context, String input) { - LinkedList> datamapList = (LinkedList>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA); + @SuppressWarnings("unchecked") + LinkedList> datamapList = (LinkedList>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA); Map datamap = datamapList.getLast(); datamap.put((String) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP), input); context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, null); diff --git a/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java b/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java index 06ab2af18..882acc696 100644 --- a/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java @@ -27,7 +27,6 @@ import org.bukkit.inventory.meta.ItemMeta; public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { //Stores itemstack in "tempStack" context data. - //Stores id in "tempId" //Stores amount in "tempAmount" //Stores data in "tempData" //Stores enchantments in "tempEnchantments" @@ -45,7 +44,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext cc) { String menu = YELLOW + Lang.get("createItemTitle") + "\n"; - if (cc.getSessionData("tempId") != null) { + if (cc.getSessionData("tempName") != null) { String stackData = getItemData(cc); if (stackData != null) { menu += stackData; @@ -65,7 +64,8 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { return menu; } - @Override + @SuppressWarnings("unchecked") + @Override protected Prompt acceptValidatedInput(ConversationContext cc, String input) { if (input.equalsIgnoreCase("0")) { @@ -83,8 +83,6 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { cc.setSessionData("tempEnchantments", null); cc.setSessionData("tempName", null); cc.setSessionData("tempLore", null); - - cc.setSessionData("tempId", is.getTypeId()); cc.setSessionData("tempAmount", is.getAmount()); if (is.getDurability() != 0) { cc.setSessionData("tempData", is.getDurability()); @@ -115,7 +113,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { return new IDPrompt(); } else if (input.equalsIgnoreCase("2")) { - if (cc.getSessionData("tempId") != null) { + if (cc.getSessionData("tempName") != null) { return new AmountPrompt(); } else { cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoID")); @@ -124,7 +122,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { } else if (input.equalsIgnoreCase("3")) { - if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) { + if (cc.getSessionData("tempName") != null && cc.getSessionData("tempAmount") != null) { return new DataPrompt(); } else { cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount")); @@ -133,7 +131,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { } else if (input.equalsIgnoreCase("4")) { - if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) { + if (cc.getSessionData("tempName") != null && cc.getSessionData("tempAmount") != null) { return new EnchantmentPrompt(); } else { cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount")); @@ -142,7 +140,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { } else if (input.equalsIgnoreCase("5")) { - if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) { + if (cc.getSessionData("tempName") != null && cc.getSessionData("tempAmount") != null) { return new NamePrompt(); } else { cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount")); @@ -151,7 +149,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { } else if (input.equalsIgnoreCase("6")) { - if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) { + if (cc.getSessionData("tempName") != null && cc.getSessionData("tempAmount") != null) { return new LorePrompt(); } else { cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount")); @@ -161,7 +159,6 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { } else if (input.equalsIgnoreCase("7")) { cc.setSessionData("tempStack", null); - cc.setSessionData("tempId", null); cc.setSessionData("tempAmount", null); cc.setSessionData("tempData", null); cc.setSessionData("tempEnchantments", null); @@ -170,9 +167,8 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { } else if (input.equalsIgnoreCase("8")) { - if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) { + if (cc.getSessionData("tempName") != null && cc.getSessionData("tempAmount") != null) { - int id = (Integer) cc.getSessionData("tempId"); int amount = (Integer) cc.getSessionData("tempAmount"); short data = -1; Map enchs = null; @@ -192,7 +188,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { lore = (LinkedList) cc.getSessionData("tempLore"); } - ItemStack stack = new ItemStack(id, amount); + ItemStack stack = new ItemStack(Material.matchMaterial(name), amount); ItemMeta meta = stack.getItemMeta(); if (data != -1) { @@ -256,7 +252,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { return new IDPrompt(); } else { - cc.setSessionData("tempId", mat.getId()); + cc.setSessionData("tempName", mat.name()); cc.setSessionData("tempAmount", 1); if (dataString != null) { @@ -425,7 +421,8 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { if (cc.getSessionData("tempEnchantments") != null) { - Map enchs = (Map) cc.getSessionData("tempEnchantments"); + @SuppressWarnings("unchecked") + Map enchs = (Map) cc.getSessionData("tempEnchantments"); enchs.put((Enchantment) cc.getSessionData("tempEnchant"), num); cc.setSessionData("tempEnchantments", enchs); @@ -508,14 +505,14 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { private String getItemData(ConversationContext cc) { - if (cc.getSessionData("tempId") != null) { + if (cc.getSessionData("tempName") != null) { String item; if (cc.getSessionData("tempName") == null) { - Integer id = (Integer) cc.getSessionData("tempId"); - item = AQUA + Quester.prettyItemString(id); + String name = (String) cc.getSessionData("tempName"); + item = AQUA + Quester.prettyItemString(name); if (cc.getSessionData("tempData") != null) { item += ":" + BLUE + (Short) cc.getSessionData("tempData"); @@ -524,8 +521,8 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { } else { item = PINK + "" + ITALIC + (String) cc.getSessionData("tempName") + RESET + "" + GRAY + " ("; - Integer id = (Integer) cc.getSessionData("tempId"); - item += AQUA + Quester.prettyItemString(id); + String name = (String) cc.getSessionData("tempName"); + item += AQUA + Quester.prettyItemString(name); if (cc.getSessionData("tempData") != null) { item += ":" + BLUE + (Short) cc.getSessionData("tempData"); } @@ -543,7 +540,8 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { if (cc.getSessionData("tempEnchantments") != null) { - Map enchantments = (Map) cc.getSessionData("tempEnchantments"); + @SuppressWarnings("unchecked") + Map enchantments = (Map) cc.getSessionData("tempEnchantments"); for (Entry e : enchantments.entrySet()) { item += GRAY + " - " + RED + Quester.prettyEnchantmentString(e.getKey()) + " " + Quests.getNumeral(e.getValue()) + "\n"; @@ -554,7 +552,8 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil { if (cc.getSessionData("tempLore") != null) { - List lore = (List) cc.getSessionData("tempLore"); + @SuppressWarnings("unchecked") + List lore = (List) cc.getSessionData("tempLore"); item += DARKGREEN + "(Lore)\n\""; for (String s : lore) { diff --git a/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java b/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java index fa1f15c74..60b3b71ed 100644 --- a/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/StagesPrompt.java @@ -112,19 +112,19 @@ public class StagesPrompt extends StringPrompt implements ColorUtil { pref = "stage" + current; newPref = "stage" + (current - 1); - cc.setSessionData(newPref + CK.S_BREAK_IDS, cc.getSessionData(pref + CK.S_BREAK_IDS)); + cc.setSessionData(newPref + CK.S_BREAK_NAMES, cc.getSessionData(pref + CK.S_BREAK_NAMES)); cc.setSessionData(newPref + CK.S_BREAK_AMOUNTS, cc.getSessionData(pref + CK.S_BREAK_AMOUNTS)); - cc.setSessionData(newPref + CK.S_DAMAGE_IDS, cc.getSessionData(pref + CK.S_DAMAGE_IDS)); + cc.setSessionData(newPref + CK.S_DAMAGE_NAMES, cc.getSessionData(pref + CK.S_DAMAGE_NAMES)); cc.setSessionData(newPref + CK.S_DAMAGE_AMOUNTS, cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS)); - cc.setSessionData(newPref + CK.S_PLACE_IDS, cc.getSessionData(pref + CK.S_PLACE_IDS)); - cc.setSessionData(newPref + CK.S_PLACE_IDS, cc.getSessionData(pref + CK.S_PLACE_AMOUNTS)); + cc.setSessionData(newPref + CK.S_PLACE_NAMES, cc.getSessionData(pref + CK.S_PLACE_NAMES)); + cc.setSessionData(newPref + CK.S_PLACE_NAMES, cc.getSessionData(pref + CK.S_PLACE_AMOUNTS)); - cc.setSessionData(newPref + CK.S_USE_IDS, cc.getSessionData(pref + CK.S_USE_IDS)); + cc.setSessionData(newPref + CK.S_USE_NAMES, cc.getSessionData(pref + CK.S_USE_NAMES)); cc.setSessionData(newPref + CK.S_USE_AMOUNTS, cc.getSessionData(pref + CK.S_USE_AMOUNTS)); - cc.setSessionData(newPref + CK.S_CUT_IDS, cc.getSessionData(pref + CK.S_CUT_IDS)); + cc.setSessionData(newPref + CK.S_CUT_NAMES, cc.getSessionData(pref + CK.S_CUT_NAMES)); cc.setSessionData(newPref + CK.S_CUT_AMOUNTS, cc.getSessionData(pref + CK.S_CUT_AMOUNTS)); cc.setSessionData(newPref + CK.S_FISH, cc.getSessionData(pref + CK.S_FISH)); @@ -132,7 +132,7 @@ public class StagesPrompt extends StringPrompt implements ColorUtil { cc.setSessionData(newPref + CK.S_PLAYER_KILL, cc.getSessionData(pref + CK.S_PLAYER_KILL)); cc.setSessionData(newPref + CK.S_ENCHANT_TYPES, cc.getSessionData(pref + CK.S_ENCHANT_TYPES)); - cc.setSessionData(newPref + CK.S_ENCHANT_IDS, cc.getSessionData(pref + CK.S_ENCHANT_IDS)); + cc.setSessionData(newPref + CK.S_ENCHANT_NAMES, cc.getSessionData(pref + CK.S_ENCHANT_NAMES)); cc.setSessionData(newPref + CK.S_ENCHANT_AMOUNTS, cc.getSessionData(pref + CK.S_ENCHANT_AMOUNTS)); cc.setSessionData(newPref + CK.S_DELIVERY_ITEMS, cc.getSessionData(pref + CK.S_DELIVERY_ITEMS)); @@ -188,19 +188,19 @@ public class StagesPrompt extends StringPrompt implements ColorUtil { } - cc.setSessionData(pref + CK.S_BREAK_IDS, null); + cc.setSessionData(pref + CK.S_BREAK_NAMES, null); cc.setSessionData(pref + CK.S_BREAK_AMOUNTS, null); - cc.setSessionData(pref + CK.S_DAMAGE_IDS, null); + cc.setSessionData(pref + CK.S_DAMAGE_NAMES, null); cc.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, null); - cc.setSessionData(pref + CK.S_PLACE_IDS, null); + cc.setSessionData(pref + CK.S_PLACE_NAMES, null); cc.setSessionData(pref + CK.S_PLACE_AMOUNTS, null); - cc.setSessionData(pref + CK.S_USE_IDS, null); + cc.setSessionData(pref + CK.S_USE_NAMES, null); cc.setSessionData(pref + CK.S_USE_AMOUNTS, null); - cc.setSessionData(pref + CK.S_CUT_IDS, null); + cc.setSessionData(pref + CK.S_CUT_NAMES, null); cc.setSessionData(pref + CK.S_CUT_AMOUNTS, null); cc.setSessionData(pref + CK.S_FISH, null); @@ -208,7 +208,7 @@ public class StagesPrompt extends StringPrompt implements ColorUtil { cc.setSessionData(pref + CK.S_PLAYER_KILL, null); cc.setSessionData(pref + CK.S_ENCHANT_TYPES, null); - cc.setSessionData(pref + CK.S_ENCHANT_IDS, null); + cc.setSessionData(pref + CK.S_ENCHANT_NAMES, null); cc.setSessionData(pref + CK.S_ENCHANT_AMOUNTS, null); cc.setSessionData(pref + CK.S_DELIVERY_ITEMS, null); diff --git a/src/main/java/me/blackvein/quests/util/CK.java b/src/main/java/me/blackvein/quests/util/CK.java index 91b97b9fd..e18967337 100644 --- a/src/main/java/me/blackvein/quests/util/CK.java +++ b/src/main/java/me/blackvein/quests/util/CK.java @@ -52,20 +52,20 @@ public class CK { public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc"; public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp"; //Stages - public static final String S_BREAK_IDS = "breakIds"; + public static final String S_BREAK_NAMES = "breakNames"; public static final String S_BREAK_AMOUNTS = "breakAmounts"; - public static final String S_DAMAGE_IDS = "damageIds"; + public static final String S_DAMAGE_NAMES = "damageNames"; public static final String S_DAMAGE_AMOUNTS = "damageAmounts"; - public static final String S_PLACE_IDS = "placeIds"; + public static final String S_PLACE_NAMES = "placeNames"; public static final String S_PLACE_AMOUNTS = "placeAmounts"; - public static final String S_USE_IDS = "useIds"; + public static final String S_USE_NAMES = "useNames"; public static final String S_USE_AMOUNTS = "useAmounts"; - public static final String S_CUT_IDS = "cutIds"; + public static final String S_CUT_NAMES = "cutNames"; public static final String S_CUT_AMOUNTS = "cutAmounts"; public static final String S_FISH = "fish"; public static final String S_PLAYER_KILL = "playerKill"; public static final String S_ENCHANT_TYPES = "enchantTypes"; - public static final String S_ENCHANT_IDS = "enchantIds"; + public static final String S_ENCHANT_NAMES = "enchantNames"; public static final String S_ENCHANT_AMOUNTS = "enchantAmounts"; public static final String S_DELIVERY_ITEMS = "deliveryItems"; public static final String S_DELIVERY_NPCS = "deliveryNPCs"; diff --git a/src/main/java/me/blackvein/quests/util/ItemUtil.java b/src/main/java/me/blackvein/quests/util/ItemUtil.java index 711610586..cb8ddb810 100644 --- a/src/main/java/me/blackvein/quests/util/ItemUtil.java +++ b/src/main/java/me/blackvein/quests/util/ItemUtil.java @@ -13,17 +13,17 @@ import org.bukkit.inventory.meta.ItemMeta; public class ItemUtil implements ColorUtil { /** - * Will compare stacks by id, amount, data, name/lore and enchantments + * Will compare stacks by name, amount, data, display name/lore and enchantments * * * @param one ItemStack to compare * @param two ItemStack to compare to * @return 0 if stacks are equal, or the first inequality from the following * values:
- * @return -1 -> stack ids are unequal
+ * @return -1 -> stack names are unequal
* @return -2 -> stack amounts are unequal
* @return -3 -> stack data is unequal
- * @return -4 -> stack name/lore is unequal
+ * @return -4 -> stack display name/lore is unequal
* @return -5 -> stack enchantments are unequal
*/ public static int compareItems(ItemStack one, ItemStack two, boolean ignoreAmount) { @@ -36,7 +36,7 @@ public class ItemUtil implements ColorUtil { return 0; } - if (one.getTypeId() != two.getTypeId()) { + if (one.getType().name() != two.getType().name()) { return -1; } else if ((one.getAmount() != two.getAmount()) && ignoreAmount == false) { return -2; @@ -87,8 +87,8 @@ public class ItemUtil implements ColorUtil { LinkedList lore = new LinkedList(); for (String arg : args) { - if (arg.startsWith("id-")) { - stack = new ItemStack(Integer.parseInt(arg.substring(3))); + if (arg.startsWith("name-")) { + stack = new ItemStack(Material.matchMaterial(arg.substring(3))); meta = stack.getItemMeta(); } else if (arg.startsWith("amount-")) { stack.setAmount(Integer.parseInt(arg.substring(7))); @@ -124,7 +124,7 @@ public class ItemUtil implements ColorUtil { return null; } - serial = "id-" + is.getTypeId(); + serial = "name-" + is.getType().name(); serial += ":amount-" + is.getAmount(); if (is.getDurability() != 0) { serial += ":data-" + is.getDurability(); @@ -161,7 +161,7 @@ public class ItemUtil implements ColorUtil { if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) { text = "" + DARKAQUA + ITALIC + is.getItemMeta().getDisplayName() + RESET + AQUA + " x " + is.getAmount(); } else { - text = AQUA + Quester.prettyItemString(is.getTypeId()); + text = AQUA + Quester.prettyItemString(is.getType().name()); if (is.getDurability() != 0) { text += AQUA + ":" + is.getDurability(); } @@ -185,7 +185,7 @@ public class ItemUtil implements ColorUtil { if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) { text = "" + DARKAQUA + ITALIC + is.getItemMeta().getDisplayName() + RESET + AQUA + " x " + is.getAmount(); } else { - text = AQUA + Quester.prettyItemString(is.getTypeId()); + text = AQUA + Quester.prettyItemString(is.getType().name()); if (is.getDurability() != 0) { text += AQUA + ":" + is.getDurability(); } @@ -205,7 +205,7 @@ public class ItemUtil implements ColorUtil { if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) { text = "" + DARKAQUA + ITALIC + is.getItemMeta().getDisplayName(); } else { - text = AQUA + Quester.prettyItemString(is.getTypeId()); + text = AQUA + Quester.prettyItemString(is.getType().name()); } return text; diff --git a/src/main/java/me/blackvein/quests/util/Lang.java b/src/main/java/me/blackvein/quests/util/Lang.java index d7cb41c93..52c93ea77 100644 --- a/src/main/java/me/blackvein/quests/util/Lang.java +++ b/src/main/java/me/blackvein/quests/util/Lang.java @@ -283,7 +283,7 @@ public class Lang { langMap.put("stageEditorCompleteMessage", "Complete Message"); langMap.put("stageEditorDelete", "Delete Stage"); - langMap.put("stageEditorSetBlockIds", "Set block IDs"); + langMap.put("stageEditorSetBlockNames", "Set block names"); langMap.put("stageEditorSetBlockAmounts", "Set block amounts"); langMap.put("stageEditorSetDamageAmounts", "Set damage amounts"); langMap.put("stageEditorSetPlaceAmounts", "Set place amounts"); @@ -293,7 +293,7 @@ public class Lang { langMap.put("stageEditorSetEnchantAmounts", "Set enchant amounts"); langMap.put("stageEditorSetMobAmounts", "Set mob amounts"); langMap.put("stageEditorSetEnchantments", "Set enchantments"); - langMap.put("stageEditorSetItemIds", "Set item ids"); + langMap.put("stageEditorSetItemNames", "Set item ids"); langMap.put("stageEditorSetKillIds", "Set NPC IDs"); langMap.put("stageEditorSetMobTypes", "Set mob types"); langMap.put("stageEditorSetKillLocations", "Set kill locations"); @@ -318,7 +318,7 @@ public class Lang { langMap.put("stageEditorCustomCleared", "Custom objectives cleared."); langMap.put("stageEditorCustomDataPrompt", "Enter value for :"); - langMap.put("stageEditorEnterBlockIds", "Enter block IDs, separating each one by a space, or enter \'cancel\' to return."); + langMap.put("stageEditorEnterBlockNames", "Enter block names, separating each one by a space, or enter \'cancel\' to return."); langMap.put("stageEditorBreakBlocksPrompt", "Enter block amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); langMap.put("stageEditorDamageBlocksPrompt", "Enter damage amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); langMap.put("stageEditorPlaceBlocksPrompt", "Enter place amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); @@ -328,7 +328,7 @@ public class Lang { langMap.put("stageEditorKillPlayerPrompt", "Enter number of players to kill, or 0 to clear the player kill objective, or -1 to cancel"); langMap.put("stageEditorEnchantTypePrompt", "Enter enchantment names, separating each one by a comma, or enter \'cancel\' to return."); langMap.put("stageEditorEnchantAmountsPrompt", "Enter enchant amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); - langMap.put("stageEditorItemIDsPrompt", "Enter item IDs, separating each one by a space, or enter \'cancel\' to return."); + langMap.put("stageEditorItemNamesPrompt", "Enter item names, separating each one by a space, or enter \'cancel\' to return."); langMap.put("stageEditorNPCPrompt", "Enter NPC ids, separating each one by a space, or enter \'cancel\' to return."); langMap.put("stageEditorNPCToTalkToPrompt", "Enter NPC IDs, separating each one by a space, or enter \'clear\' to clear the NPC ID list, or \'cancel\' to return."); langMap.put("stageEditorDeliveryMessagesPrompt", "Enter delivery messages, separating each one by a semi-colon or enter \'cancel\' to return."); @@ -368,11 +368,11 @@ public class Lang { langMap.put("stageEditorDeliveryMessages", "Set delivery messages"); langMap.put("stageEditorContainsDuplicates", "List contains duplicates!"); - langMap.put("stageEditorInvalidBlockID", "is not a valid block ID!"); + langMap.put("stageEditorInvalidBlockName", "is not a valid block name!"); langMap.put("stageEditorInvalidEnchantment", "is not a valid enchantment name!"); langMap.put("stageEditorInvalidNPC", "is not a valid NPC ID!"); langMap.put("stageEditorInvalidMob", "is not a valid mob name!"); - langMap.put("stageEditorInvalidItemID", "is not a valid item ID!"); + langMap.put("stageEditorInvalidItemName", "is not a valid item name!"); langMap.put("stageEditorInvalidNumber", "is not a number!"); langMap.put("stageEditorInvalidDye", "is not a valid dye color!"); langMap.put("stageEditorInvalidEvent", "is not a valid event name!"); @@ -388,7 +388,7 @@ public class Lang { langMap.put("stageEditorNotGreaterThanZero", "is not greater than 0!"); langMap.put("stageEditorNotListofNumbers", "Invalid entry, input was not a list of numbers!"); langMap.put("stageEditorNoDelaySet", "You must set a delay first!"); - langMap.put("stageEditorNoBlockIds", "You must set Block IDs first!"); + langMap.put("stageEditorNoBlockNames", "You must set block names first!"); langMap.put("stageEditorNoEnchantments", "You must set enchantments first!"); langMap.put("stageEditorNoItems", "You must add items first!"); langMap.put("stageEditorNoDeliveryMessage", "You must set at least one delivery message!"); @@ -405,7 +405,7 @@ public class Lang { langMap.put("stageEditorNoLocationsSet", "No locations set"); langMap.put("stageEditorNoColorsSet", "No colors set"); - langMap.put("stageEditorListNotSameSize", "The block IDs list and the amounts list are not the same size!"); + langMap.put("stageEditorListNotSameSize", "The block names list and the amounts list are not the same size!"); langMap.put("stageEditorEnchantmentNotSameSize", "The enchantments list, the item id list and the enchant amount list are not the same size!"); langMap.put("stageEditorDeliveriesNotSameSize", "The item list and the NPC list are not equal in size!"); langMap.put("stageEditorNPCKillsNotSameSize", "The NPC IDs list and the kill amounts list are not the same size!"); @@ -506,11 +506,11 @@ public class Lang { langMap.put("eventEditorSetItems", "Give items"); langMap.put("eventEditorItemsCleared", "Event items cleared."); langMap.put("eventEditorAddItem", "Add item"); - langMap.put("eventEditorSetItemIDs", "Set item IDs"); + langMap.put("eventEditorSetItemNames", "Set item names"); langMap.put("eventEditorSetItemAmounts", "Set item amounts"); - langMap.put("eventEditorNoIDs", "No IDs set"); - langMap.put("eventEditorMustSetIDs", "You must set item IDs first!"); - langMap.put("eventEditorInvalidID", "is not a valid item ID!"); + langMap.put("eventEditorNoNames", "No names set"); + langMap.put("eventEditorMustSetNames", "You must set item names first!"); + langMap.put("eventEditorInvalidName", "is not a valid item name!"); langMap.put("eventEditorNotGreaterThanZero", "is not greater than 0!"); langMap.put("eventEditorNotANumber", "is not a number!"); @@ -587,7 +587,7 @@ public class Lang { langMap.put("eventEditorExplosionPrompt", "Right-click on a block to spawn an explosion at, then enter 'add' to add it to the list, or enter 'clear' to clear the explosions list, or 'cancel' to return"); langMap.put("eventEditorSelectBlockFirst", "You must select a block first."); langMap.put("eventEditorSetMessagePrompt", "Enter message, or enter \'none\' to delete, (or \'cancel\' to return)"); - langMap.put("eventEditorSetItemIDsPrompt", "Enter item IDs separating each one by a space, or enter 'cancel' to return."); + langMap.put("eventEditorSetItemNamesPrompt", "Enter item names separating each one by a space, or enter 'cancel' to return."); langMap.put("eventEditorSetItemAmountsPrompt", "Enter item amounts (numbers) separating each one by a space, or enter 'cancel' to return."); langMap.put("eventEditorSetMobTypesPrompt", "Enter mob name, or enter 'cancel' to return"); langMap.put("eventEditorSetMobAmountsPrompt", "Enter mob amount, or enter 'cancel' to return"); @@ -716,14 +716,14 @@ public class Lang { //Item Prompt langMap.put("itemCreateLoadHand", "Load item in hand"); - langMap.put("itemCreateSetID", "Set ID"); + langMap.put("itemCreateSetName", "Set name"); langMap.put("itemCreateSetAmount", "Set Amount"); langMap.put("itemCreateSetData", "Set data"); langMap.put("itemCreateSetEnchs", "Add/clear enchantments"); langMap.put("itemCreateSetName", "Set name"); langMap.put("itemCreateSetLore", "Set lore"); - langMap.put("itemCreateEnterID", "Enter an item ID, or 'cancel' to return."); + langMap.put("itemCreateEnterName", "Enter an item name, or 'cancel' to return."); langMap.put("itemCreateEnterAmount", "Enter item amount (max. 64), or 'cancel' to return."); langMap.put("itemCreateEnterData", "Enter item data, or 'clear' to clear the data, or 'cancel' to return."); langMap.put("itemCreateEnterEnch", "Enter an enchantment name, or 'clear' to clear the enchantments, or 'cancel' to return."); @@ -733,8 +733,8 @@ public class Lang { langMap.put("itemCreateLoaded", "Item loaded."); langMap.put("itemCreateNoItem", "No item in hand!"); - langMap.put("itemCreateNoID", "You must set an ID first!"); - langMap.put("itemCreateInvalidID", "Invalid item ID!"); + langMap.put("itemCreateNoName", "You must set a name first!"); + langMap.put("itemCreateInvalidName", "Invalid item name!"); langMap.put("itemCreateInvalidAmount", "Amount must be between 1-64!"); langMap.put("itemCreateInvalidData", "Invalid item data!"); langMap.put("itemCreateInvalidEnch", "Invalid enchantment name!"); @@ -742,7 +742,7 @@ public class Lang { langMap.put("itemCreateInvalidInput", "Invalid input!"); langMap.put("itemCreateNotNumber", "Input was not a number!"); - langMap.put("itemCreateNoIDAmount", "You must set an ID and amount first!"); + langMap.put("itemCreateNoNameAmount", "You must set a name and amount first!"); langMap.put("itemCreateCriticalError", "A critical error has occurred."); // @@ -1027,6 +1027,7 @@ public class Lang { langMap.put("noneSet", "None set"); langMap.put("noDelaySet", "No delay set"); langMap.put("noIdsSet", "No IDs set"); + langMap.put("noNamesSet", "No names set"); langMap.put("worlds", "Worlds"); langMap.put("mobs", "Mobs"); langMap.put("points", "points");