mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 18:45:27 +01:00
Replace block/item IDs with names
This commit is contained in:
parent
456ff174ba
commit
68e60e6111
@ -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) {
|
||||
|
||||
|
@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -182,10 +182,10 @@ public class QuestData {
|
||||
};
|
||||
|
||||
|
||||
public Map<Integer, Integer> potionsBrewed = new HashMap<Integer, Integer>() {
|
||||
public Map<String, Integer> potionsBrewed = new HashMap<String, Integer>() {
|
||||
|
||||
@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<? extends Integer, ? extends Integer> m) {
|
||||
public void putAll(Map<? extends String, ? extends Integer> m) {
|
||||
super.putAll(m);
|
||||
if (doJournalUpdate) quester.updateJournal();
|
||||
}
|
||||
|
@ -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<Integer>) cc.getSessionData(pref + CK.S_BREAK_IDS);
|
||||
if (cc.getSessionData(pref + CK.S_BREAK_NAMES) != null) {
|
||||
breakIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_NAMES);
|
||||
breakAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_AMOUNTS);
|
||||
}
|
||||
|
||||
if (cc.getSessionData(pref + CK.S_DAMAGE_IDS) != null) {
|
||||
damageIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_IDS);
|
||||
if (cc.getSessionData(pref + CK.S_DAMAGE_NAMES) != null) {
|
||||
damageIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_NAMES);
|
||||
damageAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS);
|
||||
}
|
||||
|
||||
if (cc.getSessionData(pref + CK.S_PLACE_IDS) != null) {
|
||||
placeIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_IDS);
|
||||
if (cc.getSessionData(pref + CK.S_PLACE_NAMES) != null) {
|
||||
placeIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_NAMES);
|
||||
placeAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_AMOUNTS);
|
||||
}
|
||||
|
||||
if (cc.getSessionData(pref + CK.S_USE_IDS) != null) {
|
||||
useIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_IDS);
|
||||
if (cc.getSessionData(pref + CK.S_USE_NAMES) != null) {
|
||||
useIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_NAMES);
|
||||
useAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_AMOUNTS);
|
||||
}
|
||||
|
||||
if (cc.getSessionData(pref + CK.S_CUT_IDS) != null) {
|
||||
cutIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_IDS);
|
||||
if (cc.getSessionData(pref + CK.S_CUT_NAMES) != null) {
|
||||
cutIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_NAMES);
|
||||
cutAmounts = (LinkedList<Integer>) 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<String>) cc.getSessionData(pref + CK.S_ENCHANT_TYPES);
|
||||
enchantmentIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_ENCHANT_IDS);
|
||||
enchantmentIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_ENCHANT_NAMES);
|
||||
enchantmentAmounts = (LinkedList<Integer>) 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<String> items = new LinkedList<String>();
|
||||
@ -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<Integer> ids = new LinkedList<Integer>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
|
||||
for (Entry<Material, Integer> 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<Integer> ids = new LinkedList<Integer>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
|
||||
for (Entry<Material, Integer> 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<Integer> ids = new LinkedList<Integer>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
|
||||
for (Entry<Material, Integer> 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<Integer> ids = new LinkedList<Integer>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
|
||||
for (Entry<Material, Integer> 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<Integer> ids = new LinkedList<Integer>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
|
||||
for (Entry<Material, Integer> 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<String> enchants = new LinkedList<String>();
|
||||
LinkedList<Integer> ids = new LinkedList<Integer>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
|
||||
for (Entry<Map<Enchantment, Material>, Integer> e : stage.itemsToEnchant.entrySet()) {
|
||||
@ -1983,7 +1983,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
amounts.add(e.getValue());
|
||||
for (Entry<Enchantment, Material> 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);
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,9 @@ public class Quester {
|
||||
public String questToTake;
|
||||
public LinkedHashMap<Quest, Integer> currentQuests = new LinkedHashMap<Quest, Integer>() {
|
||||
|
||||
@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<String> completedQuests = new LinkedList<String>() {
|
||||
|
||||
@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<String, Integer> amountsCompleted = new HashMap<String, Integer>() {
|
||||
|
||||
public void hardClear() {
|
||||
private static final long serialVersionUID = 5475202358792520975L;
|
||||
|
||||
public void hardClear() {
|
||||
super.clear();
|
||||
}
|
||||
|
||||
@ -168,7 +174,9 @@ public class Quester {
|
||||
|
||||
Map<Quest, QuestData> questData = new HashMap<Quest, QuestData>() {
|
||||
|
||||
@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("<item>", Quester.prettyItemString(mat.getId()));
|
||||
obj = obj.replaceAll("<item>", Quester.prettyItemString(mat.name()));
|
||||
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
|
||||
unfinishedObjectives.add(ChatColor.GREEN + obj + ": " + num1 + "/" + num2);
|
||||
|
||||
} else {
|
||||
|
||||
String obj = Lang.get("enchantItem");
|
||||
obj = obj.replaceAll("<item>", Quester.prettyItemString(mat.getId()));
|
||||
obj = obj.replaceAll("<item>", Quester.prettyItemString(mat.name()));
|
||||
obj = obj.replaceAll("<enchantment>", 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("<item>", prettyItemString(material.getId()));
|
||||
obj = obj.replaceAll("<item>", prettyItemString(material.name()));
|
||||
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
|
||||
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
|
||||
for (Map<Enchantment, Material> 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<Integer> blockIds = new LinkedList<Integer>();
|
||||
LinkedList<String> blockNames = new LinkedList<String>();
|
||||
LinkedList<Integer> blockAmounts = new LinkedList<Integer>();
|
||||
|
||||
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<Integer> blockIds = new LinkedList<Integer>();
|
||||
LinkedList<String> blockNames = new LinkedList<String>();
|
||||
LinkedList<Integer> blockAmounts = new LinkedList<Integer>();
|
||||
|
||||
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<Integer> blockIds = new LinkedList<Integer>();
|
||||
LinkedList<String> blockNames = new LinkedList<String>();
|
||||
LinkedList<Integer> blockAmounts = new LinkedList<Integer>();
|
||||
|
||||
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<Integer> blockIds = new LinkedList<Integer>();
|
||||
LinkedList<String> blockNames = new LinkedList<String>();
|
||||
LinkedList<Integer> blockAmounts = new LinkedList<Integer>();
|
||||
|
||||
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<Integer> blockIds = new LinkedList<Integer>();
|
||||
LinkedList<String> blockNames = new LinkedList<String>();
|
||||
LinkedList<Integer> blockAmounts = new LinkedList<Integer>();
|
||||
|
||||
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<String> enchantments = new LinkedList<String>();
|
||||
LinkedList<Integer> itemIds = new LinkedList<Integer>();
|
||||
LinkedList<String> itemNames = new LinkedList<String>();
|
||||
LinkedList<Integer> enchAmounts = new LinkedList<Integer>();
|
||||
|
||||
for (Entry<Map<Enchantment, Material>, Integer> e : getQuestData(quest).itemsEnchanted.entrySet()) {
|
||||
@ -2164,14 +2172,14 @@ public class Quester {
|
||||
for (Entry<Enchantment, Material> 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<Integer> potionIds = new LinkedList<Integer>();
|
||||
LinkedList<String> potionNames = new LinkedList<String>();
|
||||
LinkedList<Integer> potionAmounts = new LinkedList<Integer>();
|
||||
|
||||
for (Entry<Integer, Integer> entry : getQuestData(quest).potionsBrewed.entrySet()) {
|
||||
for (Entry<String, Integer> 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<Integer> ids = questSec.getIntegerList("blocks-damaged-ids");
|
||||
List<String> names = questSec.getStringList("blocks-damaged-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("blocks-broken-ids");
|
||||
List<String> names = questSec.getStringList("blocks-broken-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("blocks-placed-ids");
|
||||
List<String> names = questSec.getStringList("blocks-placed-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("blocks-used-ids");
|
||||
List<String> names = questSec.getStringList("blocks-used-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("blocks-cut-ids");
|
||||
List<String> names = questSec.getStringList("blocks-cut-names");
|
||||
List<Integer> 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<Integer> amounts = new LinkedList<Integer>();
|
||||
|
||||
List<String> enchantNames = questSec.getStringList("enchantments");
|
||||
List<Integer> ids = questSec.getIntegerList("enchantment-item-ids");
|
||||
List<String> names = questSec.getStringList("enchantment-item-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("potions-brewed-ids");
|
||||
List<String> names = questSec.getStringList("potions-brewed-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("blocks-damaged-ids");
|
||||
List<String> names = questSec.getStringList("blocks-damaged-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("blocks-broken-ids");
|
||||
List<String> names = questSec.getStringList("blocks-broken-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("blocks-placed-ids");
|
||||
List<String> names = questSec.getStringList("blocks-placed-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("blocks-used-ids");
|
||||
List<String> names = questSec.getStringList("blocks-used-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("blocks-cut-ids");
|
||||
List<String> names = questSec.getStringList("blocks-cut-names");
|
||||
List<Integer> 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<String> enchantNames = questSec.getStringList("enchantments");
|
||||
List<Integer> ids = questSec.getIntegerList("enchantment-item-ids");
|
||||
List<String> names = questSec.getStringList("enchantment-item-names");
|
||||
List<Integer> 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<Integer> ids = questSec.getIntegerList("potions-brewed-ids");
|
||||
List<String> names = questSec.getStringList("potions-brewed-names");
|
||||
List<Integer> 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);
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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<Enchantment, Integer> enchs = null;
|
||||
@ -192,7 +188,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
lore = (LinkedList<String>) 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<Enchantment, Integer> enchs = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Enchantment, Integer> enchs = (Map<Enchantment, Integer>) 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<Enchantment, Integer> enchantments = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Enchantment, Integer> enchantments = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
|
||||
for (Entry<Enchantment, Integer> 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<String> lore = (List<String>) cc.getSessionData("tempLore");
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> lore = (List<String>) cc.getSessionData("tempLore");
|
||||
|
||||
item += DARKGREEN + "(Lore)\n\"";
|
||||
for (String s : lore) {
|
||||
|
@ -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);
|
||||
|
@ -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";
|
||||
|
@ -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:<br>
|
||||
* @return -1 -> stack ids are unequal<br>
|
||||
* @return -1 -> stack names are unequal<br>
|
||||
* @return -2 -> stack amounts are unequal<br>
|
||||
* @return -3 -> stack data is unequal<br>
|
||||
* @return -4 -> stack name/lore is unequal<br>
|
||||
* @return -4 -> stack display name/lore is unequal<br>
|
||||
* @return -5 -> stack enchantments are unequal<br>
|
||||
*/
|
||||
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<String> lore = new LinkedList<String>();
|
||||
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;
|
||||
|
@ -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 <data>:");
|
||||
|
||||
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");
|
||||
|
Loading…
Reference in New Issue
Block a user