diff --git a/pom.xml b/pom.xml index 13dc81139..e6620e441 100644 --- a/pom.xml +++ b/pom.xml @@ -1,129 +1,110 @@ - - 4.0.0 + + 4.0.0 - me.blackvein.quests - quests - 1.6.7-SNAPSHOT - quests - http://dev.bukkit.org/server-mods/quests/ - jar - + me.blackvein.quests + quests + 1.6.7-SNAPSHOT + quests + http://dev.bukkit.org/server-mods/quests/ + jar + - - UTF-8 - ${project.basedir}/lib - + + UTF-8 + - - - bukkit-repo - http://repo.bukkit.org/content/groups/public - - + + + bukkit-repo + http://repo.bukkit.org/content/groups/public + + citizens-repo http://repo.citizensnpcs.com - - denizens-repo - http://repo.citizensnpcs.com - - - vault-repo - http://ci.herocraftonline.com/plugin/repository/everything - - - mcMMO-repo - http://repo.mcmmo.org - + + denizens-repo + http://repo.citizensnpcs.com + + + vault-repo + http://ci.herocraftonline.com/plugin/repository/everything + + + mcMMO-repo + http://repo.mcmmo.org + - + - - - org.bukkit - craftbukkit - LATEST - - - net.citizensnpcs - citizens - 2.0.9-SNAPSHOT - - - net.aufdemrand - denizen - 0.9.2-SNAPSHOT - - - net.milkbowl.vault - Vault - 1.2.22-SNAPSHOT - - - com.gmail.nossr50.mcMMO - mcMMO - LATEST - - - me.ThaH3lper - EpicBoss - 1.0 - system - ${libs.dir}/EpicBossRecoded.jar - - + + + org.bukkit + craftbukkit + LATEST + + + net.citizensnpcs + citizens + 2.0.9-SNAPSHOT + + + net.aufdemrand + denizen + 0.9.1-SNAPSHOT + + + net.milkbowl.vault + Vault + 1.2.22-SNAPSHOT + + + com.gmail.nossr50.mcMMO + mcMMO + LATEST + + + me.ThaH3lper + EpicBoss + 1.0 + system + ${project.basedir}/lib/EpicBossRecoded.jar + + - - - - . - ${basedir}/src/main/resources/ - true - - config.yml - plugin.yml - events.yml - quests.yml - items.txt - - - - . - ${basedir}/ - false - - README.md - - - + + + + . + ${basedir}/src/main/resources/ + true + + config.yml + plugin.yml + events.yml + quests.yml + items.txt + + + + . + ${basedir}/ + false + + README.md + + + - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - true - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - true - - true - true - - - ${project.build.directory} - ${project.build.finalName} - - - - - + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + true + + + + + \ No newline at end of file diff --git a/src/main/java/me/blackvein/quests/Event.java b/src/main/java/me/blackvein/quests/Event.java index 1b8cea820..cec440be5 100644 --- a/src/main/java/me/blackvein/quests/Event.java +++ b/src/main/java/me/blackvein/quests/Event.java @@ -1,9 +1,19 @@ package me.blackvein.quests; import java.io.File; -import java.util.*; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + import me.blackvein.quests.util.ItemUtil; -import org.bukkit.*; +import me.blackvein.quests.util.QuestMob; + +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.EntityType; @@ -23,9 +33,23 @@ public class Event { int stormDuration = 0; World thunderWorld = null; int thunderDuration = 0; - LinkedList mobSpawnLocs = new LinkedList(); - LinkedList mobSpawnTypes = new LinkedList(); - LinkedList mobSpawnAmounts = new LinkedList(); + public LinkedList mobSpawns = new LinkedList() { + + @Override + public boolean equals(Object o) { + if (o instanceof LinkedList) { + + LinkedList other = (LinkedList) o; + + if (size() != other.size()) return false; + + for (int i = 0; i < size(); i++) { + if (get(i).equals(other.get(i)) == false) return false; + } + } + return false; + } + }; LinkedList lightningStrikes = new LinkedList(); LinkedList commands = new LinkedList(); LinkedList potionEffects = new LinkedList(); @@ -98,18 +122,9 @@ public class Event { if (other.thunderDuration != thunderDuration) { return false; } - - if (other.mobSpawnLocs.equals(mobSpawnLocs) == false) { - return false; - } - - if (other.mobSpawnTypes.equals(mobSpawnTypes) == false) { - return false; - } - - if (other.mobSpawnAmounts.equals(mobSpawnAmounts) == false) { - return false; - } + + if (other.mobSpawns.equals(mobSpawns) == false) + return false; if (other.lightningStrikes.equals(lightningStrikes) == false) { return false; @@ -205,19 +220,12 @@ public class Event { thunderWorld.setThundering(true); thunderWorld.setThunderDuration(thunderDuration); } - - if (mobSpawnLocs.isEmpty() == false) { - - for (Location l : mobSpawnLocs) { - - for (int i = 1; i <= mobSpawnAmounts.get(mobSpawnLocs.indexOf(l)); i++) { - - l.getWorld().spawnEntity(l, mobSpawnTypes.get(mobSpawnLocs.indexOf(l))); - - } - - } - + + if (mobSpawns.isEmpty() == false) { + + for (QuestMob questMob : mobSpawns) { + questMob.spawn(); + } } if (lightningStrikes.isEmpty() == false) { @@ -457,71 +465,54 @@ public class Event { } } - - if (data.contains(eventKey + "mob-spawn-locations")) { - - if (Quests.checkList(data.getList(eventKey + "mob-spawn-locations"), String.class)) { - - if (data.contains(eventKey + "mob-spawn-types")) { - - if (Quests.checkList(data.getList(eventKey + "mob-spawn-types"), String.class)) { - - if (data.contains(eventKey + "mob-spawn-amounts")) { - - if (Quests.checkList(data.getList(eventKey + "mob-spawn-amounts"), Integer.class)) { - - List mobLocs = data.getStringList(eventKey + "mob-spawn-locations"); - List mobTypes = data.getStringList(eventKey + "mob-spawn-types"); - List mobAmounts = data.getIntegerList(eventKey + "mob-spawn-amounts"); - - for (String s : mobLocs) { - - Location location = Quests.getLocation(s); - if (location == null) { - Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD + " inside " + ChatColor.GREEN + " mob-spawn-locations: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!"); - Quests.printSevere(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\""); - return null; - } - - EntityType type = Quests.getMobType(mobTypes.get(mobLocs.indexOf(s))); - if (type == null) { - Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + mobTypes.get(mobLocs.indexOf(s)) + ChatColor.GOLD + " inside " + ChatColor.GREEN + " mob-spawn-types: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a valid mob name!"); - return null; - } - - int amount = mobAmounts.get(mobLocs.indexOf(s)); - - event.mobSpawnLocs.add(location); - event.mobSpawnTypes.add(type); - event.mobSpawnAmounts.add(amount); - - } - - } else { - Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "mob-spawn-amounts: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of numbers!"); - return null; - } - - } else { - Quests.printSevere(ChatColor.GOLD + "[Quests] Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is missing " + ChatColor.RED + "mob-spawn-amounts:"); - return null; - } - - } else { - Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "mob-spawn-types: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of mob names!"); - return null; - } - - } else { - Quests.printSevere(ChatColor.GOLD + "[Quests] Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is missing " + ChatColor.RED + "mob-spawn-types:"); + + if (data.contains(eventKey + "mob-spawns")) { + ConfigurationSection section = data.getConfigurationSection(eventKey + "mob-spawns"); + + //is a mob, the keys are just a number or something. + for (String s : section.getKeys(false)) { + String mobName = section.getString(s + ".name"); + Location spawnLocation = Quests.getLocation(section.getString(s + ".spawn-location")); + EntityType type = Quests.getMobType(section.getString(s + ".mob-type")); + Integer mobAmount = section.getInt(s + ".spawn-amounts"); + + + if (spawnLocation == null) { + Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD + " inside " + ChatColor.GREEN + " mob-spawn-locations: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!"); + Quests.printSevere(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\""); + return null; + } + + if (type == null) { + Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + section.getString(s + ".mob-type") + ChatColor.GOLD + " inside " + ChatColor.GREEN + " mob-spawn-types: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a valid mob name!"); return null; } + + ItemStack[] inventory = new ItemStack[5]; + Float[] dropChances = new Float[5]; + + inventory[0] = ItemUtil.readItemStack(section.getString(s + ".held-item")); + dropChances[0] = (float) section.getDouble(s + ".held-item-drop-chance"); - } else { - Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "mob-spawn-locations: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of locations!"); - return null; - } + inventory[1] = ItemUtil.readItemStack(section.getString(s + ".boots")); + dropChances[1] = (float) section.getDouble(s + ".boots-drop-chance"); + inventory[2] = ItemUtil.readItemStack(section.getString(s + ".leggings")); + dropChances[2] = (float) section.getDouble(s + ".leggings-drop-chance"); + + inventory[3] = ItemUtil.readItemStack(section.getString(s + ".chest-plate")); + dropChances[3] = (float) section.getDouble(s + ".chest-plate-drop-chance"); + + inventory[4] = ItemUtil.readItemStack(section.getString(s + ".helmet")); + dropChances[4] = (float) section.getDouble(s + ".helmet-drop-chance"); + + QuestMob questMob = new QuestMob(type, spawnLocation, mobAmount); + questMob.inventory = inventory; + questMob.dropChances = dropChances; + questMob.setName(mobName); + + event.mobSpawns.add(questMob); + } } if (data.contains(eventKey + "lightning-strikes")) { diff --git a/src/main/java/me/blackvein/quests/EventFactory.java b/src/main/java/me/blackvein/quests/EventFactory.java index f3ccca647..1d599c0b4 100644 --- a/src/main/java/me/blackvein/quests/EventFactory.java +++ b/src/main/java/me/blackvein/quests/EventFactory.java @@ -7,10 +7,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.util.CK; import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.Lang; +import me.blackvein.quests.util.QuestMob; import net.citizensnpcs.api.CitizensAPI; import org.apache.commons.lang.StringUtils; @@ -21,7 +23,15 @@ import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.conversations.*; +import org.bukkit.conversations.ConversationAbandonedEvent; +import org.bukkit.conversations.ConversationAbandonedListener; +import org.bukkit.conversations.ConversationContext; +import org.bukkit.conversations.ConversationFactory; +import org.bukkit.conversations.ConversationPrefix; +import org.bukkit.conversations.FixedSetPrompt; +import org.bukkit.conversations.NumericPrompt; +import org.bukkit.conversations.Prompt; +import org.bukkit.conversations.StringPrompt; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; @@ -184,8 +194,6 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ context.setSessionData(CK.E_WORLD_THUNDER, null); context.setSessionData(CK.E_WORLD_THUNDER_DURATION, null); context.setSessionData(CK.E_MOB_TYPES, null); - context.setSessionData(CK.E_MOB_AMOUNTS, null); - context.setSessionData(CK.E_MOB_LOCATIONS, null); context.setSessionData(CK.E_LIGHTNING, null); context.setSessionData(CK.E_POTION_TYPES, null); context.setSessionData(CK.E_POTION_DURATIONS, null); @@ -233,7 +241,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ LinkedList effs = new LinkedList(); LinkedList locs = new LinkedList(); - for(Entry e : event.effects.entrySet()){ + for(Entry e : event.effects.entrySet()){ effs.add(((Effect) e.getKey()).toString()); locs.add(Quests.getLocationInfo((Location) e.getValue())); @@ -259,24 +267,15 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ } - if(event.mobSpawnTypes != null && event.mobSpawnTypes.isEmpty() == false){ - - LinkedList types = new LinkedList(); - LinkedList locs = new LinkedList(); - LinkedList amounts = new LinkedList(); - - for(int i = 0; i < event.mobSpawnTypes.size(); i++){ - - types.add(Quester.prettyMobString(event.mobSpawnTypes.get(i))); - locs.add(Quests.getLocationInfo(event.mobSpawnLocs.get(i))); - amounts.add(event.mobSpawnAmounts.get(i)); - - } - - context.setSessionData(CK.E_MOB_TYPES, types); - context.setSessionData(CK.E_MOB_AMOUNTS, amounts); - context.setSessionData(CK.E_MOB_LOCATIONS, locs); - + if (event.mobSpawns != null && event.mobSpawns.isEmpty() == false) { + + LinkedList questMobs = new LinkedList(); + + for (QuestMob questMob : event.mobSpawns) { + questMobs.add(questMob.serialize()); + } + + context.setSessionData(CK.E_MOB_TYPES, questMobs); } if(event.lightningStrikes != null && event.lightningStrikes.isEmpty() == false){ @@ -571,15 +570,12 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobSpawns") + GRAY + " (" + Lang.get("noneSet") + ")\n"; } else { LinkedList types = (LinkedList) context.getSessionData(CK.E_MOB_TYPES); - LinkedList amounts = (LinkedList) context.getSessionData(CK.E_MOB_AMOUNTS); - LinkedList locations = (LinkedList) context.getSessionData(CK.E_MOB_LOCATIONS); text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobSpawns") + "\n"; for (String s : types) { - int amt = amounts.get(types.indexOf(s)); - String loc = locations.get(types.indexOf(s)); - text += GRAY + " - " + AQUA + s + GRAY + " x " + DARKAQUA + amt + GRAY + " -> " + GREEN + loc + "\n"; + QuestMob qm = QuestMob.fromString(s); + text += GRAY + " - " + AQUA + qm.getType().getName() + ((qm.getName() != null) ? ": " + qm.getName() : "") + GRAY + " x " + DARKAQUA + qm.getSpawnAmounts() + GRAY + " -> " + GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n"; } } @@ -862,7 +858,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ return (String)context.getSessionData(path); } - private static LinkedList getCStringList(ConversationContext context, String path){ + @SuppressWarnings("unchecked") + private static LinkedList getCStringList(ConversationContext context, String path){ return (LinkedList)context.getSessionData(path); } @@ -870,7 +867,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ return (Integer)context.getSessionData(path); } - private static LinkedList getCIntList(ConversationContext context, String path){ + @SuppressWarnings("unchecked") + private static LinkedList getCIntList(ConversationContext context, String path){ return (LinkedList)context.getSessionData(path); } @@ -878,7 +876,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ return (Boolean)context.getSessionData(path); } - private static LinkedList getCBooleanList(ConversationContext context, String path){ + @SuppressWarnings("unchecked") + private static LinkedList getCBooleanList(ConversationContext context, String path){ return (LinkedList)context.getSessionData(path); } @@ -886,7 +885,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ return (Long)context.getSessionData(path); } - private static LinkedList getCLongList(ConversationContext context, String path){ + @SuppressWarnings("unchecked") + private static LinkedList getCLongList(ConversationContext context, String path){ return (LinkedList)context.getSessionData(path); } // @@ -1007,16 +1007,39 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ } + try { if (context.getSessionData(CK.E_MOB_TYPES) != null) { - - LinkedList types = getCStringList(context, CK.E_MOB_TYPES); - LinkedList amounts = getCIntList(context, CK.E_MOB_AMOUNTS); - LinkedList locations = getCStringList(context, CK.E_MOB_LOCATIONS); - - section.set("mob-spawn-types", types); - section.set("mob-spawn-amounts", amounts); - section.set("mob-spawn-locations", locations); - + int count = 0; + + for (String s : getCStringList(context, CK.E_MOB_TYPES)) { + ConfigurationSection ss = section.getConfigurationSection("mob-spawns." + count); + if (ss == null) { + ss = section.createSection("mob-spawns." + count); + } + QuestMob questMob = QuestMob.fromString(s); + + if (questMob == null) continue; + + ss.set("name", questMob.getName()); + ss.set("spawn-location", Quests.getLocationInfo(questMob.getSpawnLocation())); + ss.set("mob-type", questMob.getType().getName()); + ss.set("spawn-amounts", questMob.getSpawnAmounts()); + ss.set("held-item", ItemUtil.serialize(questMob.inventory[0])); + ss.set("held-item-drop-chance", questMob.dropChances[0]); + ss.set("boots", ItemUtil.serialize(questMob.inventory[1])); + ss.set("boots-drop-chance", questMob.dropChances[1]); + ss.set("leggings", ItemUtil.serialize(questMob.inventory[2])); + ss.set("leggings-drop-chance", questMob.dropChances[2]); + ss.set("chest-plate", ItemUtil.serialize(questMob.inventory[3])); + ss.set("chest-plate-drop-chance", questMob.dropChances[3]); + ss.set("helmet", ItemUtil.serialize(questMob.inventory[4])); + ss.set("helmet-drop-chance", questMob.dropChances[4]); + count++; + } + + } + } catch (Exception e) { + e.printStackTrace(); } if (context.getSessionData(CK.E_LIGHTNING) != null) { @@ -1029,7 +1052,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ if (context.getSessionData(CK.E_COMMANDS) != null) { LinkedList commands = getCStringList(context, CK.E_COMMANDS); - section.set("commands", commands); + if (commands.isEmpty() == false) + section.set("commands", commands); } @@ -1855,57 +1879,27 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ } } - private class MobPrompt extends FixedSetPrompt { - - public MobPrompt() { - - super("1", "2", "3", "4", "5"); - - } + private class MobPrompt extends StringPrompt { @Override public String getPromptText(ConversationContext context) { String text = GOLD + "- " + Lang.get("eventEditorMobSpawns") + " -\n"; if (context.getSessionData(CK.E_MOB_TYPES) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobTypes") + " (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - " + Lang.get("eventEditorSetMobAmounts") + " " + Lang.get("eventEditorNoTypesSet") + "\n"; - text += GRAY + "3 - " + Lang.get("eventEditorAddSpawnLocation") + " " + Lang.get("eventEditorNoTypesSet") + "\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done"); + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorAddMobTypes") + " (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("done"); } else { - - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobTypes") + "\n"; - for (String s : (LinkedList) context.getSessionData(CK.E_MOB_TYPES)) { - text += GRAY + " - " + AQUA + s + "\n"; + LinkedList types = (LinkedList) context.getSessionData(CK.E_MOB_TYPES); + + for (int i = 0; i < types.size(); i++) { + QuestMob qm = QuestMob.fromString(types.get(i)); + text += GOLD + " " + (i + 1) + " - Edit: " + AQUA + qm.getType().getName() + ((qm.getName() != null) ? ": " + qm.getName() : "") + GRAY + " x " + DARKAQUA + qm.getSpawnAmounts() + GRAY + " -> " + GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n"; } - if (context.getSessionData(CK.E_MOB_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobAmounts") + " (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "3 - " + Lang.get("eventEditorAddSpawnLocation") + Lang.get("eventEditorNoAmountsSet") + "\n"; - } else { - - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobAmounts") + "\n"; - for (int i : (LinkedList) context.getSessionData(CK.E_MOB_AMOUNTS)) { - text += GRAY + " - " + DARKAQUA + i + "\n"; - } - - - if (context.getSessionData(CK.E_MOB_LOCATIONS) == null) { - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("eventEditorAddSpawnLocation") + " (" + Lang.get("noneSet") + ")\n"; - } else { - - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("eventEditorAddSpawnLocation") + "\n"; - for (String s : (LinkedList) context.getSessionData(CK.E_MOB_LOCATIONS)) { - text += GRAY + " - " + GREEN + s + "\n"; - } - - } - - } - - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; - text += GREEN + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done"); + text += BLUE + "" + BOLD + (types.size() + 1) + RESET + YELLOW + " - " + Lang.get("eventEditorAddMobTypes") + "\n"; + text += BLUE + "" + BOLD + (types.size() + 2) + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += GREEN + "" + BOLD + (types.size() + 3) + RESET + YELLOW + " - " + Lang.get("done"); } @@ -1913,78 +1907,223 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ } - @Override - protected Prompt acceptValidatedInput(ConversationContext context, String input) { - - if (input.equalsIgnoreCase("1")) { - return new MobTypesPrompt(); - } else if (input.equalsIgnoreCase("2")) { - if (context.getSessionData(CK.E_MOB_TYPES) == null) { - context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorMustSetMobTypesFirst")); + @Override + public Prompt acceptInput(ConversationContext context, String input) { + + if (context.getSessionData(CK.E_MOB_TYPES) == null) { + if (input.equalsIgnoreCase("1")) { + return new QuestMobPrompt(0, null); + } else if (input.equalsIgnoreCase("2")) { + context.getForWhom().sendRawMessage(YELLOW + Lang.get("eventEditorMobSpawnsCleared")); + context.setSessionData(CK.E_MOB_TYPES, null); return new MobPrompt(); - } else { - return new MobAmountsPrompt(); - } - } else if (input.equalsIgnoreCase("3")) { - if (context.getSessionData(CK.E_MOB_TYPES) == null) { - context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorMustSetMobTypesAndAmountsFirst")); - return new MobPrompt(); - } else if (context.getSessionData(CK.E_MOB_AMOUNTS) == null) { - context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorMustSetMobAmountsFirst")); - return new MobPrompt(); - } else { - selectedMobLocations.put((Player) context.getForWhom(), null); - return new MobLocationPrompt(); - } - } else if (input.equalsIgnoreCase("4")) { - context.getForWhom().sendRawMessage(YELLOW + Lang.get("eventEditorMobSpawnsCleared")); - context.setSessionData(CK.E_MOB_TYPES, null); - context.setSessionData(CK.E_MOB_AMOUNTS, null); - context.setSessionData(CK.E_MOB_LOCATIONS, null); - return new MobPrompt(); - } else if (input.equalsIgnoreCase("5")) { - - int one; - int two; - int three; - - if (context.getSessionData(CK.E_MOB_TYPES) != null) { - one = ((List) context.getSessionData(CK.E_MOB_TYPES)).size(); - } else { - one = 0; - } - - if (context.getSessionData(CK.E_MOB_AMOUNTS) != null) { - two = ((List) context.getSessionData(CK.E_MOB_AMOUNTS)).size(); - } else { - two = 0; - } - - if (context.getSessionData(CK.E_MOB_LOCATIONS) != null) { - three = ((List) context.getSessionData(CK.E_MOB_LOCATIONS)).size(); - } else { - three = 0; - } - - if (one == two && two == three) { - return new CreateMenuPrompt(); - } else { - context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorListSizeMismatch")); - return new MobPrompt(); - } - - } - return null; - - } + } else if (input.equalsIgnoreCase("3")) { + return new CreateMenuPrompt(); + } + } else { + LinkedList types = (LinkedList) context.getSessionData(CK.E_MOB_TYPES); + int inp = -1; + try { + inp = Integer.parseInt(input); + } catch (Exception e) { + context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorNotANumber")); + return new MobPrompt(); + } + + if (inp == types.size() + 1) { + return new QuestMobPrompt(inp - 1, null); + } else if (inp == types.size() + 2) { + context.getForWhom().sendRawMessage(YELLOW + Lang.get("eventEditorMobSpawnsCleared")); + context.setSessionData(CK.E_MOB_TYPES, null); + return new MobPrompt(); + } else if (inp == types.size() + 3) { + return new CreateMenuPrompt(); + } else if (inp > types.size()){ + return new MobPrompt(); + } else { + return new QuestMobPrompt(inp - 1, QuestMob.fromString(types.get(inp - 1))); + } + } + + return new MobPrompt(); + } } - private class MobTypesPrompt extends StringPrompt { + private class QuestMobPrompt extends StringPrompt { - @Override + private QuestMob questMob; + private Integer itemIndex = -1; + private Integer mobIndex; + + public QuestMobPrompt(int mobIndex, QuestMob questMob) { + this.questMob = questMob; + this.mobIndex = mobIndex; + } + + @Override public String getPromptText(ConversationContext context) { - String mobs = PINK + "- " + Lang.get("mobs") + " - \n"; + String text = GOLD + "- " + Lang.get("eventEditorAddMobTypes") + " - \n"; + + if (questMob == null) { + questMob = new QuestMob(); + } + + // Check/add newly made item + + if(context.getSessionData("newItem") != null){ + if(itemIndex >= 0){ + questMob.inventory[itemIndex] = ((ItemStack) context.getSessionData("tempStack")); + itemIndex = -1; + } + + context.setSessionData("newItem", null); + context.setSessionData("tempStack", null); + + } + + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobName") + GRAY + " (" + ((questMob.getName() == null) ? Lang.get("noneSet") : AQUA + questMob.getName()) + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobType") + GRAY + " (" + ((questMob.getType() == null) ? Lang.get("eventEditorNoTypesSet") : AQUA + questMob.getType().getName()) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("eventEditorAddSpawnLocation") + GRAY + " (" + ((questMob.getSpawnLocation() == null) ? GRAY + Lang.get("noneSet") : AQUA + Quests.getLocationInfo(questMob.getSpawnLocation()) ) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobSpawnAmount") + GRAY +" (" + ((questMob.getSpawnAmounts() == null) ? GRAY + Lang.get("eventEditorNoAmountsSet") : AQUA + "" + questMob.getSpawnAmounts()) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobItemInHand") + GRAY +" (" + ((questMob.inventory[0] == null) ? GRAY + Lang.get("noneSet") : AQUA + ItemUtil.getDisplayString(questMob.inventory[0])) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobItemInHandDrop") + GRAY + " (" + ((questMob.dropChances[0] == null) ? GRAY + Lang.get("noneSet") : AQUA + "" + questMob.dropChances[0]) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobBoots") + GRAY + " (" + ((questMob.inventory[1] == null) ? GRAY + Lang.get("noneSet") : AQUA + ItemUtil.getDisplayString(questMob.inventory[1])) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobBootsDrop") + GRAY + " (" + ((questMob.dropChances[1] == null) ? GRAY + Lang.get("noneSet") : AQUA + "" + questMob.dropChances[1]) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobLeggings") + GRAY + " (" + ((questMob.inventory[2] == null) ? GRAY + Lang.get("noneSet") : AQUA + ItemUtil.getDisplayString(questMob.inventory[2])) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "10" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobLeggingsDrop") + GRAY + " (" + ((questMob.dropChances[2] == null) ? GRAY + Lang.get("noneSet") : AQUA + "" + questMob.dropChances[2]) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "11" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobChestPlate") + GRAY + " (" + ((questMob.inventory[3] == null) ? GRAY + Lang.get("noneSet") : AQUA + ItemUtil.getDisplayString(questMob.inventory[3])) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "12" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobChestPlateDrop") + GRAY + " (" + ((questMob.dropChances[3] == null) ? GRAY + Lang.get("noneSet") : AQUA + "" + questMob.dropChances[3]) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "13" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobHelmet") + GRAY + " (" + ((questMob.inventory[4] == null) ? GRAY + Lang.get("noneSet") : AQUA + ItemUtil.getDisplayString(questMob.inventory[4])) + GRAY + ")\n"; + text += BLUE + "" + BOLD + "14" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobHelmetDrop") + GRAY + " (" + ((questMob.dropChances[4] == null) ? GRAY + Lang.get("noneSet") : AQUA + "" + questMob.dropChances[4]) + GRAY + ")\n"; + + + text += GREEN + "" + BOLD + "15" + RESET + YELLOW + " - " + Lang.get("done") + "\n"; + text += RED + "" + BOLD + "16" + RESET + YELLOW + " - " + Lang.get("cancel"); + + return text; + + } + + @SuppressWarnings("unchecked") + @Override + public Prompt acceptInput(ConversationContext context, String input) { + + if (input.equalsIgnoreCase("1")) { + return new MobNamePrompt(mobIndex, questMob); + } else if (input.equalsIgnoreCase("2")) { + return new MobTypePrompt(mobIndex, questMob); + } else if (input.equalsIgnoreCase("3")) { + selectedMobLocations.put((Player) context.getForWhom(), null); + return new MobLocationPrompt(mobIndex, questMob); + } else if (input.equalsIgnoreCase("4")) { + return new MobAmountPrompt(mobIndex, questMob); + } else if (input.equalsIgnoreCase("5")) { + itemIndex = 0; + return new ItemStackPrompt(QuestMobPrompt.this); + } else if (input.equalsIgnoreCase("6")) { + return new MobDropPrompt(0, mobIndex, questMob); + } else if (input.equalsIgnoreCase("7")) { + itemIndex = 1; + return new ItemStackPrompt(QuestMobPrompt.this); + } else if (input.equalsIgnoreCase("8")) { + return new MobDropPrompt(1, mobIndex, questMob); + } else if (input.equalsIgnoreCase("9")) { + itemIndex = 2; + return new ItemStackPrompt(QuestMobPrompt.this); + } else if (input.equalsIgnoreCase("10")) { + return new MobDropPrompt(2, mobIndex, questMob); + } else if (input.equalsIgnoreCase("11")) { + itemIndex = 3; + return new ItemStackPrompt(QuestMobPrompt.this); + } else if (input.equalsIgnoreCase("12")) { + return new MobDropPrompt(3, mobIndex, questMob); + } else if (input.equalsIgnoreCase("13")) { + itemIndex = 4; + return new ItemStackPrompt(QuestMobPrompt.this); + } else if (input.equalsIgnoreCase("14")) { + return new MobDropPrompt(4, mobIndex, questMob); + } else if (input.equalsIgnoreCase("15")) { + if (questMob.getType() == null) { + context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorMustSetMobTypesFirst")); + return new QuestMobPrompt(mobIndex, questMob); + } else if (questMob.getSpawnLocation() == null) { + context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorMustSetMobLocationFirst")); + return new QuestMobPrompt(mobIndex, questMob); + } else if (questMob.getSpawnAmounts() == null) { + context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorMustSetMobAmountsFirst")); + return new QuestMobPrompt(mobIndex, questMob); + } + if (context.getSessionData(CK.E_MOB_TYPES) == null) { + LinkedList list = new LinkedList(); + list.add(questMob.serialize()); + context.setSessionData(CK.E_MOB_TYPES, list); + } else { + if (((LinkedList) context.getSessionData(CK.E_MOB_TYPES)).isEmpty()) { + LinkedList list = new LinkedList(); + list.add(questMob.serialize()); + context.setSessionData(CK.E_MOB_TYPES, list); + } else { + LinkedList list = (LinkedList) context.getSessionData(CK.E_MOB_TYPES); + list.set(mobIndex, questMob.serialize()); + context.setSessionData(CK.E_MOB_TYPES, list); + } + } + return new MobPrompt(); + } else if (input.equalsIgnoreCase("16")) { + return new MobPrompt(); + } else { + return new QuestMobPrompt(mobIndex, questMob); + } + + } + } + + private class MobNamePrompt extends StringPrompt { + + private QuestMob questMob; + private Integer mobIndex; + + public MobNamePrompt (int mobIndex, QuestMob questMob) { + this.questMob = questMob; + this.mobIndex = mobIndex; + } + + @Override + public String getPromptText(ConversationContext context) { + String text = YELLOW + Lang.get("eventEditorSetMobNamePrompt"); + return text; + } + + @Override + public Prompt acceptInput(ConversationContext context, String input) { + + if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { + return new QuestMobPrompt(mobIndex, questMob); + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { + questMob.setName(null); + return new QuestMobPrompt(mobIndex, questMob); + } else { + input = ChatColor.translateAlternateColorCodes('&', input); + questMob.setName(input); + return new QuestMobPrompt(mobIndex, questMob); + } + } + } + + private class MobTypePrompt extends StringPrompt { + + private QuestMob questMob; + private Integer mobIndex; + + public MobTypePrompt (int mobIndex, QuestMob questMob) { + this.questMob = questMob; + this.mobIndex = mobIndex; + } + + @Override + public String getPromptText(ConversationContext arg0) { + String mobs = PINK + "- " + Lang.get("mobs") + " - \n"; mobs += PURPLE + "Bat, "; mobs += PURPLE + "Blaze, "; mobs += PURPLE + "CaveSpider, "; @@ -2015,40 +2154,38 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ mobs += PURPLE + "Zombie\n"; return mobs + YELLOW + Lang.get("eventEditorSetMobTypesPrompt"); + } + + @Override + public Prompt acceptInput(ConversationContext context, String input) { + Player player = (Player) context.getForWhom(); - } + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { - @Override - public Prompt acceptInput(ConversationContext context, String input) { + if (Quests.getMobType(input) != null) { - Player player = (Player) context.getForWhom(); + questMob.setType(Quests.getMobType(input)); + + } else { + player.sendMessage(PINK + input + " " + RED + Lang.get("eventEditorInvalidMob")); + return new MobTypePrompt(mobIndex, questMob); + } + } - if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { - - LinkedList mobTypes = new LinkedList(); - for (String s : input.split(" ")) { - - if (Quests.getMobType(s) != null) { - - mobTypes.add(Quester.prettyMobString(Quests.getMobType(s))); - context.setSessionData(CK.E_MOB_TYPES, mobTypes); - - } else { - player.sendMessage(PINK + s + " " + RED + Lang.get("eventEditorInvalidMob")); - return new MobTypesPrompt(); - } - - } - - } - - return new MobPrompt(); - - } + return new QuestMobPrompt(mobIndex, questMob); + } } - private class MobAmountsPrompt extends StringPrompt { + private class MobAmountPrompt extends StringPrompt { + private QuestMob questMob; + private Integer mobIndex; + + public MobAmountPrompt (int mobIndex, QuestMob questMob) { + this.questMob = questMob; + this.mobIndex = mobIndex; + } + @Override public String getPromptText(ConversationContext context) { @@ -2063,43 +2200,43 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { - LinkedList mobAmounts = new LinkedList(); - for (String s : input.split(" ")) { - try { - int i = Integer.parseInt(s); + int i = Integer.parseInt(input); if (i < 1) { player.sendMessage(PINK + input + " " + RED + Lang.get("eventEditorNotGreaterThanZero")); - return new MobAmountsPrompt(); + return new MobAmountPrompt(mobIndex, questMob); } - mobAmounts.add(i); - - + questMob.setSpawnAmounts(i); + return new QuestMobPrompt(mobIndex, questMob); } catch (Exception e) { player.sendMessage(PINK + input + " " + RED + Lang.get("eventEditorNotANumber")); - return new MobAmountsPrompt(); + return new MobAmountPrompt(mobIndex, questMob); } - } - - context.setSessionData(CK.E_MOB_AMOUNTS, mobAmounts); - } - return new MobPrompt(); + return new QuestMobPrompt(mobIndex, questMob); } } private class MobLocationPrompt extends StringPrompt { + + private QuestMob questMob; + private Integer mobIndex; + + public MobLocationPrompt (int mobIndex, QuestMob questMob) { + this.questMob = questMob; + this.mobIndex = mobIndex; + } @Override public String getPromptText(ConversationContext context) { - return YELLOW + Lang.get("eventEditorMobLocationPrompt"); + return YELLOW + Lang.get("eventEditorSetMobLocationPrompt"); } @@ -2115,36 +2252,71 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{ Location loc = block.getLocation(); - LinkedList locs; - if (context.getSessionData(CK.E_MOB_LOCATIONS) != null) { - locs = (LinkedList) context.getSessionData(CK.E_MOB_LOCATIONS); - } else { - locs = new LinkedList(); - } - - locs.add(Quests.getLocationInfo(loc)); - context.setSessionData(CK.E_MOB_LOCATIONS, locs); + questMob.setSpawnLocation(loc); selectedMobLocations.remove(player); } else { player.sendMessage(RED + Lang.get("eventEditorSelectBlockFirst")); - return new MobLocationPrompt(); + return new MobLocationPrompt(mobIndex, questMob); } - return new MobPrompt(); + return new QuestMobPrompt(mobIndex, questMob); } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { selectedMobLocations.remove(player); - return new MobPrompt(); + return new QuestMobPrompt(mobIndex, questMob); } else { - return new MobLocationPrompt(); + return new MobLocationPrompt(mobIndex, questMob); } } } + private class MobDropPrompt extends StringPrompt { + + private QuestMob questMob; + private Integer mobIndex; + private Integer invIndex; + + public MobDropPrompt (int invIndex, int mobIndex ,QuestMob questMob) { + this.questMob = questMob; + this.mobIndex = mobIndex; + this.invIndex = invIndex; + } + + @Override + public String getPromptText(ConversationContext context) { + String text = YELLOW + Lang.get("eventEditorSetDropChance"); + return text; + } + + @Override + public Prompt acceptInput(ConversationContext context, String input) { + float chance = 0.0F; + + if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { + return new QuestMobPrompt(mobIndex, questMob); + } + + try { + chance = Float.parseFloat(input); + } catch (Exception e) { + context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorInvalidDropChance")); + return new MobDropPrompt(invIndex, mobIndex, questMob); + } + if (chance > 1 || chance < 0) { + context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorInvalidDropChance")); + return new MobDropPrompt(invIndex, mobIndex, questMob); + } + + questMob.dropChances[invIndex] = chance; + + return new QuestMobPrompt(mobIndex, questMob); + } + } + private class LightningPrompt extends StringPrompt { @Override diff --git a/src/main/java/me/blackvein/quests/NpcListener.java b/src/main/java/me/blackvein/quests/NpcListener.java index b7e83b4fb..09cc09ff7 100644 --- a/src/main/java/me/blackvein/quests/NpcListener.java +++ b/src/main/java/me/blackvein/quests/NpcListener.java @@ -82,13 +82,17 @@ public class NpcListener implements Listener { for (Quest q : plugin.getQuests()) { if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) { - npcQuests.add(q); + if (Quests.ignoreLockedQuests) { + if (q.testRequirements(quester) && (q.redoDelay <= 0)) { + npcQuests.add(q); + } + } else { + npcQuests.add(q); + } } } - - if (npcQuests.isEmpty() == false && npcQuests.size() > 1) { Conversation c = plugin.NPCConversationFactory.buildConversation((Conversable) player); diff --git a/src/main/java/me/blackvein/quests/PlayerListener.java b/src/main/java/me/blackvein/quests/PlayerListener.java index 4fe4e6754..2e6d5a81b 100644 --- a/src/main/java/me/blackvein/quests/PlayerListener.java +++ b/src/main/java/me/blackvein/quests/PlayerListener.java @@ -2,6 +2,7 @@ package me.blackvein.quests; import java.io.File; +import me.blackvein.quests.events.MiniEvent.MiniEventType; import net.citizensnpcs.api.CitizensAPI; import org.bukkit.ChatColor; @@ -404,6 +405,7 @@ public class PlayerListener implements Listener { if (okay) { Quester quester = plugin.getQuester(player.getName()); + if (quester.hasObjective("killMob")) { quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType()); } @@ -470,6 +472,7 @@ public class PlayerListener implements Listener { if (okay) { Quester quester = plugin.getQuester(player.getName()); + if (quester.hasObjective("killPlayer")) { quester.killPlayer(evt.getEntity().getName()); } @@ -605,6 +608,14 @@ public class PlayerListener implements Listener { if (isPlayer) { Quester quester = plugin.getQuester(evt.getPlayer().getName()); + + if (quester.currentStage != null) { + boolean isCancelled = quester.currentStage.executeReachEvent(evt.getTo(), quester); + + if(isCancelled) { + evt.setCancelled(isCancelled); + } + } if (quester.hasObjective("reachLocation")) { @@ -617,4 +628,20 @@ public class PlayerListener implements Listener { } } + + public void onEntityDamage(EntityDamageByEntityEvent evt) { + if (evt.getEntity() instanceof Player) { + double health = ((Damageable) evt.getEntity()).getHealth(); + if (evt.getDamage() >= health) { + Quester quester = plugin.getQuester(((Player) evt.getEntity()).getName()); + evt.setCancelled(quester.currentStage.executeEvent(quester, MiniEventType.ONDEATH)); + + } + } else if (evt.getDamager() instanceof Player) { + if (evt.getDamage() >= ((Damageable) evt.getEntity()).getHealth()) { + Quester quester = plugin.getQuester(((Player) evt.getDamager()).getName()); + evt.setCancelled(quester.currentStage.executeKillEvent(quester, evt.getEntityType())); + } + } + } } diff --git a/src/main/java/me/blackvein/quests/Quest.java b/src/main/java/me/blackvein/quests/Quest.java index 4f5a5292e..e49bad226 100644 --- a/src/main/java/me/blackvein/quests/Quest.java +++ b/src/main/java/me/blackvein/quests/Quest.java @@ -1,19 +1,19 @@ package me.blackvein.quests; -import com.gmail.nossr50.api.ExperienceAPI; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.util.player.UserManager; - import java.util.LinkedList; import java.util.List; + import me.blackvein.quests.util.ItemUtil; import net.citizensnpcs.api.npc.NPC; + import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import com.gmail.nossr50.util.player.UserManager; + public class Quest { public String name; @@ -66,7 +66,7 @@ public class Quest { if(q.currentStage.delay < 0){ Player player = q.getPlayer(); - if(stages.indexOf(q.currentStage) == (q.currentQuest.stages.size() - 1)){ + if(q.currentStageIndex == (q.currentQuest.stages.size() - 1)){ if(q.currentStage.script != null) plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player); @@ -76,28 +76,10 @@ public class Quest { completeQuest(q); }else { - - q.reset(); - if(q.currentStage.script != null) - plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player); - if(q.currentStage.event != null) - q.currentStage.event.happen(q); - q.currentStage = stages.get(q.currentStageIndex + 1); - q.currentStageIndex++; - q.addEmpties(); - - player.sendMessage(ChatColor.GOLD + "---(Objectives)---"); - for(String s : q.getObjectives()){ - - player.sendMessage(s); - - } - - String stageStartMessage = q.currentStage.startMessage; - if (stageStartMessage != null) { - q.getPlayer().sendMessage(Quests.parseString(stageStartMessage, q.currentQuest)); - } - + + q.currentStageIndex++; + setStage(q, q.currentStageIndex); + } q.delayStartTime = 0; @@ -109,6 +91,37 @@ public class Quest { } } + + public void setStage(Quester q, int stage) { + + if (stages.size() - 1 < stage) { + return; + } + + q.reset(); + + if(q.currentStage.script != null) + plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, q.getPlayer()); + + if(q.currentStage.event != null) + q.currentStage.event.happen(q); + + q.currentStage = stages.get(stage); + q.addEmpties(); + + q.getPlayer().sendMessage(ChatColor.GOLD + "---(Objectives)---"); + for(String s : q.getObjectives()){ + + q.getPlayer().sendMessage(s); + + } + + String stageStartMessage = q.currentStage.startMessage; + if (stageStartMessage != null) { + q.getPlayer().sendMessage(Quests.parseString(stageStartMessage, q.currentQuest)); + } + + } public String getName(){ return name; diff --git a/src/main/java/me/blackvein/quests/QuestFactory.java b/src/main/java/me/blackvein/quests/QuestFactory.java index ae6fe3b55..14e842e9a 100644 --- a/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/src/main/java/me/blackvein/quests/QuestFactory.java @@ -6,6 +6,9 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; + +import me.blackvein.quests.events.MiniEvent; +import me.blackvein.quests.events.MiniEvent.MiniEventType; import me.blackvein.quests.prompts.RequirementsPrompt; import me.blackvein.quests.prompts.RewardsPrompt; import me.blackvein.quests.prompts.StagesPrompt; @@ -1134,6 +1137,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { delayMessage = null; startMessage = null; completeMessage = null; + + Map> miniEvents = null; if (cc.getSessionData(pref + CK.S_BREAK_IDS) != null) { @@ -1241,6 +1246,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE) != null) { completeMessage = (String) cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE); } + + if (cc.getSessionData(pref + CK.S_MINI_EVENTS) != null) { + miniEvents = (Map>) cc.getSessionData(pref + CK.S_MINI_EVENTS); + } if (breakIds != null && breakIds.isEmpty() == false) { stage.set("break-block-ids", breakIds); @@ -1305,6 +1314,16 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { stage.set("delay-message", delayMessage); stage.set("start-message", startMessage); stage.set("complete-message", completeMessage); + + //TODO change here + if (miniEvents != null && miniEvents.isEmpty() == false) { + for (Entry> ent : miniEvents.entrySet()) { + int count = 1; + for (MiniEvent miniEvent : ent.getValue()) { + stage.createSection("mini-events." + ent.getKey().getName() + "." + count, miniEvent.getValues()); + } + } + } } @@ -1683,6 +1702,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (stage.startMessage != null) { cc.setSessionData(pref + CK.S_START_MESSAGE, stage.startMessage); } + + if (stage.miniEvents != null && stage.miniEvents.isEmpty() == false) { + cc.setSessionData(pref + CK.S_START_MESSAGE, stage.miniEvents); + } } // diff --git a/src/main/java/me/blackvein/quests/Quester.java b/src/main/java/me/blackvein/quests/Quester.java index 04a3c14e5..bfbd6da71 100644 --- a/src/main/java/me/blackvein/quests/Quester.java +++ b/src/main/java/me/blackvein/quests/Quester.java @@ -745,20 +745,20 @@ public class Quester { public void enchantItem(Enchantment e, Material m) { - for (Entry entry : itemsEnchanted.entrySet()) { + for (Entry, Integer> entry : itemsEnchanted.entrySet()) { - if (((Map) entry.getKey()).containsKey(e) && ((Map) entry.getKey()).containsValue(m)) { + if (entry.getKey().containsKey(e) && entry.getKey().containsValue(m)) { - for (Entry entry2 : currentStage.itemsToEnchant.entrySet()) { + for (Entry, Integer> entry2 : currentStage.itemsToEnchant.entrySet()) { - if (((Map) entry2.getKey()).containsKey(e) && ((Map) entry2.getKey()).containsValue(m)) { + if (entry2.getKey().containsKey(e) && entry2.getKey().containsValue(m)) { - if ((Integer) entry.getValue() < (Integer) entry2.getValue()) { + if (entry.getValue() < entry2.getValue()) { - Integer num = (Integer) entry.getValue() + 1; - itemsEnchanted.put(((Map) entry.getKey()), (num)); + Integer num = entry.getValue() + 1; + itemsEnchanted.put(entry.getKey(), num); - if ((num).equals((Integer) entry2.getValue())) { + if (num.equals(entry2.getValue())) { finishObjective("enchantItem", m, null, e, null, null, null, null, null, null); } diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java index 475f0a831..efe386511 100644 --- a/src/main/java/me/blackvein/quests/Quests.java +++ b/src/main/java/me/blackvein/quests/Quests.java @@ -5,7 +5,6 @@ import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.Timestamp; -import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; @@ -22,6 +21,12 @@ import java.util.logging.Logger; import me.ThaH3lper.com.EpicBoss; import me.ThaH3lper.com.LoadBosses.LoadBoss; +import me.blackvein.quests.events.MiniEvent; +import me.blackvein.quests.events.MiniEvent.MiniEventType; +import me.blackvein.quests.events.MiniEventChat; +import me.blackvein.quests.events.MiniEventKill; +import me.blackvein.quests.events.MiniEventNPCInteract; +import me.blackvein.quests.events.MiniEventReach; import me.blackvein.quests.prompts.QuestAcceptPrompt; import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.Lang; @@ -77,6 +82,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, public static boolean snoop = true; public static boolean npcEffects = true; public static boolean broadcastPartyCreation = true; + public static boolean ignoreLockedQuests = false; public static int maxPartySize = 0; public static int acceptTimeout = 20; public static int inviteTimeout = 20; @@ -107,6 +113,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, public int killDelay = 0; public int totalQuestPoints = 0; public Lang lang; + private static Quests instance = null; @Override public void onEnable() { @@ -115,6 +122,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, effListener = new NpcEffectThread(this); npcListener = new NpcListener(this); bossListener = new EpicBossListener(this); + instance = this; this.conversationFactory = new ConversationFactory(this) .withModality(false) @@ -269,6 +277,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, } } + + public static Quests getInstance() { + return instance; + } private class QuestPrompt extends StringPrompt { @@ -335,6 +347,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, } else { config.set("language", "en"); } + + if (config.contains("ignore-locked-quests")) { + ignoreLockedQuests = config.getBoolean("ignore-locked-quests"); + } else { + config.set("ignore-locked-quests", false); + } if(config.contains("broadcast-party-creation")){ broadcastPartyCreation = config.getBoolean("broadcast-party-creation"); @@ -993,7 +1011,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, } else if (args[0].equalsIgnoreCase("info")) { cs.sendMessage(GOLD + "Quests " + this.getDescription().getVersion()); - cs.sendMessage(GOLD + "Made by " + DARKRED + "Blackvein"); + cs.sendMessage(GOLD + "Made by " + DARKRED + "Blackvein" + GOLD + " and " + RED + "BlockCat"); return true; } else { @@ -2995,6 +3013,68 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, stage.completeMessage = config.getString("quests." + s + ".stages.ordered." + s2 + ".complete-message"); } + + for (MiniEventType t : MiniEventType.values()) { + int meCount = 1; + if (config.contains("quests." + s + ".stages.ordered." + s2 + ".mini-events." + t.getName())) { + ConfigurationSection configSection = config.createSection("quests." + s + ".stages.ordered." + s2 + ".mini-events." + t.getName()); + + LinkedList ml = new LinkedList(); + + for (String string : configSection.getKeys(false)) { + + MiniEvent me = null; + ConfigurationSection miniSection = configSection.getConfigurationSection(string); + + switch(t) { + case ONDEATH: + me = new MiniEvent(miniSection.getValues(false)); + break; + case ONKILL: + if (miniSection.contains("data")) { + me = new MiniEventKill(quest, miniSection.getValues(false), miniSection.getString("data")); + } else { + me = new MiniEventKill(quest, miniSection.getValues(false), ""); + } + break; + case ONREACH: + if (miniSection.contains("data")) { + me = new MiniEventReach(quest, miniSection.getValues(false), miniSection.getString("data")); + } else { + me = new MiniEventReach(quest, miniSection.getValues(false), ""); + } + break; + case ONCHAT: + if (miniSection.contains("data")) { + me = new MiniEventChat(quest, miniSection.getValues(false), miniSection.getString("data")); + } else { + me = new MiniEventChat(quest, miniSection.getValues(false), ""); + } + break; + case ONSTAGEEND: + me = new MiniEvent(miniSection.getValues(false)); + break; + case ONQUESTQUIT: + me = new MiniEvent(miniSection.getValues(false)); + break; + case ONNPCINTERACT: + if (miniSection.contains("data")) { + me = new MiniEventNPCInteract(quest, miniSection.getValues(false), miniSection.getString("data")); + } else { + me = new MiniEventNPCInteract(quest, miniSection.getValues(false), ""); + } + break; + } + + if (me != null) { + ml.add(me); + } + meCount++; + } + + stage.miniEvents.put(t, ml); + } + } stage.citizensToInteract = npcsToTalkTo; @@ -3259,6 +3339,42 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, return parsed; + } + + public static String parseString(String s) { + + String parsed = s; + + parsed = parsed.replaceAll("", BLACK.toString()); + parsed = parsed.replaceAll("", DARKBLUE.toString()); + parsed = parsed.replaceAll("", DARKGREEN.toString()); + parsed = parsed.replaceAll("", DARKAQUA.toString()); + parsed = parsed.replaceAll("", DARKRED.toString()); + parsed = parsed.replaceAll("", PURPLE.toString()); + parsed = parsed.replaceAll("", GOLD.toString()); + parsed = parsed.replaceAll("", GRAY.toString()); + parsed = parsed.replaceAll("", GRAY.toString()); + parsed = parsed.replaceAll("", DARKGRAY.toString()); + parsed = parsed.replaceAll("", DARKGRAY.toString()); + parsed = parsed.replaceAll("", BLUE.toString()); + parsed = parsed.replaceAll("", GREEN.toString()); + parsed = parsed.replaceAll("", AQUA.toString()); + parsed = parsed.replaceAll("", RED.toString()); + parsed = parsed.replaceAll("", PINK.toString()); + parsed = parsed.replaceAll("", YELLOW.toString()); + parsed = parsed.replaceAll("", WHITE.toString()); + + parsed = parsed.replaceAll("", MAGIC.toString()); + parsed = parsed.replaceAll("", ITALIC.toString()); + parsed = parsed.replaceAll("", BOLD.toString()); + parsed = parsed.replaceAll("", UNDERLINE.toString()); + parsed = parsed.replaceAll("", STRIKETHROUGH.toString()); + parsed = parsed.replaceAll("", RESET.toString()); + parsed = ChatColor.translateAlternateColorCodes('&', parsed); + + return parsed; + + } private boolean setupEconomy() { diff --git a/src/main/java/me/blackvein/quests/Stage.java b/src/main/java/me/blackvein/quests/Stage.java index 140f8ecd0..e03d4e717 100644 --- a/src/main/java/me/blackvein/quests/Stage.java +++ b/src/main/java/me/blackvein/quests/Stage.java @@ -1,11 +1,17 @@ package me.blackvein.quests; -import java.util.ArrayList; import java.util.EnumMap; import java.util.HashMap; import java.util.LinkedList; +import java.util.List; import java.util.Map; + +import me.blackvein.quests.events.MiniEvent; +import me.blackvein.quests.events.MiniEvent.MiniEventType; +import me.blackvein.quests.events.MiniEventKill; +import me.blackvein.quests.events.MiniEventReach; import net.citizensnpcs.api.npc.NPC; + import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.Material; @@ -24,6 +30,9 @@ public class Stage { Integer fishToCatch; Integer playersToKill; Map, Integer> itemsToEnchant = new HashMap, Integer>(); + + Map> miniEvents = new HashMap(); + LinkedList mobsToKill = new LinkedList(); LinkedList mobNumToKill = new LinkedList(); LinkedList locationsToKillWithin = new LinkedList(); @@ -89,15 +98,12 @@ public class Stage { if (o instanceof LinkedList) { LinkedList otherList = (LinkedList) o; + + if (this.size() != otherList.size()) return false; - for (NPC n : this) { - - NPC other = otherList.get(this.indexOf(n)); - if (other.getId() != n.getId()) { - return false; - } + for (int i = 0; i < this.size(); i++) { + if (this.get(i) != otherList.get(i)) return false; } - } return true; @@ -123,7 +129,51 @@ public class Stage { public String delayMessage = null; public String completeMessage = null; public String startMessage = null; + + public boolean executeEvent(Quester quester, MiniEventType type) { + + if (miniEvents.containsKey(type)) { + boolean isCancelled = false; + for (MiniEvent me : miniEvents.get(type)) { + boolean c = me.execute(quester); + if (c == true) { + isCancelled = true; + } + } + return isCancelled; + } + return false; + } + public boolean executeReachEvent(Location location, Quester quester) { + + if (miniEvents.containsKey(MiniEventType.ONREACH)) { + boolean isCancelled = false; + for (MiniEvent me : miniEvents.get(MiniEventType.ONREACH)) { + boolean c = ((MiniEventReach) me).execute(quester, location); + if (c == true) { + isCancelled = true; + } + } + return isCancelled; + } + return false; + } + + public boolean executeKillEvent(Quester quester, EntityType entityType) { + if (miniEvents.containsKey(MiniEventType.ONKILL)) { + boolean isCancelled = false; + for (MiniEvent me : miniEvents.get(MiniEventType.ONREACH)) { + boolean c = ((MiniEventKill) me).execute(quester, entityType); + if (c == true) { + isCancelled = true; + } + } + return isCancelled; + } + return false; + } + @Override public boolean equals(Object o) { @@ -313,4 +363,6 @@ public class Stage { return true; } + + } diff --git a/src/main/java/me/blackvein/quests/StageTimer.java b/src/main/java/me/blackvein/quests/StageTimer.java index dc31369b6..d23bb4835 100644 --- a/src/main/java/me/blackvein/quests/StageTimer.java +++ b/src/main/java/me/blackvein/quests/StageTimer.java @@ -40,7 +40,8 @@ public class StageTimer implements Runnable{ plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player); if(quester.currentStage.event != null) quester.currentStage.event.happen(quester); - quester.currentStage = quester.currentQuest.stages.get(quester.currentQuest.stages.indexOf(quester.currentStage) + 1); + quester.currentStage = quester.currentQuest.stages.get(quester.currentStageIndex + 1); + quester.currentStageIndex++; quester.addEmpties(); quester.delayStartTime = 0; quester.delayTimeLeft = -1; diff --git a/src/main/java/me/blackvein/quests/events/MiniEvent.java b/src/main/java/me/blackvein/quests/events/MiniEvent.java new file mode 100644 index 000000000..3c1315355 --- /dev/null +++ b/src/main/java/me/blackvein/quests/events/MiniEvent.java @@ -0,0 +1,157 @@ +package me.blackvein.quests.events; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; + +import me.blackvein.quests.ItemUtil; +import me.blackvein.quests.Quest; +import me.blackvein.quests.Quester; +import me.blackvein.quests.Quests; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +public class MiniEvent { + + protected boolean cancelled = false; + protected Map values = new LinkedHashMap(); + + public MiniEvent(Map map) { + if (map != null) { + this.values = map; + } + } + + + public boolean execute(Quester quester) { + + if (quester == null) { + return true; + } + for (Entry ent : values.entrySet()) { + String key = ent.getKey(); + String value = (String)ent.getValue(); + + switch(key) { + case "cancel": + setCancelled(value); + break; + case "command": + executeCommand(value); + break; + case "send-message": + sendMessage(value, quester); + break; + case "chat-message": + chatMessage(value, quester); + break; + case "broadcast-message": + broadcastMessage(value); + break; + case "set-stage": + setStage(value, quester); + break; + case "teleport": + teleport(value, quester); + break; + case "take-item": + takeItem(value, quester); + break; + case "add-item": + addItem(value, quester); + break; + } + } + + return isCancelled(); + } + + public void setCancelled(String data) { + Boolean c = false; + try { + c = Boolean.parseBoolean(data); + } catch (Exception e) { + + } + cancelled = c; + } + + public boolean isCancelled() { + return cancelled; + } + + public void executeCommand(String command) { + Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command); + } + + public void sendMessage(String message, Quester quester) { + quester.getPlayer().sendMessage(message); + } + + public void chatMessage(String message, Quester quester) { + quester.getPlayer().chat(message); + } + + public void broadcastMessage(String message) { + Bukkit.getServer().broadcastMessage(message); + } + + public void setStage(String data, Quester quester) { + int i = -1; + + try { + i = Integer.parseInt(data); + } catch (Exception e) { + return; + } + + if (i > 0) + quester.currentQuest.setStage(quester, i - 1); + } + + public void teleport(String data, Quester quester) { + Location loc = Quests.getLocation(data); + if (loc != null) { + quester.getPlayer().teleport(loc); + } + } + + public void takeItem(String data, Quester quester) { + ItemStack is = ItemUtil.parseItem(data); + PlayerInventory inv = quester.getPlayer().getInventory(); + + Quests.removeItem(inv, is); + } + + public void addItem(String data, Quester quester) { + ItemStack is = ItemUtil.parseItem(data); + Quests.addItem(quester.getPlayer(), is); + } + + public enum MiniEventType { + ONDEATH ("onDeath"), + ONKILL ("onKill"), + ONREACH("onReach"), + ONCHAT("onChat"), + ONSTAGEEND("onStageEnd"), + ONQUESTQUIT("onQuestQuit"), + ONNPCINTERACT("OnNPCInteract"); + + private String name; + + MiniEventType(String name) { + this.name = name; + } + + public String getName() { + return name; + } + } + + public Map getValues() { + return values; + } +} diff --git a/src/main/java/me/blackvein/quests/events/MiniEventChat.java b/src/main/java/me/blackvein/quests/events/MiniEventChat.java new file mode 100644 index 000000000..80c72d8c1 --- /dev/null +++ b/src/main/java/me/blackvein/quests/events/MiniEventChat.java @@ -0,0 +1,17 @@ +package me.blackvein.quests.events; + +import java.util.LinkedHashMap; +import java.util.Map; + +import me.blackvein.quests.Quest; + +public class MiniEventChat extends MiniEvent { + + private String chatString; + + public MiniEventChat(Quest quest, Map keys, String data) { + super(keys); + this.chatString = data; + } + +} diff --git a/src/main/java/me/blackvein/quests/events/MiniEventKill.java b/src/main/java/me/blackvein/quests/events/MiniEventKill.java new file mode 100644 index 000000000..2ae00b99f --- /dev/null +++ b/src/main/java/me/blackvein/quests/events/MiniEventKill.java @@ -0,0 +1,31 @@ +package me.blackvein.quests.events; + +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import me.blackvein.quests.Quest; +import me.blackvein.quests.Quester; + +import org.bukkit.entity.EntityType; + +public class MiniEventKill extends MiniEvent { + + private List mobTypes; + + public MiniEventKill(Quest quest, Map keys, String mobs) { + super(keys); + this.mobTypes = Arrays.asList(mobs.split(",")); + } + + public boolean execute(Quester quester, EntityType type) { + if (mobTypes.contains(Quester.prettyMobString(type)) || mobTypes.isEmpty()) { + return super.execute(quester); + } else { + return true; + } + } + +} diff --git a/src/main/java/me/blackvein/quests/events/MiniEventNPCInteract.java b/src/main/java/me/blackvein/quests/events/MiniEventNPCInteract.java new file mode 100644 index 000000000..30bd3a1a5 --- /dev/null +++ b/src/main/java/me/blackvein/quests/events/MiniEventNPCInteract.java @@ -0,0 +1,21 @@ +package me.blackvein.quests.events; + +import java.util.Map; + +import me.blackvein.quests.Quest; + +public class MiniEventNPCInteract extends MiniEvent { + + private int npcId = -1; + + public MiniEventNPCInteract(Quest quest, Map map, String data) { + super(map); + + try { + npcId = Integer.parseInt(data); + } catch (Exception e) { + + } + } + +} diff --git a/src/main/java/me/blackvein/quests/events/MiniEventReach.java b/src/main/java/me/blackvein/quests/events/MiniEventReach.java new file mode 100644 index 000000000..743936b91 --- /dev/null +++ b/src/main/java/me/blackvein/quests/events/MiniEventReach.java @@ -0,0 +1,41 @@ +package me.blackvein.quests.events; + +import java.util.LinkedHashMap; +import java.util.Map; + +import me.blackvein.quests.Quest; +import me.blackvein.quests.Quester; +import me.blackvein.quests.Quests; + +import org.bukkit.Location; + +public class MiniEventReach extends MiniEvent{ + + private Location location; + private int radius; + + public MiniEventReach(Quest quest, Map keys, String data) { + super(keys); + try { + + this.location = Quests.getLocation(data.split(":")[0]); + this.radius = Integer.parseInt(data.split(":")[1]); + } catch(Exception e) { + location = null; + radius = 0; + } + } + + public boolean execute(Quester quester, Location loc) { + if (location == null) { + return false; + } + + if (loc.toVector().distance(location.toVector()) > radius) { + return false; + } else { + return super.execute(quester); + } + } + +} diff --git a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java index 181ec199d..4cf1418e6 100644 --- a/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java @@ -1,19 +1,25 @@ package me.blackvein.quests.prompts; import java.util.Arrays; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; + import me.ThaH3lper.com.LoadBosses.LoadBoss; import me.blackvein.quests.ColorUtil; import me.blackvein.quests.Event; import me.blackvein.quests.QuestFactory; import me.blackvein.quests.Quester; import me.blackvein.quests.Quests; +import me.blackvein.quests.events.MiniEvent; +import me.blackvein.quests.events.MiniEvent.MiniEventType; import me.blackvein.quests.util.CK; import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.Lang; import net.aufdemrand.denizen.scripts.ScriptRegistry; import net.citizensnpcs.api.CitizensPlugin; + import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -35,7 +41,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { public CreateStagePrompt(int stageNum, QuestFactory qf, CitizensPlugin cit) { - super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"); + super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25"); this.stageNum = stageNum; this.pref = "stage" + stageNum; this.citizens = cit; @@ -308,9 +314,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_EVENT) == null) { - text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- " + Lang.get("event") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- " + Lang.get("stageEditorEvents") + GRAY + " (" + Lang.get("noneSet") + ")\n"; } else { - text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- " + Lang.get("event") + GRAY + " (" + AQUA + context.getSessionData(pref + CK.S_EVENT) + GRAY + ")\n"; + text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- " + Lang.get("stageEditorEvents") + GRAY + " (" + AQUA + context.getSessionData(pref + CK.S_EVENT) + GRAY + ")\n"; } if (context.getSessionData(pref + CK.S_DELAY) == null) { @@ -321,7 +327,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_DELAY) == null) { - text += GRAY + "" + BOLD + "19 " + RESET + GRAY + "- " + Lang.get("stageEditorDelayMessage") + GRAY + " " + Lang.get("noDelaySet") + "\n"; + text += GRAY + "" + BOLD + "19 " + RESET + GRAY + "- " + Lang.get("stageEditorDelayMessage") + GRAY + " (" + Lang.get("noDelaySet") + ")\n"; } else if (context.getSessionData(pref + CK.S_DELAY_MESSAGE) == null) { text += PINK + "" + BOLD + "19 " + RESET + PURPLE + "- "+ Lang.get("stageEditorDelayMessage") + GRAY + " (" + Lang.get("noneSet") + ")\n"; } else { @@ -334,7 +340,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } else { if (context.getSessionData(pref + CK.S_DENIZEN) == null) { - text += GRAY + "" + BOLD + "20 " + RESET + PURPLE + "- " + Lang.get("stageEditorDenizenScript") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + text += PINK + "" + BOLD + "20 " + RESET + PURPLE + "- " + Lang.get("stageEditorDenizenScript") + GRAY + " (" + Lang.get("noneSet") + ")\n"; } else { text += PINK + "" + BOLD + "20 " + RESET + PURPLE + "- " + Lang.get("stageEditorDenizenScript") + GRAY + " (" + AQUA + context.getSessionData(pref + CK.S_DENIZEN) + GRAY + "\n"; } @@ -352,9 +358,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } else { text += PINK + "" + BOLD + "22 " + RESET + PURPLE + "- " + Lang.get("stageEditorCompleteMessage") + GRAY + "(" + AQUA + "\"" + context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) + "\"" + GRAY + ")\n"; } + + text += PINK + "" + BOLD + "23 " + RESET + PURPLE + "- " + Lang.get("stageEditorMiniEventMessage") + "\n"; - text += RED + "" + BOLD + "23 " + RESET + PURPLE + "- " + Lang.get("stageEditorDelete") + "\n"; - text += GREEN + "" + BOLD + "24 " + RESET + PURPLE + "- " + Lang.get("done") + "\n"; + text += RED + "" + BOLD + "24 " + RESET + PURPLE + "- " + Lang.get("stageEditorDelete") + "\n"; + text += GREEN + "" + BOLD + "25 " + RESET + PURPLE + "- " + Lang.get("done") + "\n"; return text; @@ -383,28 +391,28 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (questFactory.quests.citizens != null) { return new DeliveryListPrompt(); } else { - context.getForWhom().sendRawMessage(RED + "Citizens is not installed!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoCitizens")); return new CreateStagePrompt(stageNum, questFactory, citizens); } } else if (input.equalsIgnoreCase("10")) { if (questFactory.quests.citizens != null) { return new NPCIDsToTalkToPrompt(); } else { - context.getForWhom().sendRawMessage(RED + "Citizens is not installed!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoCitizens")); return new CreateStagePrompt(stageNum, questFactory, citizens); } } else if (input.equalsIgnoreCase("11")) { if (questFactory.quests.citizens != null) { return new NPCKillListPrompt(); } else { - context.getForWhom().sendRawMessage(RED + "Citizens is not installed!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoCitizens")); return new CreateStagePrompt(stageNum, questFactory, citizens); } } else if (input.equalsIgnoreCase("12")) { if (Quests.epicBoss != null) { return new EpicBossListPrompt(); } else { - context.getForWhom().sendRawMessage(RED + "EpicBoss is not installed!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoEpicBoss")); return new CreateStagePrompt(stageNum, questFactory, citizens); } } else if (input.equalsIgnoreCase("13")) { @@ -421,14 +429,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new DelayPrompt(); } else if (input.equalsIgnoreCase("19")) { if (context.getSessionData(pref + CK.S_DELAY) == null) { - context.getForWhom().sendRawMessage(RED + "You must set a delay first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoDelaySet")); return new CreateStagePrompt(stageNum, questFactory, citizens); } else { return new DelayMessagePrompt(); } } else if (input.equalsIgnoreCase("20")) { if (questFactory.quests.denizen == null) { - context.getForWhom().sendRawMessage(RED + "Denizen is not installed!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoDenizen")); return new CreateStagePrompt(stageNum, questFactory, citizens); } else { return new DenizenPrompt(); @@ -438,8 +446,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } else if (input.equalsIgnoreCase("22")) { return new CompleteMessagePrompt(); } else if (input.equalsIgnoreCase("23")) { - return new DeletePrompt(); + return new MiniEventPrompt(); } else if (input.equalsIgnoreCase("24")) { + return new DeletePrompt(); + } else if (input.equalsIgnoreCase("25")) { return new StagesPrompt(questFactory); } else { return new CreateStagePrompt(stageNum, questFactory, citizens); @@ -532,7 +542,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorInvalidIdAmountList")); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorListNotSameSize")); return new BreakBlockListPrompt(); } } @@ -577,12 +587,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockId")); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockID")); return new BreakBlockIdsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorInvalidEntryInt") + "\n" + PINK + s); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNotListofNumbers") + "\n" + PINK + s); return new BreakBlockIdsPrompt(); } @@ -601,13 +611,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter block amounts (numbers), separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorBreakBlocksPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList amounts = new LinkedList(); @@ -618,12 +628,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (Integer.parseInt(s) > 0) { amounts.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditortNotGreaterThanZero")); return new BreakBlockAmountsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new BreakBlockAmountsPrompt(); } @@ -649,12 +659,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Damage Blocks -\n"; + 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 - Set damage amounts (" + Lang.get("noIdsSet") + ")\n"; - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += GRAY + "2 - " + Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noIdsSet") + ")\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"; @@ -665,10 +675,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set damage amounts (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set damage amounts\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetDamageAmounts") + "\n"; for (Integer i : getBlockAmounts(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -677,8 +687,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -693,13 +703,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new DamageBlockIdsPrompt(); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_DAMAGE_IDS) == null) { - context.getForWhom().sendRawMessage(RED + "You must " + Lang.get("stageEditorSetBlockIds") + " first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockIds")); return new DamageBlockListPrompt(); } else { return new DamageBlockAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { - context.getForWhom().sendRawMessage(YELLOW + "Damage blocks objective cleared."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorDamageBlocksCleared")); context.setSessionData(pref + CK.S_DAMAGE_IDS, null); context.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, null); return new DamageBlockListPrompt(); @@ -723,7 +733,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + "The " + GOLD + "block IDs list" + RED + " and " + GOLD + " damage amounts list " + RED + "are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorListNotSameSize")); return new DamageBlockListPrompt(); } } @@ -750,7 +760,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList ids = new LinkedList(); @@ -763,17 +773,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (ids.contains(Integer.parseInt(s)) == false) { ids.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(RED + " List contains duplicates!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorListContainsDuplicates")); return new DamageBlockIdsPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid block ID!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockID")); return new DamageBlockIdsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new DamageBlockIdsPrompt(); } @@ -792,13 +802,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter damage amounts (numbers), separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorDamageBlocksPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList amounts = new LinkedList(); @@ -809,12 +819,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (Integer.parseInt(s) > 0) { amounts.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorNotGreaterThanZero")); return new DamageBlockAmountsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new DamageBlockAmountsPrompt(); } @@ -840,12 +850,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Place Blocks -\n"; + 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 - Set place amounts (" + Lang.get("noIdsSet") + ")\n"; - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += GRAY + "2 - " + Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noIdsSet") + ")\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"; @@ -856,10 +866,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_PLACE_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set place amounts (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set place amounts\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + "stageEditorSetPlaceAmounts" + "\n"; for (Integer i : getBlockAmounts(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -868,8 +878,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -884,13 +894,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new PlaceBlockIdsPrompt(); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_PLACE_IDS) == null) { - context.getForWhom().sendRawMessage(RED + "You must " + Lang.get("stageEditorSetBlockIds") + " first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockIds")); return new PlaceBlockListPrompt(); } else { return new PlaceBlockAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { - context.getForWhom().sendRawMessage(YELLOW + "Place blocks objective cleared."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorPlaceBlocksCleared")); context.setSessionData(pref + CK.S_PLACE_IDS, null); context.setSessionData(pref + CK.S_PLACE_AMOUNTS, null); return new PlaceBlockListPrompt(); @@ -914,7 +924,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + "The " + GOLD + "block IDs list" + RED + " and " + GOLD + " place amounts list " + RED + "are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorListNotSameSize")); return new PlaceBlockListPrompt(); } } @@ -941,7 +951,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList ids = new LinkedList(); @@ -954,17 +964,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (ids.contains(Integer.parseInt(s)) == false) { ids.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(RED + " List contains duplicates!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorListContainsDuplicates")); return new PlaceBlockIdsPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid block ID!"); + context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorInvalidBlockID")); return new PlaceBlockIdsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new PlaceBlockIdsPrompt(); } @@ -983,13 +993,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter place amounts (numbers), separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorPlaceBlocksPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList amounts = new LinkedList(); @@ -1000,12 +1010,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (Integer.parseInt(s) > 0) { amounts.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorNotGreaterThanZero")); return new PlaceBlockAmountsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new PlaceBlockAmountsPrompt(); } @@ -1034,9 +1044,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { String text = GOLD + "- Use Blocks -\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 - Set use amounts (" + Lang.get("noIdsSet") + ")\n"; - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += GRAY + "2 - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noIdsSet") + ")\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"; @@ -1047,10 +1057,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_USE_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set use amounts (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set use amounts\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetUseAmounts") + "\n"; for (Integer i : getBlockAmounts(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -1059,8 +1069,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -1075,13 +1085,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new UseBlockIdsPrompt(); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_USE_IDS) == null) { - context.getForWhom().sendRawMessage(RED + "You must " + Lang.get("stageEditorSetBlockIds") + " first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockIds")); return new UseBlockListPrompt(); } else { return new UseBlockAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { - context.getForWhom().sendRawMessage(YELLOW + "Use blocks objective cleared."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorUseBlocksCleared")); context.setSessionData(pref + CK.S_USE_IDS, null); context.setSessionData(pref + CK.S_USE_AMOUNTS, null); return new UseBlockListPrompt(); @@ -1105,7 +1115,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + "The " + GOLD + "block IDs list" + RED + " and " + GOLD + " use amounts list " + RED + "are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorListNotSameSize")); return new UseBlockListPrompt(); } } @@ -1132,7 +1142,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList ids = new LinkedList(); @@ -1145,17 +1155,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (ids.contains(Integer.parseInt(s)) == false) { ids.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(RED + " List contains duplicates!"); + context.getForWhom().sendRawMessage(RED + " " + Lang.get("stageEditorContainsDuplicates")); return new UseBlockIdsPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid block ID!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockID")); return new UseBlockIdsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new UseBlockIdsPrompt(); } @@ -1174,13 +1184,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter use amounts (numbers), separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorUseBlocksPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList amounts = new LinkedList(); @@ -1191,12 +1201,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (Integer.parseInt(s) > 0) { amounts.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorNotGreaterThanZero")); return new UseBlockAmountsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new UseBlockAmountsPrompt(); } @@ -1222,12 +1232,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Cut Blocks -\n"; + 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 - Set cut amounts (" + Lang.get("noIdsSet") + ")\n"; - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += GRAY + "2 - " + Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noIdsSet") + ")\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"; @@ -1238,10 +1248,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_CUT_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set cut amounts (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set cut amounts\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetCutAmounts") + "\n"; for (Integer i : getBlockAmounts(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -1250,8 +1260,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -1266,13 +1276,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new CutBlockIdsPrompt(); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_CUT_IDS) == null) { - context.getForWhom().sendRawMessage(RED + "You must " + Lang.get("stageEditorSetBlockIds") + " first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockIds")); return new CutBlockListPrompt(); } else { return new CutBlockAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { - context.getForWhom().sendRawMessage(YELLOW + "Cut blocks objective cleared."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorCutBlocksCleared")); context.setSessionData(pref + CK.S_CUT_IDS, null); context.setSessionData(pref + CK.S_CUT_AMOUNTS, null); return new CutBlockListPrompt(); @@ -1296,7 +1306,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + "The " + GOLD + "block IDs list" + RED + " and " + GOLD + " cut amounts list " + RED + "are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorListNotSameSize")); return new CutBlockListPrompt(); } } @@ -1323,7 +1333,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList ids = new LinkedList(); @@ -1336,17 +1346,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (ids.contains(Integer.parseInt(s)) == false) { ids.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(RED + " List contains duplicates!"); + context.getForWhom().sendRawMessage(RED + " " + Lang.get("stageEditorListContainsDuplicates")); return new CutBlockIdsPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid block ID!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidBlockID")); return new CutBlockIdsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new CutBlockIdsPrompt(); } @@ -1365,13 +1375,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter cut amounts (numbers), separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorCutBlocksPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList amounts = new LinkedList(); @@ -1382,12 +1392,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (Integer.parseInt(s) > 0) { amounts.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorNotGreaterThanZero")); return new CutBlockAmountsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new CutBlockAmountsPrompt(); } @@ -1406,7 +1416,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter number of fish to catch, or 0 to clear the fish catch objective, or -1 to cancel"; + return YELLOW + Lang.get("stageEditorCatchFishPrompt"); } @Override @@ -1416,7 +1426,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); if (num < -1) { - player.sendMessage(RED + "You must enter a positive number!"); + player.sendMessage(RED + Lang.get("stageEditorPositiveAmount")); return new FishPrompt(); } else if (num == 0) { context.setSessionData(pref + CK.S_FISH, null); @@ -1433,7 +1443,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter number of players to kill, or 0 to clear the player kill objective, or -1 to cancel"; + return YELLOW + Lang.get("stageEditorKillPlayerPrompt"); } @Override @@ -1443,8 +1453,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); if (num < -1) { - player.sendMessage(RED + "You must enter a positive number!"); - return new KillPlayerPrompt(); + player.sendMessage(RED + Lang.get("stageEditorPositiveAmount")); + return new KillPlayerPrompt(); } else if (num == 0) { context.setSessionData(pref + CK.S_PLAYER_KILL, null); } else if (num > 0) { @@ -1467,16 +1477,16 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Enchant Items -\n"; + String text = GOLD + "- " + Lang.get("stageEditorEnchantItems") +" -\n"; if (context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set enchantments (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - Set item ids (No enchantments set)\n"; - text += GRAY + "3 - Set enchant amounts (No enchantments set)\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Done"; + 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 + "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"); } else { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set enchantments\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetEnchantments") + "\n"; for (String s : getEnchantTypes(context)) { text += GRAY + " - " + AQUA + s + "\n"; @@ -1484,10 +1494,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_ENCHANT_IDS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set item ids (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetItemIds") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set item ids\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetItemIds") + "\n"; for (Integer i : getEnchantItems(context)) { text += GRAY + " - " + AQUA + Quester.prettyItemString(i) + "\n"; @@ -1497,10 +1507,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set enchant amounts (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetEnchantAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set enchant amounts\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetEnchantAmounts") + "\n"; for (int i : getEnchantAmounts(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -1509,8 +1519,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -1525,20 +1535,20 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new EnchantTypesPrompt(); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null) { - context.getForWhom().sendRawMessage(RED + "You must set enchantments first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoEnchantments")); return new EnchantmentListPrompt(); } else { return new EnchantItemsPrompt(); } } else if (input.equalsIgnoreCase("3")) { if (context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null) { - context.getForWhom().sendRawMessage(RED + "You must set enchantments first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoEnchantments")); return new EnchantmentListPrompt(); } else { return new EnchantAmountsPrompt(); } } else if (input.equalsIgnoreCase("4")) { - context.getForWhom().sendRawMessage(YELLOW + "Enchantment objective cleared."); + 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_AMOUNTS, null); @@ -1570,7 +1580,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two && two == three) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + "The " + GOLD + "enchantments list" + RED + ", " + GOLD + "item id list " + RED + "and " + GOLD + "enchant amount list " + RED + "are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorEnchantmentNotSameSize")); return new EnchantmentListPrompt(); } } @@ -1597,7 +1607,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = PINK + "- " + PURPLE + "Enchantments" + PINK + " -\n"; + String text = PINK + "- " + PURPLE + Lang.get("stageEditorEnchantments") + PINK + " -\n"; for (Enchantment e : Enchantment.values()) { text += GREEN + Quester.prettyEnchantmentString(e) + ", "; @@ -1605,14 +1615,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } text = text.substring(0, text.length() - 1); - return text + "\n" + YELLOW + "Enter enchantment names, separating each one by a " + BOLD + "" + ITALIC + "comma" + RESET + "" + YELLOW + ", or enter \'cancel\' to return."; - + return text + "\n" + YELLOW + Lang.get("stageEditorEnchantTypePrompt"); + } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(","); LinkedList enchs = new LinkedList(); @@ -1630,7 +1640,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { valid = true; break; } else { - context.getForWhom().sendRawMessage(RED + " List contains duplicates!"); + context.getForWhom().sendRawMessage(RED + " " + Lang.get("stageEditorListContainsDuplicates")); return new EnchantTypesPrompt(); } @@ -1638,7 +1648,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (valid == false) { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid enchantment name!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidEnchantment")); return new EnchantTypesPrompt(); } @@ -1657,13 +1667,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter item IDs, separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorItemIDsPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList ids = new LinkedList(); @@ -1676,17 +1686,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (ids.contains(Integer.parseInt(s)) == false) { ids.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(RED + " List contains duplicates!"); + context.getForWhom().sendRawMessage(RED + " " + Lang.get("stageEditorListContainsDuplicates")); return new EnchantItemsPrompt(); } } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid item ID!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorInvalidItemID")); return new EnchantItemsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new EnchantItemsPrompt(); } @@ -1705,13 +1715,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter enchant amounts (numbers), separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorEnchantAmountsPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList amounts = new LinkedList(); @@ -1722,12 +1732,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (Integer.parseInt(s) > 0) { amounts.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorNotGreaterThanZero")); return new EnchantAmountsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new EnchantAmountsPrompt(); } @@ -1770,16 +1780,16 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - String text = GOLD + "- Deliver Items -\n"; + String text = GOLD + "- " + Lang.get("stageEditorDeliverItems") + " -\n"; if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) { text += GRAY + " (" + Lang.get("noneSet") + ")\n"; - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n"; - text += GRAY + "2 - Set NPC IDs (No items set)\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorAddItem") + "\n"; + text += GRAY + "2 - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("stageEditorNoItemsSet") + ")\n"; if (context.getSessionData(pref + CK.S_DELIVERY_MESSAGES) == null) { - text += BLUE + "3 - Set delivery messages (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "3 - " + Lang.get("stageEditorDeliveryMessages") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "3 - Set delivery messages\n"; + text += BLUE + "3 - " + Lang.get("stageEditorDeliveryMessages") + "\n"; for (String s : getDeliveryMessages(context)) { text += GRAY + " - " + AQUA + "\"" + s + "\""; @@ -1787,8 +1797,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } } - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Done"; + } else { for (ItemStack is : getItems(context)) { @@ -1797,13 +1806,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorAddItem") + "\n"; if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set NPC IDs (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set NPC IDs\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorDeliveryNPCs") + "\n"; for (int i : getDeliveryNPCs(context)) { text += GRAY + " - " + AQUA + i + " (" + citizens.getNPCRegistry().getById(i).getName() + ")\n"; @@ -1816,7 +1825,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { text += BLUE + "3 - Set delivery messages (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "3 - Set delivery messages\n"; + text += BLUE + "3 - " + Lang.get("stageEditorDeliveryMessages") + "\n"; for (String s : getDeliveryMessages(context)) { text += GRAY + " - " + AQUA + "\"" + s + "\"\n"; @@ -1825,11 +1834,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Done"; - } - + + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done"); + return text; } @@ -1841,7 +1850,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new ItemStackPrompt(DeliveryListPrompt.this); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) { - context.getForWhom().sendRawMessage(RED + "You must add items first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoItems")); return new DeliveryListPrompt(); } else { return new DeliveryNPCsPrompt(); @@ -1849,7 +1858,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } else if (input.equalsIgnoreCase("3")) { return new DeliveryMessagesPrompt(); } else if (input.equalsIgnoreCase("4")) { - context.getForWhom().sendRawMessage(YELLOW + "Delivery objective cleared."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorDeliveriesCleared")); context.setSessionData(pref + CK.S_DELIVERY_ITEMS, null); context.setSessionData(pref + CK.S_DELIVERY_NPCS, null); context.setSessionData(pref + CK.S_DELIVERY_MESSAGES, null); @@ -1874,14 +1883,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two) { if (context.getSessionData(pref + CK.S_DELIVERY_MESSAGES) == null && one != 0) { - context.getForWhom().sendRawMessage(RED + "You must set at least one delivery message!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoDeliveryMessage")); return new DeliveryListPrompt(); } else { return new CreateStagePrompt(stageNum, questFactory, citizens); } } else { - context.getForWhom().sendRawMessage(RED + "The item list and NPC list are not equal in size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorDeliveriesNotSameSize")); return new DeliveryListPrompt(); } } @@ -1908,13 +1917,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter NPC ids, separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorNPCPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList npcs = new LinkedList(); @@ -1927,13 +1936,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (citizens.getNPCRegistry().getById(i) != null) { npcs.add(i); } else { - context.getForWhom().sendRawMessage(PINK + "" + i + RED + " is not a valid NPC ID!"); + context.getForWhom().sendRawMessage(PINK + "" + i + RED + " " + Lang.get("stageEditorInvalidNPC")); return new DeliveryNPCsPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new DeliveryNPCsPrompt(); } @@ -1954,14 +1963,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String note = GOLD + "Note: You may specify the name of the NPC with "; - return YELLOW + "Enter delivery messages, separating each one by a " + BOLD + ITALIC + "semi-colon" + RESET + YELLOW + ", or enter \'cancel\' to return.\n" + note; + String note = GOLD + Lang.get("stageEditorNPCNote"); + return YELLOW + Lang.get("stageEditorDeliveryMessagesPrompt")+ ".\n" + note; } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase("cmdCancel") == false) { String[] args = input.split(";"); LinkedList messages = new LinkedList(); @@ -1981,13 +1990,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter NPC IDs, separating each one by a space, or enter \'clear\' to clear the NPC ID list, or \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorNPCToTalkToPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { String[] args = input.split(" "); LinkedList npcs = new LinkedList(); @@ -2000,13 +2009,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (citizens.getNPCRegistry().getById(i) != null) { npcs.add(i); } else { - context.getForWhom().sendRawMessage(PINK + "" + i + RED + " is not a valid NPC ID!"); + context.getForWhom().sendRawMessage(PINK + "" + i + RED + " " + Lang.get("stageEditorInvalidNPC")); return new NPCIDsToTalkToPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new NPCIDsToTalkToPrompt(); } @@ -2015,7 +2024,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs); - } else if (input.equalsIgnoreCase("clear")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, null); @@ -2037,15 +2046,15 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Kill NPCs -\n"; + String text = GOLD + "- " + Lang.get("stageEditorKillNPCs") + " -\n"; if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set NPC IDs (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - Set kill amounts (" + Lang.get("noIdsSet") + ")\n"; - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetKillIds") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetKillAmounts") + " (" + Lang.get("noIdsSet") + ")\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("cancel") + "\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } else { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set kill IDs\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetKillIds") + "\n"; for (Integer i : getNPCIds(context)) { text += GRAY + " - " + AQUA + citizens.getNPCRegistry().getById(i).getName() + DARKAQUA + " (" + i + ")\n"; @@ -2053,10 +2062,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set kill amounts (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetKillAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set kill amounts\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetKillAmounts") + "\n"; for (Integer i : getKillAmounts(context)) { text += GRAY + " - " + BLUE + i + "\n"; @@ -2065,8 +2074,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("cancel") + "\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -2081,13 +2090,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new npcIdsToKillPrompt(); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) { - context.getForWhom().sendRawMessage(RED + "You must set NPC IDs first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoNPCs")); return new NPCKillListPrompt(); } else { return new npcAmountsToKillPrompt(); } } else if (input.equalsIgnoreCase("3")) { - context.getForWhom().sendRawMessage(YELLOW + "Kill NPCs objective cleared."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorKillNPCsCleared")); context.setSessionData(pref + CK.S_NPCS_TO_KILL, null); context.setSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS, null); return new NPCKillListPrompt(); @@ -2111,7 +2120,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + "The " + GOLD + "NPC IDs list" + RED + " and " + GOLD + " kill amounts list " + RED + "are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNPCKillsNotSameSize")); return new NPCKillListPrompt(); } } @@ -2133,13 +2142,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter NPC IDs, separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorNPCPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList npcs = new LinkedList(); @@ -2152,13 +2161,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (citizens.getNPCRegistry().getById(i) != null) { npcs.add(i); } else { - context.getForWhom().sendRawMessage(PINK + "" + i + RED + " is not a valid NPC ID!"); + context.getForWhom().sendRawMessage(PINK + "" + i + RED + " " + Lang.get("stageEditorInvalidNPC")); return new npcIdsToKillPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new npcIdsToKillPrompt(); } @@ -2178,13 +2187,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter kill amounts (numbers), separating each one by a space, or enter \'cancel\' to return."; + return YELLOW + Lang.get("stageEditorKillNPCsPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] args = input.split(" "); LinkedList amounts = new LinkedList(); @@ -2195,12 +2204,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (Integer.parseInt(s) > 0) { amounts.add(Integer.parseInt(s)); } else { - context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!"); + context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditorNotGreaterThanZero")); return new npcAmountsToKillPrompt(); } } catch (Exception e) { - context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!"); + context.getForWhom().sendRawMessage( PINK + s + RED + Lang.get("stageEditorNotListofNumbers")); return new npcAmountsToKillPrompt(); } @@ -2226,20 +2235,20 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Kill Mobs -\n"; + String text = GOLD + "- " + Lang.get("stageEditorKillMobs") + " -\n"; if (context.getSessionData(pref + CK.S_MOB_TYPES) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set mob types (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - Set mob amounts (No mob types set)\n"; - text += DARKGRAY + "|---------Optional---------|\n"; - text += GRAY + "3 - Set kill locations (No mob types set)\n"; - text += GRAY + "4 - Set kill location radii (No mob types set)\n"; - text += GRAY + "5 - Set kill location names (No mob types set)\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetMobAmounts") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\n"; + text += DARKGRAY + "|---------" + Lang.get("stageEditorOptional") + "---------|\n"; + text += GRAY + "3 - " + Lang.get("stageEditorSetKillLocations") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\n"; + text += GRAY + "4 - " + Lang.get("stageEditorSetKillLocationRadii") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\n"; + text += GRAY + "5 - " + Lang.get("stageEditorSetKillLocationNames") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\n"; text += DARKGRAY + "|--------------------------|\n"; - text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("done"); } else { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set mob types\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + "\n"; for (String s : getMobTypes(context)) { text += GRAY + " - " + AQUA + s + "\n"; @@ -2247,10 +2256,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_MOB_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set mob amounts (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetMobAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set mob amounts\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetMobAmounts") + "\n"; for (Integer i : getMobAmounts(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -2259,13 +2268,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += DARKGRAY + "|---------Optional---------|"; + text += DARKGRAY + "|---------" + Lang.get("stageEditorOptional") + "---------|"; if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) == null) { - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set kill locations (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetKillLocations") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set kill locations\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetKillLocations") + "\n"; for (String s : getKillLocations(context)) { text += GRAY + " - " + AQUA + s + "\n"; @@ -2275,10 +2284,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS) == null) { - text += BLUE + "4 - Set kill location radii (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "4 - " + Lang.get("stageEditorSetKillLocationRadii") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "4 - Set kill location radii\n"; + text += BLUE + "4 - " + Lang.get("stageEditorSetKillLocationRadii") + "\n"; for (int i : getKillRadii(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -2288,10 +2297,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES) == null) { - text += BLUE + "5 - Set kill location names (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "5 - " + Lang.get("stageEditorSetKillLocationNames") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "5 - Set kill location names\n"; + text += BLUE + "5 - " + Lang.get("stageEditorSetKillLocationNames") + "\n"; for (String s : getKillLocationNames(context)) { text += GRAY + " - " + AQUA + s + "\n"; @@ -2302,8 +2311,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { text += DARKGRAY + "|--------------------------|"; - text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -2318,14 +2327,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new MobTypesPrompt(); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_MOB_TYPES) == null) { - context.getForWhom().sendRawMessage(RED + "You must set mob types first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoMobTypes")); return new MobListPrompt(); } else { return new MobAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { if (context.getSessionData(pref + CK.S_MOB_TYPES) == null) { - context.getForWhom().sendRawMessage(RED + "You must set mob types first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoMobTypes")); return new MobListPrompt(); } else { questFactory.selectedKillLocations.put((Player) context.getForWhom(), null); @@ -2333,20 +2342,20 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } } else if (input.equalsIgnoreCase("4")) { if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) == null) { - context.getForWhom().sendRawMessage(RED + "You must set kill locations first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoKillLocations")); return new MobListPrompt(); } else { return new MobRadiiPrompt(); } } else if (input.equalsIgnoreCase("5")) { if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) == null) { - context.getForWhom().sendRawMessage(RED + "You must set kill locations first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoKillLocations")); return new MobListPrompt(); } else { return new MobLocationNamesPrompt(); } } else if (input.equalsIgnoreCase("6")) { - context.getForWhom().sendRawMessage(YELLOW + "Kill Mobs objective cleared."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorKillMobsCleared")); context.setSessionData(pref + CK.S_MOB_TYPES, null); context.setSessionData(pref + CK.S_MOB_AMOUNTS, null); context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, null); @@ -2399,7 +2408,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (two == three && three == four && four == five) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + "All of your lists are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorAllListsNotSameSize")); return new MobListPrompt(); } @@ -2409,7 +2418,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } } else { - context.getForWhom().sendRawMessage(RED + "The " + GOLD + "mob types list " + RED + "and " + GOLD + "mob amounts list " + RED + "are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorMobTypesNotSameSize")); return new MobListPrompt(); } @@ -2475,7 +2484,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { mobs += PURPLE + "Wolf, "; mobs += PURPLE + "Zombie\n"; - return mobs + YELLOW + "Enter mob names separating each one by a space, or enter \"cancel\" to return"; + return mobs + YELLOW + Lang.get("stageEditorMobsPrompt"); } @@ -2484,7 +2493,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList mobTypes = new LinkedList(); for (String s : input.split(" ")) { @@ -2495,7 +2504,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { context.setSessionData(pref + CK.S_MOB_TYPES, mobTypes); } else { - player.sendMessage(PINK + s + " " + RED + "is not a valid mob name!"); + player.sendMessage(PINK + s + " " + RED + Lang.get("stageEditorInvalidMob")); return new MobTypesPrompt(); } @@ -2513,7 +2522,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter mob amounts separating each one by a space, or enter \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorMobAmountsPrompt"); } @@ -2522,7 +2531,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList mobAmounts = new LinkedList(); for (String s : input.split(" ")) { @@ -2532,7 +2541,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int i = Integer.parseInt(s); if (i < 1) { - player.sendMessage(PINK + input + " " + RED + "is not greater than zero!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorNotGreaterThanZero")); return new MobAmountsPrompt(); } @@ -2540,7 +2549,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } catch (Exception e) { - player.sendMessage(PINK + input + " " + RED + "is not a number!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorInvalidNumber")); return new MobAmountsPrompt(); } @@ -2560,7 +2569,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Right-click on a block to select it, then enter \"add\" to add it to the kill location list, or enter \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorMobLocationPrompt"); } @@ -2569,7 +2578,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("add")) { + if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) { Block block = questFactory.selectedKillLocations.get(player); if (block != null) { @@ -2588,13 +2597,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { questFactory.selectedKillLocations.remove(player); } else { - player.sendMessage(RED + "You must select a block first."); + player.sendMessage(RED + Lang.get("stageEditorNoBlock")); return new MobLocationPrompt(); } return new MobListPrompt(); - } else if (input.equalsIgnoreCase("cancel")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { questFactory.selectedKillLocations.remove(player); return new MobListPrompt(); @@ -2611,7 +2620,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter kill location radii (number of blocks) separating each one by a space, or enter \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorMobLocationRadiiPrompt"); } @@ -2620,7 +2629,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList radii = new LinkedList(); for (String s : input.split(" ")) { @@ -2630,7 +2639,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int i = Integer.parseInt(s); if (i < 1) { - player.sendMessage(PINK + input + " " + RED + "is not greater than zero!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorNotGreaterThanZero")); return new MobRadiiPrompt(); } @@ -2638,7 +2647,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } catch (Exception e) { - player.sendMessage(PINK + input + " " + RED + "is not a number!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorInvalidItemID")); return new MobRadiiPrompt(); } @@ -2658,14 +2667,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter location names separating each one by a " + BOLD + "" + ITALIC + "comma" + RESET + "" + YELLOW + ", or enter \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorMobLocationNamesPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList locNames = new LinkedList(); locNames.addAll(Arrays.asList(input.split(","))); @@ -2690,16 +2699,16 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Reach Locations -\n"; + String text = GOLD + "- " + Lang.get("stageEditorReachLocs") + " -\n"; if (context.getSessionData(pref + CK.S_REACH_LOCATIONS) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set locations (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - Set location radii (No locations set)\n"; - text += GRAY + "3 - Set location names (No locations set)\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetLocations") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetLocationRadii") + " (" + Lang.get("stageEditorNoLocationsSet") + ")\n"; + text += GRAY + "3 - " + Lang.get("stageEditorSetLocationNames") + " (" + Lang.get(Lang.get("stageEditorNoLocationsSet")) + ")\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done"); } else { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set locations\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetLocations") + "\n"; for (String s : getLocations(context)) { text += GRAY + " - " + DARKAQUA + s + "\n"; @@ -2707,10 +2716,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set location radii (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetLocationRadii") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set location radii\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetLocationRadii") + "\n"; for (Integer i : getLocationRadii(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -2720,10 +2729,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES) == null) { - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set location names (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get(Lang.get("stageEditorSetLocationNames")) + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set location names\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get(Lang.get("stageEditorSetLocationNames")) + "\n"; for (String s : getLocationNames(context)) { text += GRAY + " - " + AQUA + s + "\n"; @@ -2732,8 +2741,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -2823,7 +2832,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Right-click on a block to select it, then enter \"add\" to add it to the reach location list, or enter \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorReachLocationPrompt"); } @@ -2832,7 +2841,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("add")) { + if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) { Block block = questFactory.selectedReachLocations.get(player); if (block != null) { @@ -2851,13 +2860,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { questFactory.selectedReachLocations.remove(player); } else { - player.sendMessage(RED + "You must select a block first."); + player.sendMessage(RED + Lang.get("stageEditorNoBlockSelected")); return new ReachLocationPrompt(); } return new ReachListPrompt(); - } else if (input.equalsIgnoreCase("cancel")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { questFactory.selectedReachLocations.remove(player); return new ReachListPrompt(); @@ -2874,7 +2883,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter reach location radii (number of blocks) separating each one by a space, or enter \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorReachLocationRadiiPrompt"); } @@ -2883,7 +2892,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList radii = new LinkedList(); for (String s : input.split(" ")) { @@ -2893,7 +2902,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int i = Integer.parseInt(s); if (i < 1) { - player.sendMessage(PINK + input + " " + RED + "is not greater than zero!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorNotGreaterThanZero")); return new ReachRadiiPrompt(); } @@ -2901,7 +2910,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } catch (Exception e) { - player.sendMessage(PINK + input + " " + RED + "is not a number!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorInvalidNumber")); return new ReachRadiiPrompt(); } @@ -2921,14 +2930,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter location names separating each one by a " + BOLD + "" + ITALIC + "comma" + RESET + "" + YELLOW + ", or enter \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorReachLocationNamesPrompt"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList locNames = new LinkedList(); locNames.addAll(Arrays.asList(input.split(","))); @@ -2953,15 +2962,15 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Tame Mobs -\n"; + String text = GOLD + "- " + Lang.get("stageEditorTameMobs") + " -\n"; if (context.getSessionData(pref + CK.S_TAME_TYPES) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set mob types (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - Set tame amounts (No mob types set)\n"; - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetTameAmounts") + " (" + Lang.get("stageEditorNoMobTypesSet") + ")\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 + " - Set mob types\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + "\n"; for (String s : getTameTypes(context)) { text += GRAY + " - " + AQUA + s + "\n"; @@ -2969,10 +2978,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_TAME_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set tame amounts (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetTameAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set tame amounts\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetTameAmounts") + "\n"; for (Integer i : getTameAmounts(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -2981,8 +2990,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -2997,13 +3006,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new TameTypesPrompt(); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_TAME_TYPES) == null) { - context.getForWhom().sendRawMessage(RED + "You must set mob types first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoMobTypes")); return new TameListPrompt(); } else { return new TameAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { - context.getForWhom().sendRawMessage(YELLOW + "Tame Mobs objective cleared."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorTameCleared")); context.setSessionData(pref + CK.S_TAME_TYPES, null); context.setSessionData(pref + CK.S_TAME_AMOUNTS, null); return new TameListPrompt(); @@ -3027,7 +3036,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + "The " + GOLD + "mob types list " + RED + "and " + GOLD + "tame amounts list " + RED + "are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorTameMobsNotSameSize")); return new TameListPrompt(); } @@ -3081,7 +3090,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { mobs += PURPLE + "Wolf, "; mobs += PURPLE + "Zombie\n"; - return mobs + YELLOW + "Enter mob names separating each one by a space, or enter \"cancel\" to return"; + return mobs + YELLOW + Lang.get("stageEditorMobsPrompt"); } @@ -3090,7 +3099,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList mobTypes = new LinkedList(); for (String s : input.split(" ")) { @@ -3101,7 +3110,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { context.setSessionData(pref + CK.S_TAME_TYPES, mobTypes); } else { - player.sendMessage(PINK + s + " " + RED + "is not a valid mob name!"); + player.sendMessage(PINK + s + " " + RED + Lang.get("stageEditorInvalidMob")); return new TameTypesPrompt(); } @@ -3119,7 +3128,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter tame amounts separating each one by a space, or enter \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorTameAmountsPrompt"); } @@ -3128,7 +3137,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList mobAmounts = new LinkedList(); for (String s : input.split(" ")) { @@ -3138,14 +3147,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int i = Integer.parseInt(s); if (i < 1) { - player.sendMessage(PINK + input + " " + RED + "is not greater than zero!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorNotGreaterThanZero")); return new TameAmountsPrompt(); } mobAmounts.add(i); } catch (Exception e) { - player.sendMessage(PINK + input + " " + RED + "is not a number!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorInvalidNumber")); return new TameAmountsPrompt(); } @@ -3171,15 +3180,15 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Shear Sheeps -\n"; + String text = GOLD + "- " + Lang.get("stageEditorShearSheep") + " -\n"; if (context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) { - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set sheep colors (" + Lang.get("noneSet") + ")\n"; - text += GRAY + "2 - Set shear amounts (No colors set)\n"; - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetShearColors") + " (" + Lang.get("noneSet") + ")\n"; + text += GRAY + "2 - " + Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("stageEditorNoColorsSet") + ")\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 + " - Set sheep colors\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetShearColors") + "\n"; for (String s : getShearColors(context)) { text += GRAY + " - " + AQUA + s + "\n"; @@ -3187,10 +3196,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (context.getSessionData(pref + CK.S_SHEAR_AMOUNTS) == null) { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set shear amounts (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set shear amounts\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorSetShearAmounts") + "\n"; for (Integer i : getShearAmounts(context)) { text += GRAY + " - " + AQUA + i + "\n"; @@ -3199,8 +3208,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n"; - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); } @@ -3215,13 +3224,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { return new ShearColorsPrompt(); } else if (input.equalsIgnoreCase("2")) { if (context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) { - context.getForWhom().sendRawMessage(RED + "You must set colors first!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoColors")); return new ShearListPrompt(); } else { return new ShearAmountsPrompt(); } } else if (input.equalsIgnoreCase("3")) { - context.getForWhom().sendRawMessage(YELLOW + "Shear Sheep objective cleared."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorShearCleared")); context.setSessionData(pref + CK.S_SHEAR_COLORS, null); context.setSessionData(pref + CK.S_SHEAR_AMOUNTS, null); return new ShearListPrompt(); @@ -3245,7 +3254,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (one == two) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - context.getForWhom().sendRawMessage(RED + "The " + GOLD + "sheep colors list " + RED + "and " + GOLD + "shear amounts list " + RED + "are not the same size!"); + context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorShearNotSameSize")); return new ShearListPrompt(); } @@ -3269,7 +3278,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String mobs = PINK + "- Sheep Colors - \n"; + String mobs = PINK + "- " + Lang.get("stageEditorColors") + " - \n"; mobs += PURPLE + "Black, "; mobs += PURPLE + "Blue, "; mobs += PURPLE + "Brown, "; @@ -3287,7 +3296,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { mobs += PURPLE + "White, "; mobs += PURPLE + "Yellow\n"; - return mobs + YELLOW + "Enter sheep colors separating each one by a space, or enter \"cancel\" to return"; + return mobs + YELLOW + Lang.get("stageEditorShearColorsPrompt"); } @@ -3296,7 +3305,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList colors = new LinkedList(); for (String s : input.split(" ")) { @@ -3307,7 +3316,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { context.setSessionData(pref + CK.S_SHEAR_COLORS, colors); } else { - player.sendMessage(PINK + s + " " + RED + "is not a valid dye color!"); + player.sendMessage(PINK + s + " " + RED + Lang.get("stageEditorInvalidDye")); return new ShearColorsPrompt(); } @@ -3325,7 +3334,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter shear amounts separating each one by a space, or enter \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorShearAmountsPrompt"); } @@ -3334,7 +3343,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { LinkedList shearAmounts = new LinkedList(); for (String s : input.split(" ")) { @@ -3344,14 +3353,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int i = Integer.parseInt(s); if (i < 1) { - player.sendMessage(PINK + input + " " + RED + "is not greater than zero!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorNotGreaterThanZero")); return new ShearAmountsPrompt(); } shearAmounts.add(i); } catch (Exception e) { - player.sendMessage(PINK + input + " " + RED + "is not a number!"); + player.sendMessage(PINK + input + " " + RED + Lang.get("stageEditorInvalidNumber")); return new ShearAmountsPrompt(); } @@ -3371,7 +3380,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = DARKGREEN + "- Events -\n"; + String text = DARKGREEN + "- " + Lang.get("stageEditorEvents") + " -\n"; if (questFactory.quests.events.isEmpty()) { text += RED + "- None"; } else { @@ -3380,7 +3389,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } } - return text + YELLOW + "Enter an event name, or enter \"clear\" to clear the event, or \"cancel\" to return"; + return text + YELLOW + Lang.get("stageEditorEventsPrompt"); } @@ -3389,7 +3398,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { Event found = null; @@ -3403,14 +3412,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (found == null) { - player.sendMessage(RED + input + YELLOW + " is not a valid event name!"); + player.sendMessage(RED + input + YELLOW + " " + Lang.get("stageEditorInvalidEvent")); return new EventPrompt(); } else { context.setSessionData(pref + CK.S_EVENT, found.getName()); return new CreateStagePrompt(stageNum, questFactory, citizens); } - } else if (input.equalsIgnoreCase("clear")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { context.setSessionData(pref + CK.S_EVENT, null); player.sendMessage(YELLOW + "Event cleared."); return new CreateStagePrompt(stageNum, questFactory, citizens); @@ -3426,7 +3435,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter time (in milliseconds), or enter \"clear\" to clear the delay, or \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorDelayPrompt"); } @@ -3435,7 +3444,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { long l; @@ -3444,20 +3453,20 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { l = Long.parseLong(input); } catch (Exception e) { - player.sendMessage(YELLOW + "Input was not a number!"); + player.sendMessage(YELLOW + Lang.get("stageEditorNoNumber")); return new DelayPrompt(); } if (l < 1000) { - player.sendMessage(YELLOW + "Delay must be at least one second!"); + player.sendMessage(YELLOW + Lang.get("stageEditorInvalidDelay")); return new DelayPrompt(); } else { context.setSessionData(pref + CK.S_DELAY, l); return new CreateStagePrompt(stageNum, questFactory, citizens); } - } else if (input.equalsIgnoreCase("clear")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { context.setSessionData(pref + CK.S_DELAY, null); player.sendMessage(YELLOW + "Delay cleared."); return new CreateStagePrompt(stageNum, questFactory, citizens); @@ -3473,7 +3482,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter delay message, or enter \"clear\" to clear the message, or \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorDelayMessagePrompt"); } @@ -3482,12 +3491,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { context.setSessionData(pref + CK.S_DELAY_MESSAGE, input); return new CreateStagePrompt(stageNum, questFactory, citizens); - } else if (input.equalsIgnoreCase("clear")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { context.setSessionData(pref + CK.S_DELAY_MESSAGE, null); player.sendMessage(YELLOW + "Delay message cleared."); return new CreateStagePrompt(stageNum, questFactory, citizens); @@ -3503,13 +3512,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = DARKAQUA + "- Denizen Scripts -"; + String text = DARKAQUA + "- " + Lang.get("stageEditorDenizenScript") + " -"; for (String s : ScriptRegistry._getScriptNames()) { text += AQUA + "- " + s + "\n"; } - return YELLOW + "Enter script name, or enter \"clear\" to clear the script, or \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorScriptPrompt"); } @@ -3518,7 +3527,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { if (ScriptRegistry.containsScript(input)) { @@ -3527,17 +3536,17 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } else { - player.sendMessage(RED + "Denizen script not found!"); + player.sendMessage(RED + Lang.get("stageEditorInvalidScript")); return new DenizenPrompt(); } - } else if (input.equalsIgnoreCase("clear")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { context.setSessionData(pref + CK.S_DENIZEN, null); player.sendMessage(YELLOW + "Denizen script cleared."); return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - return new DenizenPrompt(); + return new CreateStagePrompt(stageNum, questFactory, citizens); } } @@ -3551,12 +3560,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext cc) { - String text = GOLD + "- " + DARKRED + "Kill Bosses" + GOLD + " -\n"; + String text = GOLD + "- " + DARKRED + Lang.get("stageEditorKillBosses") + GOLD + " -\n"; if (cc.getSessionData(pref + "bossIds") == null) { - text += BOLD + "" + RED + "1 " + RESET + RED + "- Set Bosses (" + Lang.get("noneSet") + ")\n"; + text += BOLD + "" + RED + "1 " + RESET + RED + "- " + Lang.get("stageEditorSetBosses") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BOLD + "" + RED + "1 " + RESET + RED + "- Set Bosses\n"; + text += BOLD + "" + RED + "1 " + RESET + RED + "- " + Lang.get("stageEditorSetBosses") + "\n"; LinkedList ids = (LinkedList) cc.getSessionData(pref + "bossIds"); for (String id : ids) { @@ -3568,23 +3577,21 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } } - - } } if (cc.getSessionData(pref + "bossAmounts") == null) { - text += BOLD + "" + RED + "2 " + RESET + RED + "- Set kill amounts (" + Lang.get("noneSet") + ")\n"; + text += BOLD + "" + RED + "2 " + RESET + RED + "- " + Lang.get("stageEditorSetKillAmounts") + " (" + Lang.get("noneSet") + ")\n"; } else { - text += BOLD + "" + RED + "2 " + RESET + RED + "- Set kill amounts\n"; + text += BOLD + "" + RED + "2 " + RESET + RED + "- " + Lang.get("stageEditorSetKillAmounts") + "\n"; LinkedList amounts = (LinkedList) cc.getSessionData(pref + "bossAmounts"); for (int amount : amounts) { text += GOLD + " - " + YELLOW + amount + "\n"; } } - text += BOLD + "" + RED + "3 " + RESET + RED + "- Clear\n"; - text += BOLD + "" + RED + "4 " + RESET + GREEN + "- Done\n\n"; + text += BOLD + "" + RED + "3 " + RESET + RED + "- " + Lang.get("clear") + "\n"; + text += BOLD + "" + RED + "4 " + RESET + GREEN + "- " + Lang.get("done"); return text; } @@ -3601,7 +3608,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { cc.setSessionData(pref + "bossIds", null); cc.setSessionData(pref + "bossAmounts", null); - cc.getForWhom().sendRawMessage(YELLOW + "Kill Bosses objective cleared."); + cc.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorBossesCleared")); return new EpicBossListPrompt(); }else if(input.equalsIgnoreCase("4")) { @@ -3617,7 +3624,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if(idNum != amountNum){ - cc.getForWhom().sendRawMessage(RED + "Error: the lists are not the same size!"); + cc.getForWhom().sendRawMessage(RED + Lang.get("stageEditorBossesNotSameSize")); return new EpicBossListPrompt(); } @@ -3633,9 +3640,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext cc) { - String text = GOLD + "- " + DARKRED + "Bosses" + GOLD + " -\n"; + String text = GOLD + "- " + DARKRED + Lang.get("stageEditorBosses") + GOLD + " -\n"; if (Quests.epicBoss.BossLoadList.isEmpty()) { - text += RED + "- None\n"; + text += RED + "- " + Lang.get("none") + "\n"; } else { for (LoadBoss b : Quests.epicBoss.BossLoadList) { @@ -3645,7 +3652,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } text += "\n"; - text += YELLOW + "Enter Boss names, separating each one by a space, or 'cancel' to return."; + text += YELLOW + Lang.get("stageEditorBossNamePrompt"); return text; } @@ -3653,7 +3660,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public Prompt acceptInput(ConversationContext cc, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] ids = input.split(" "); LinkedList idList = new LinkedList(); @@ -3669,11 +3676,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } if (found == null) { - cc.getForWhom().sendRawMessage(RED + "Error: could not find Boss with name " + id + "!"); + cc.getForWhom().sendRawMessage(RED + Lang.get("stageEditorInvalidBoss") + " " + id + "!"); return new EpicBossIDListPrompt(); } else { if (idList.contains(found.getName())) { - cc.getForWhom().sendRawMessage(RED + "Error: list contains duplicates!"); + cc.getForWhom().sendRawMessage(RED + Lang.get("stageEditorContainsDuplicates")); return new EpicBossIDListPrompt(); } else { idList.add(found.getName()); @@ -3695,7 +3702,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext cc) { - String text = YELLOW + "Enter kill amounts (numbers), separating each one by a space, or 'cancel' to return."; + String text = YELLOW + Lang.get("stageEditorBossAmountPrompt"); return text; } @@ -3703,7 +3710,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public Prompt acceptInput(ConversationContext cc, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { String[] amounts = input.split(","); LinkedList amountList = new LinkedList(); @@ -3713,14 +3720,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { int i = Integer.parseInt(amount); if(i < 1){ - cc.getForWhom().sendRawMessage(RED + "Error: " + amount + " is not greater than zero!"); + cc.getForWhom().sendRawMessage(RED + amount + " " + Lang.get("stageEditorNotGreaterThanZero")); return new EpicBossAmountListPrompt(); } amountList.add(i); } catch (Exception e) { - cc.getForWhom().sendRawMessage(RED + "Error: " + amount + " is not a number!"); + cc.getForWhom().sendRawMessage(RED + amount + " " + Lang.get("stageEditorInvalidNumber")); return new EpicBossAmountListPrompt(); } @@ -3740,9 +3747,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GREEN + "" + BOLD + "1" + RESET + "" + GREEN + " - Yes\n"; - text += GREEN + "" + BOLD + "2" + RESET + "" + GREEN + " - No"; - return RED + "Are you sure you want to delete " + YELLOW + "Stage " + stageNum + RED + " of " + GOLD + context.getSessionData(CK.Q_NAME) + RED + "?\n(Any Stages after will be shifted back one spot)\n" + text; + String text = GREEN + "" + BOLD + "1" + RESET + "" + GREEN + " - " + Lang.get("yes") + "\n"; + text += GREEN + "" + BOLD + "2" + RESET + "" + GREEN + " - " + Lang.get("no"); + return RED + Lang.get("stageEditorConfirmStageDelete") + "\n" + YELLOW + Lang.get("stageEditorStage") + " " + stageNum + ": " + context.getSessionData(CK.Q_NAME) + RED + "\n(" + Lang.get("stageEditorConfirmStageNote") + ")\n" + text; } @@ -3753,12 +3760,12 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase("Yes")) { StagesPrompt.deleteStage(context, stageNum); - player.sendMessage(YELLOW + "Stage deleted successfully."); + player.sendMessage(YELLOW + Lang.get("stageEditorDeleteSucces")); return new StagesPrompt(questFactory); } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase("No")) { return new CreateStagePrompt(stageNum, questFactory, citizens); } else { - player.sendMessage(RED + "Invalid option!"); + player.sendMessage(RED + Lang.get("invalidOption")); return new DeletePrompt(); } @@ -3770,7 +3777,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter start message, or enter \"clear\" to clear the message, or \"cancel\" to return"; + return YELLOW + Lang.get("stageEditorStartMessagePrompt"); } @@ -3778,14 +3785,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { public Prompt acceptInput(ConversationContext context, String input) { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { context.setSessionData(pref + CK.S_START_MESSAGE, input); return new CreateStagePrompt(stageNum, questFactory, citizens); - } else if (input.equalsIgnoreCase("clear")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { context.setSessionData(pref + CK.S_START_MESSAGE, null); - player.sendMessage(YELLOW + "Start message cleared."); + player.sendMessage(YELLOW + Lang.get("stageEditorStartMessageCleared")); return new CreateStagePrompt(stageNum, questFactory, citizens); } else { return new CreateStagePrompt(stageNum, questFactory, citizens); @@ -3799,7 +3806,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { @Override public String getPromptText(ConversationContext context) { - return YELLOW + "Enter complete message, or enter \"clear\" to clear the message, or \"cancel\" to return"; + return YELLOW + Lang.get("Enter complete message, or enter \"clear\" to clear the message, or \"cancel\" to return"); } @@ -3807,14 +3814,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { public Prompt acceptInput(ConversationContext context, String input) { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { context.setSessionData(pref + CK.S_COMPLETE_MESSAGE, input); return new CreateStagePrompt(stageNum, questFactory, citizens); - } else if (input.equalsIgnoreCase("clear")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { context.setSessionData(pref + CK.S_COMPLETE_MESSAGE, null); - player.sendMessage(YELLOW + "Complete message cleared."); + player.sendMessage(YELLOW + Lang.get("stageEditorCompleteMessageCleared")); return new CreateStagePrompt(stageNum, questFactory, citizens); } else { return new CreateStagePrompt(stageNum, questFactory, citizens); @@ -3822,4 +3829,255 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil { } } + + private class MiniEventPrompt extends StringPrompt { + + @SuppressWarnings("unchecked") + @Override + public String getPromptText(ConversationContext context) { + String text = YELLOW + "- " + GOLD + Lang.get("stageEditorMiniEventMessage") + YELLOW + "-\n"; + if (context.getSessionData(CK.S_MINI_EVENTS) == null) { + text += PINK + "" + BOLD + "1 " + RESET + PURPLE + "- " + "onDeath" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + text += PINK + "" + BOLD + "2 " + RESET + PURPLE + "- " + "onKill" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + text += PINK + "" + BOLD + "3 " + RESET + PURPLE + "- " + "onReach" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + "onStageEnd" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + text += PINK + "" + BOLD + "5 " + RESET + PURPLE + "- " + "onQuestQuit" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + text += PINK + "" + BOLD + "6 " + RESET + PURPLE + "- " + "onNpcTalk" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + text += GREEN + "" + BOLD + "7 " + RESET + GREEN + "- " + Lang.get("done"); + } else { + Map> map = (Map>) context.getSessionData(CK.S_MINI_EVENTS); + + if (map.containsKey(MiniEventType.ONDEATH)) { + text += PINK + "" + BOLD + "1 " + RESET + PURPLE + "- " + "onDeath" + AQUA + " (" + map.get(MiniEventType.ONDEATH).size() + ")\n"; + } else { + text += PINK + "" + BOLD + "1 " + RESET + PURPLE + "- " + "onDeath" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey(MiniEventType.ONKILL)) { + text += PINK + "" + BOLD + "2 " + RESET + PURPLE + "- " + "onKill" + AQUA + " (" + map.get(MiniEventType.ONKILL) + ")\n"; + } else { + text += PINK + "" + BOLD + "2 " + RESET + PURPLE + "- " + "onKill" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey(MiniEventType.ONREACH)) { + text += PINK + "" + BOLD + "3 " + RESET + PURPLE + "- " + "onReach" + AQUA + " (" + map.get(MiniEventType.ONREACH).size() + ")\n"; + } else { + text += PINK + "" + BOLD + "3 " + RESET + PURPLE + "- " + "onReach" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey(MiniEventType.ONSTAGEEND)) { + text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + "onStageEnd" + AQUA + " (" + map.get(MiniEventType.ONSTAGEEND).size() + ")\n"; + } else { + text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + "onStageEnd" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey(MiniEventType.ONQUESTQUIT)) { + text += PINK + "" + BOLD + "5 " + RESET + PURPLE + "- " + "onQuestQuit" + AQUA + " (" + map.get(MiniEventType.ONQUESTQUIT).size() + ")\n"; + } else { + text += PINK + "" + BOLD + "5 " + RESET + PURPLE + "- " + "onQuestQuit" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + if (map.containsKey(MiniEventType.ONNPCINTERACT)) { + text += PINK + "" + BOLD + "6 " + RESET + PURPLE + "- " + "onNpcTalk" + AQUA + " (" + map.get(MiniEventType.ONNPCINTERACT).size() + ")\n"; + } else { + text += PINK + "" + BOLD + "6 " + RESET + PURPLE + "- " + "onNpcTalk" + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + text += GREEN + "" + BOLD + "7 " + RESET + GREEN + "- " + Lang.get("done"); + } + return text; + } + + @Override + public Prompt acceptInput(ConversationContext context, String input) { + MiniEventType type = null; + switch (input) { + case "1": + type = MiniEventType.ONDEATH; + break; + case "2": + type = MiniEventType.ONKILL; + break; + case "3": + type = MiniEventType.ONREACH; + break; + case "4": + type = MiniEventType.ONSTAGEEND; + break; + case "5": + type = MiniEventType.ONQUESTQUIT; + break; + case "6": + type = MiniEventType.ONNPCINTERACT; + break; + case "7": + return new CreateStagePrompt(stageNum, questFactory, citizens); + } + + if (type == null) return new MiniEventPrompt(); + + return new MiniEventEditorPrompt(type); + + } + } + + private class MiniEventEditorPrompt extends StringPrompt { + + private MiniEventType type; + + public MiniEventEditorPrompt (MiniEventType type) { + this.type = type; + } + + @Override + public String getPromptText(ConversationContext context) { + String text = YELLOW + "- " + GOLD + type.getName() + YELLOW + "-\n"; + if (context.getSessionData(CK.S_MINI_EVENTS) == null) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorAddMiniEvent") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("done"); + } else { + HashMap> types = (HashMap>) context.getSessionData(CK.S_MINI_EVENTS); + for (int i = 0; i < types.size(); i++) { + text += GOLD + " " + (i + 1) + " - Edit: " + AQUA + "Mini-Event: " + (i + 1); + } + + text += BLUE + "" + BOLD + (types.size() + 1) + RESET + YELLOW + " - " + Lang.get("stageEditorAddMiniEvent") + "\n"; + text += BLUE + "" + BOLD + (types.size() + 2) + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; + text += GREEN + "" + BOLD + (types.size() + 3) + RESET + YELLOW + " - " + Lang.get("done"); + + } + return text; + } + + @Override + public Prompt acceptInput(ConversationContext context, String input) { + HashMap> map = (HashMap>) context.getSessionData(CK.S_MINI_EVENTS); + boolean none = true; + if (map != null) { + if (map.containsKey(type)) none = false; + } + if (none) { + if (input.equalsIgnoreCase("1")) { + return new MiniEventAddPrompt(0, null); + } else if (input.equalsIgnoreCase("2")) { + //TODO cleared + context.getForWhom().sendRawMessage(YELLOW + Lang.get("eventEditorMobSpawnsCleared")); + return new MiniEventEditorPrompt(type); + } else if (input.equalsIgnoreCase("3")) { + return new CreateStagePrompt(stageNum, questFactory, citizens); + } + } else { + LinkedList types = new LinkedList(map.get(type)); + int inp = -1; + try { + inp = Integer.parseInt(input); + } catch (Exception e) { + context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorNotANumber")); + return new MiniEventEditorPrompt(type); + } + + if (inp == types.size() + 1) { + return new MiniEventAddPrompt(inp - 1, null); + } else if (inp == types.size() + 2) { + //TODO cleared + context.getForWhom().sendRawMessage(YELLOW + Lang.get("eventEditorMobSpawnsCleared")); + map.put(type, null); + context.setSessionData(CK.S_MINI_EVENTS, map); + return new MiniEventEditorPrompt(type); + } else if (inp == types.size() + 3) { + return new CreateStagePrompt(stageNum, questFactory, citizens); + } else if (inp > types.size()){ + return new MiniEventEditorPrompt(type); + } else { + return new MiniEventAddPrompt(inp - 1, types.get(inp - 1)); + } + } + + return new MiniEventEditorPrompt(type); + } + } + + private class MiniEventAddPrompt extends StringPrompt { + + private int index; + private MiniEvent miniEvent; + + public MiniEventAddPrompt (int index, MiniEvent miniEvent) { + this.index = index; + if (miniEvent == null) { + this.miniEvent = new MiniEvent(null); + } else { + this.miniEvent = miniEvent; + } + + } + + @SuppressWarnings("unchecked") + @Override + public String getPromptText(ConversationContext context) { + String text = "\n"; + HashMap map = (HashMap) miniEvent.getValues(); + + if (map.containsKey("cancel")) { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventCancel") + GRAY + " (" + map.get("cancel") + ")\n"; + } else { + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventCancel") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey("command")) { + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventCommand") + GRAY + " (" + map.get("command") + ")\n"; + } else { + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventCommand") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey("send-message")) { + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventSendMessage") + GRAY + " (" + map.get("send-message") + ")\n"; + } else { + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventSendMessage") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey("chat-message")) { + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventChatMessage") + GRAY + " (" + map.get("chat-message") + ")\n"; + } else { + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventChatMessage") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey("broadcast-message")) { + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventBroadcastMessage") + GRAY + " (" + map.get("broadcast-message") + ")\n"; + } else { + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventBroadcaseMessage") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey("set-stage")) { + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventSetStage") + GRAY + " (" + map.get("set-stage") + ")\n"; + } else { + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventSetStage") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey("teleport")) { + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventTeleport") + GRAY + " (" + map.get("teleport") + ")\n"; + } else { + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventTeleport") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey("take-item")) { + text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventTakeItem") + GRAY + " (" + map.get("take-item") + ")\n"; + } else { + text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventTakeItem") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + if (map.containsKey("add-item")) { + text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventAddItem") + GRAY + " (" + map.get("add-item") + ")\n"; + } else { + text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("stageEditorMiniEventAddItem") + GRAY + " (" + Lang.get("noneSet") + ")\n"; + } + + text += GREEN + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("done"); + return text; + } + + @Override + public Prompt acceptInput(ConversationContext context, String input) { + return null; + } + } } diff --git a/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java b/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java index 8ee2ccc70..97f0734bd 100644 --- a/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java @@ -446,6 +446,8 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{ public Prompt acceptInput(ConversationContext cc, String input) { if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){ + input = Quests.parseString(input); + cc.setSessionData("tempName", input); }else if(input.equalsIgnoreCase("clear")){ @@ -470,6 +472,8 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{ @Override public Prompt acceptInput(ConversationContext cc, String input) { if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){ + + input = Quests.parseString(input); LinkedList lore = new LinkedList(); for(String line : input.split(";")) diff --git a/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java b/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java index ac05bc4ce..11425db58 100644 --- a/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java @@ -570,7 +570,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil{ String skillList = GOLD + "-Skill List-\n" + AQUA + "Acrobatics\n" + - AQUA + "All\n" + + GRAY + "All\n" + AQUA + "Archery\n" + AQUA + "Axes\n" + AQUA + "Excavation\n" + diff --git a/src/main/java/me/blackvein/quests/util/CK.java b/src/main/java/me/blackvein/quests/util/CK.java index 23a7d420b..a25ab08f5 100644 --- a/src/main/java/me/blackvein/quests/util/CK.java +++ b/src/main/java/me/blackvein/quests/util/CK.java @@ -77,6 +77,7 @@ public class CK { public static final String S_DENIZEN = "denizen"; public static final String S_COMPLETE_MESSAGE = "completeMessage"; public static final String S_START_MESSAGE = "startMessage"; + public static final String S_MINI_EVENTS = "miniEvents"; //Events public static final String E_OLD_EVENT = "oldEvent"; @@ -93,8 +94,6 @@ public class CK { public static final String E_WORLD_THUNDER = "evtThunderWorld"; public static final String E_WORLD_THUNDER_DURATION = "evtThunderDuration"; public static final String E_MOB_TYPES = "evtMobTypes"; - public static final String E_MOB_AMOUNTS = "evtMobAmounts"; - public static final String E_MOB_LOCATIONS = "evtMobLocations"; public static final String E_LIGHTNING = "evtLightningStrikes"; public static final String E_POTION_TYPES = "evtPotionTypes"; public static final String E_POTION_DURATIONS = "evtPotionDurations"; diff --git a/src/main/java/me/blackvein/quests/util/ItemUtil.java b/src/main/java/me/blackvein/quests/util/ItemUtil.java index 2d3b27e47..9c66b935f 100644 --- a/src/main/java/me/blackvein/quests/util/ItemUtil.java +++ b/src/main/java/me/blackvein/quests/util/ItemUtil.java @@ -70,6 +70,7 @@ public class ItemUtil implements ColorUtil{ // public static ItemStack readItemStack(String data){ + if (data == null) return null; ItemStack stack = null; String[] args = data.split(":"); ItemMeta meta = null; @@ -107,6 +108,8 @@ public class ItemUtil implements ColorUtil{ public static String serialize(ItemStack is){ String serial; + + if (is == null) return null; serial = "id-" + is.getTypeId(); serial += ":amount-" + is.getAmount(); diff --git a/src/main/java/me/blackvein/quests/util/Lang.java b/src/main/java/me/blackvein/quests/util/Lang.java index 800d0c366..8727aff71 100644 --- a/src/main/java/me/blackvein/quests/util/Lang.java +++ b/src/main/java/me/blackvein/quests/util/Lang.java @@ -12,336 +12,483 @@ import org.bukkit.configuration.file.YamlConfiguration; public class Lang { - public static String lang = "en"; - - private static Map en = new LinkedHashMap(); + public static String lang = "en"; + + private static Map en = new LinkedHashMap(); private Quests plugin; - public Lang (Quests plugin) { - this.plugin = plugin; - } - - public static String get(String key){ - return en.get(key); - } + public Lang (Quests plugin) { + this.plugin = plugin; + } - public void initPhrases(){ + public static String get(String key){ + return en.get(key); + } - //English -//TODO: If finished, completely check everything. - //Quests - //Quest create menu - en.put("questEditorHeader", "Create Quest"); - en.put("questEditorCreate", "Create new Quest"); - en.put("questEditorEdit", "Edit a Quest"); - en.put("questEditorDelete", "Delete Quest"); - en.put("questEditorName", "Set name"); - - en.put("questEditorAskMessage", "Set ask message"); - en.put("questEditorFinishMessage", "Set finish message"); - en.put("questEditorRedoDelay", "Set redo delay"); - en.put("questEditorNPCStart", "Set NPC start"); - en.put("questEditorBlockStart", "Set Block start"); - en.put("questEditorInitialEvent", "Set initial Event"); - en.put("questEditorReqs", "Edit Requirements"); - en.put("questEditorStages", "Edit Stages"); - en.put("questEditorRews", "Edit Rewards"); - - en.put("questEditorEnterQuestName", "Enter Quest name (or \"cancel\" to return)"); - en.put("questEditorEnterAskMessage", "Enter ask message (or \"cancel\" to return)"); - en.put("questEditorEnterFinishMessage", "Enter finish message (or \"cancel\" to return)"); - en.put("questEditorEnterRedoDelay", "Enter amount of time (in milliseconds), 0 to clear the redo delay or -1 to cancel "); - en.put("questEditorEnterNPCStart", "Enter NPC ID, -1 to clear the NPC start or -2 to cancel"); - en.put("questEditorEnterBlockStart", "Right-click on a block to use as a start point, then enter \"done\" to save,\n" - + "or enter \"clear\" to clear the block start, or \"cancel\" to return"); - en.put("questEditorEnterInitialEvent", "Enter an Event name, or enter \"clear\" to clear the initial Event, or \"cancel\" to return"); - - //Quest create menu errors - en.put("questEditorNameExists", "A Quest with that name already exists!"); - en.put("questEditorBeingEdited", "Someone is creating/editing a Quest with that name!"); - en.put("questEditorInvalidQuestName", "Name may not contain commas!"); - en.put("questEditorInvalidEventName", "is not a valid event name!"); - en.put("questEditorInvalidNPC", "No NPC exists with that id!"); - en.put("questEditorNoStartBlockSelected", "You must select a block first."); - en.put("questEditorPositiveAmount", "Amount must be a positive number."); - en.put("questEditorQuestAsRequirement1", "The following Quests have"); - en.put("questEditorQuestAsRequirement2", "as a requirement:"); - en.put("questEditorQuestAsRequirement3", "You must modify these Quests so that they do not use it before deleting it."); - en.put("questEditorQuestNotFound", "Quest not found!"); - - en.put("questEditorEventCleared", "Initial Event cleared."); - en.put("questEditorSave", "Finish and save"); - - en.put("questEditorNeedAskMessage", "You must set an ask message!"); - en.put("questEditorNeedFinishMessage", "You must set a finish message!"); - en.put("questEditorNeedStages", "Your Quest has no Stages!"); - en.put("questEditorSaved", "Quest saved! (You will need to perform a Quest reload for it to appear)"); - en.put("questEditorExited", "Are you sure you want to exit without saving?"); - en.put("questEditorDeleted", "Are you sure you want to delete the Quest"); - - en.put("questEditorNoPermsCreate", "You do not have permission to create Quests."); - en.put("questEditorNoPermsEdit", "You do not have permission to edit Quests."); - en.put("questEditorNoPermsDelete", "You do not have permission to delete Quests."); - // - - //Stages - //Menu - en.put("stageEditorEditStage", "Edit Stage"); - en.put("stageEditorNewStage", "Add new Stage"); - //create prompt - en.put("stageEditorStages", "Stages"); - en.put("stageEditorStage", "Stage"); - en.put("stageEditorEditStage", "Edit Stage"); - en.put("stageEditorNewStage", "Add new Stage"); - en.put("stageEditorBreakBlocks", "Break Blocks"); - en.put("stageEditorDamageBlocks", "Damage Blocks"); - en.put("stageEditorPlaceBlocks", "Place Blocks"); - en.put("stageEditorUseBlocks", "Use Blocks"); - en.put("stageEditorCutBlocks", "Cut Blocks"); - en.put("stageEditorCatchFish", "Catch Fish"); - en.put("stageEditorFish", "fish"); - en.put("stageEditorKillPlayers", "Kill Players"); - en.put("stageEditorPlayers", "players"); - en.put("stageEditorEnchantItems", "Enchant Items"); - en.put("stageEditorDeliverItems", "Deliver Items"); - en.put("stageEditorTalkToNPCs", "Talk to NPCs"); - en.put("stageEditorKillNPCs", "Kill NPCs"); - en.put("stageEditorKillBosses", "Kill Bosses"); - en.put("stageEditorKillMobs", "Kill Mobs"); - en.put("stageEditorReachLocs", ""); - en.put("stageEditorReachRadii1", "Reach within"); - en.put("stageEditorReachRadii2", "blocks of"); - en.put("stageEditorTameMobs", "Tame Mobs"); - en.put("stageEditorShearSheep", "Shear Sheep"); - en.put("stageEditorDelayMessage", "Delay Message"); - en.put("stageEditorDenizenScript", "Denizen Script"); - en.put("stageEditorStartMessage", "Start Message"); - en.put("stageEditorCompleteMessage", "Complete Message"); - en.put("stageEditorDelete", "Delete Stage"); - - en.put("stageEditorSetBlockIds", "Set block IDs"); - en.put("stageEditorSetBlockAmounts", "Set block amounts"); - en.put("stageEditorNoBlockIds", "You must set Block IDs first!"); - en.put("stageEditorBreakBlocksCleared", "Break blocks objective cleared."); - en.put("stageEditorInvalidIdAmountList", "The block IDs list block amounts list are not the same size!"); - en.put("stageEditorEnterBlockIds", "Enter block IDs, separating each one by a space, or enter \'cancel\' to return."); - en.put("stageEditorContainsDuplicates", "List contains duplicates!"); - en.put("stageEditorInvalidBlockId", "is not a valid block ID!"); - en.put("stageEditorInvalidEntryInt", "Invalid entry, input was not a list of numbers!"); - - //prompts - + public void initPhrases(){ + + //English + //TODO: If finished, completely check everything. + //Quests + //Quest create menu + en.put("questEditorHeader", "Create Quest"); + en.put("questEditorCreate", "Create new Quest"); + en.put("questEditorEdit", "Edit a Quest"); + en.put("questEditorDelete", "Delete Quest"); + en.put("questEditorName", "Set name"); + + en.put("questEditorAskMessage", "Set ask message"); + en.put("questEditorFinishMessage", "Set finish message"); + en.put("questEditorRedoDelay", "Set redo delay"); + en.put("questEditorNPCStart", "Set NPC start"); + en.put("questEditorBlockStart", "Set Block start"); + en.put("questEditorInitialEvent", "Set initial Event"); + en.put("questEditorReqs", "Edit Requirements"); + en.put("questEditorStages", "Edit Stages"); + en.put("questEditorRews", "Edit Rewards"); + + en.put("questEditorEnterQuestName", "Enter Quest name (or \"cancel\" to return)"); + en.put("questEditorEnterAskMessage", "Enter ask message (or \"cancel\" to return)"); + en.put("questEditorEnterFinishMessage", "Enter finish message (or \"cancel\" to return)"); + en.put("questEditorEnterRedoDelay", "Enter amount of time (in milliseconds), 0 to clear the redo delay or -1 to cancel "); + en.put("questEditorEnterNPCStart", "Enter NPC ID, -1 to clear the NPC start or -2 to cancel"); + en.put("questEditorEnterBlockStart", "Right-click on a block to use as a start point, then enter \"done\" to save,\n" + + "or enter \"clear\" to clear the block start, or \"cancel\" to return"); + en.put("questEditorEnterInitialEvent", "Enter an Event name, or enter \"clear\" to clear the initial Event, or \"cancel\" to return"); + + //Quest create menu errors + en.put("questEditorNameExists", "A Quest with that name already exists!"); + en.put("questEditorBeingEdited", "Someone is creating/editing a Quest with that name!"); + en.put("questEditorInvalidQuestName", "Name may not contain commas!"); + en.put("questEditorInvalidEventName", "is not a valid event name!"); + en.put("questEditorInvalidNPC", "No NPC exists with that id!"); + en.put("questEditorNoStartBlockSelected", "You must select a block first."); + en.put("questEditorPositiveAmount", "Amount must be a positive number."); + en.put("questEditorQuestAsRequirement1", "The following Quests have"); + en.put("questEditorQuestAsRequirement2", "as a requirement:"); + en.put("questEditorQuestAsRequirement3", "You must modify these Quests so that they do not use it before deleting it."); + en.put("questEditorQuestNotFound", "Quest not found!"); + + en.put("questEditorEventCleared", "Initial Event cleared."); + en.put("questEditorSave", "Finish and save"); + + en.put("questEditorNeedAskMessage", "You must set an ask message!"); + en.put("questEditorNeedFinishMessage", "You must set a finish message!"); + en.put("questEditorNeedStages", "Your Quest has no Stages!"); + en.put("questEditorSaved", "Quest saved! (You will need to perform a Quest reload for it to appear)"); + en.put("questEditorExited", "Are you sure you want to exit without saving?"); + en.put("questEditorDeleted", "Are you sure you want to delete the Quest"); + + en.put("questEditorNoPermsCreate", "You do not have permission to create Quests."); + en.put("questEditorNoPermsEdit", "You do not have permission to edit Quests."); + en.put("questEditorNoPermsDelete", "You do not have permission to delete Quests."); + // + + //Stages + //Menu + en.put("stageEditorEditStage", "Edit Stage"); + en.put("stageEditorNewStage", "Add new Stage"); + //create prompt + en.put("stageEditorStages", "Stages"); + en.put("stageEditorStage", "Stage"); + en.put("stageEditorEditStage", "Edit Stage"); + en.put("stageEditorNewStage", "Add new Stage"); + en.put("stageEditorBreakBlocks", "Break Blocks"); + en.put("stageEditorDamageBlocks", "Damage Blocks"); + en.put("stageEditorPlaceBlocks", "Place Blocks"); + en.put("stageEditorUseBlocks", "Use Blocks"); + en.put("stageEditorCutBlocks", "Cut Blocks"); + en.put("stageEditorCatchFish", "Catch Fish"); + en.put("stageEditorFish", "fish"); + en.put("stageEditorKillPlayers", "Kill Players"); + en.put("stageEditorPlayers", "players"); + en.put("stageEditorEnchantItems", "Enchant Items"); + en.put("stageEditorDeliverItems", "Deliver Items"); + en.put("stageEditorTalkToNPCs", "Talk to NPCs"); + en.put("stageEditorKillNPCs", "Kill NPCs"); + en.put("stageEditorKillBosses", "Kill Bosses"); + en.put("stageEditorKillMobs", "Kill Mobs"); + en.put("stageEditorReachLocs", "Reach locations"); + en.put("stageEditorReachRadii1", "Reach within"); + en.put("stageEditorReachRadii2", "blocks of"); + en.put("stageEditorTameMobs", "Tame Mobs"); + en.put("stageEditorShearSheep", "Shear Sheep"); + en.put("stageEditorEvents", "Events"); + en.put("stageEditorDelayMessage", "Delay Message"); + en.put("stageEditorDenizenScript", "Denizen Script"); + en.put("stageEditorStartMessage", "Start Message"); + en.put("stageEditorCompleteMessage", "Complete Message"); + en.put("stageEditorMiniEventMessage", "Mini-Events"); + en.put("stageEditorDelete", "Delete Stage"); + + en.put("stageEditorDamageBlocks", "Damage Blocks"); + en.put("stageEditorPlaceBlocks", "Place Blocks"); + en.put("stageEditorSetBlockIds", "Set block IDs"); + en.put("stageEditorSetBlockAmounts", "Set block amounts"); + en.put("stageEditorSetDamageAmounts", "Set damage amounts"); + en.put("stageEditorSetPlaceAmounts", "Set place amounts"); + en.put("stageEditorSetUseAmounts", "Set use amounts"); + en.put("stageEditorSetCutAmounts", "Set cut amounts"); + en.put("stageEditorSetKillAmounts", "Set kill amounts"); + en.put("stageEditorSetEnchantAmounts", "Set enchant amounts"); + en.put("stageEditorSetMobAmounts", "Set mob amounts"); + en.put("stageEditorSetEnchantments", "Set enchantments"); + en.put("stageEditorSetItemIds", "Set item ids"); + en.put("stageEditorSetKillIds", "Set NPC IDs"); + en.put("stageEditorSetMobTypes", "Set mob types"); + en.put("stageEditorSetKillLocations", "Set kill locations"); + en.put("stageEditorSetKillLocationRadii", "Set kill location radii"); + en.put("stageEditorSetKillLocationNames", "Set kill location names"); + en.put("stageEditorSetLocations", "Set locations"); + en.put("stageEditorSetLocationRadii", "Set location radii"); + en.put("stageEditorSetLocationNames", "Set location names"); + en.put("stageEditorSetTameAmounts", "Set tame amounts"); + en.put("stageEditorSetShearColors", "Set sheep colors"); + en.put("stageEditorSetShearAmounts", "Set shear amounts"); + en.put("stageEditorSetBosses", "Set Bosses"); + en.put("stageEditorAddMiniEvent", "Add mini-event"); + + en.put("stageEditorEnterBlockIds", "Enter block IDs, separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorBreakBlocksPrompt", "Enter block amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorDamageBlocksPrompt", "Enter damage amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorPlaceBlocksPrompt", "Enter place amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorUseBlocksPrompt", "Enter use amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorCutBlocksPrompt", "Enter cut amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorCatchFishPrompt", "Enter number of fish to catch, or 0 to clear the fish catch objective, or -1 to cancel"); + en.put("stageEditorKillPlayerPrompt", "Enter number of players to kill, or 0 to clear the player kill objective, or -1 to cancel"); + en.put("stageEditorEnchantTypePrompt", "Enter enchantment names, separating each one by a \"comma\", or enter \'cancel\' to return."); + en.put("stageEditorEnchantAmountsPrompt", "Enter enchant amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorItemIDsPrompt", "Enter item IDs, separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorNPCPrompt", "Enter NPC ids, separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorNPCToTalkToPrompt", "Enter NPC IDs, separating each one by a space, or enter \'clear\' to clear the NPC ID list, or \'cancel\' to return."); + en.put("stageEditorDeliveryMessagesPrompt", "Enter delivery messages, separating each one by a \"semi-colon\" or enter \'cancel\' to return"); + en.put("stageEditorKillNPCsPrompt", "Enter kill amounts (numbers), separating each one by a space, or enter \'cancel\' to return."); + en.put("stageEditorMobsPrompt", "Enter mob names separating each one by a space, or enter \"cancel\" to return"); + en.put("stageEditorMobAmountsPrompt", "Enter mob amounts separating each one by a space, or enter \"cancel\" to return"); + en.put("stageEditorMobLocationPrompt", "Right-click on a block to select it, then enter \"add\" to add it to the kill location list, or enter \"cancel\" to return"); + en.put("stageEditorMobLocationRadiiPrompt", "Enter kill location radii (number of blocks) separating each one by a space, or enter \"cancel\" to return"); + en.put("stageEditorMobLocationNamesPrompt", "Enter location names separating each one by a \"comma\", or enter \"cancel\" to return"); + en.put("stageEditorReachLocationPrompt", "Right-click on a block to select it, then enter \"add\" to add it to the reach location list, or enter \"cancel\" to return"); + en.put("stageEditorReachLocationRadiiPrompt", "Enter reach location radii (number of blocks) separating each one by a space, or enter \"cancel\" to return"); + en.put("stageEditorReachLocationNamesPrompt", "Enter location names separating each one by a \"comma\", or enter \"cancel\" to return"); + en.put("stageEditorTameAmountsPrompt", "Enter tame amounts separating each one by a space, or enter \"cancel\" to return"); + en.put("stageEditorShearColorsPrompt", "Enter sheep colors separating each one by a space, or enter \"cancel\" to return"); + en.put("stageEditorShearAmountsPrompt", "Enter shear amounts separating each one by a space, or enter \"cancel\" to return"); + en.put("stageEditorEventsPrompt", "Enter an event name, or enter \"clear\" to clear the event, or \"cancel\" to return"); + en.put("stageEditorDelayPrompt", "Enter time (in milliseconds), or enter \"clear\" to clear the delay, or \"cancel\" to return"); + en.put("stageEditorDelayMessagePrompt", "Enter delay message, or enter \"clear\" to clear the message, or \"cancel\" to return"); + en.put("stageEditorScriptPrompt", "Enter script name, or enter \"clear\" to clear the script, or \"cancel\" to return"); + en.put("stageEditorBossNamePrompt", "Enter Boss names, separating each one by a space, or \"cancel\" to return."); + en.put("stageEditorBossAmountPrompt", "Enter kill amounts (numbers), separating each one by a space, or \"cancel\" to return."); + en.put("stageEditorStartMessagePrompt", "Enter start message, or enter \"clear\" to clear the message, or \"cancel\" to return"); + en.put("stageEditorCompleteMessagePrompt", "Enter complete message, or enter \"clear\" to clear the message, or \"cancel\" to return"); + + en.put("stageEditorDeliveryAddItem", "Add item"); + en.put("stageEditorDeliveryNPCs", "Set NPC IDs"); + en.put("stageEditorDeliveryMessages", "Set delivery messages"); + + en.put("stageEditorContainsDuplicates", "List contains duplicates!"); + en.put("stageEditorInvalidBlockID", "is not a valid block ID!"); + en.put("stageEditorInvalidEnchantment", "is not a valid enchantment name!"); + en.put("stageEditorInvalidNPC", "is not a valid NPC ID!"); + en.put("stageEditorInvalidMob", "is not a valid mob name!"); + en.put("stageEditorInvalidItemID", "is not a valid item ID!"); + en.put("stageEditorInvalidNumber", "is not a number!"); + en.put("stageEditorInvalidDye", "is not a valid dye color!"); + en.put("stageEditorInvalidEvent", "is not a valid event name!"); + en.put("stageEditorInvalidDelay", "Delay must be at least one second!"); + en.put("stageEditorInvalidScript", "Denizen script not found!"); + en.put("stageEditorInvalidBoss", "Could not find Boss with the name:"); + + en.put("stageEditorNoCitizens", "Citizens is not installed!"); + en.put("stageEditorNoEpicBoss", "EpicBoss is not installed!"); + en.put("stageEditorNoDenizen", "Denizen is not installed!"); + + en.put("stageEditorPositiveAmount", "You must enter a positive number!"); + en.put("stageEditorNoNumber", "Input was not a number!"); + en.put("stageEditorNotGreaterThanZero", "is not greater than 0!"); + en.put("stageEditorNotListofNumbers", "Invalid entry, input was not a list of numbers!"); + en.put("stageEditorNoDelaySet", "You must set a delay first!"); + en.put("stageEditorNoBlockIds", "You must set Block IDs first!"); + en.put("stageEditorNoEnchantments", "You must set enchantments first!"); + en.put("stageEditorNoItems", "You must add items first!"); + en.put("stageEditorNoDeliveryMessage", "You must set at least one delivery message!"); + en.put("stageEditorNoNPCs", "You must set NPC IDs first!"); + en.put("stageEditorNoMobTypes", "You must set mob types first!"); + en.put("stageEditorNoKillLocations", "You must set kill locations first!"); + en.put("stageEditorNoBlockSelected", "You must select a block first."); + en.put("stageEditorNoColors", "You must set colors first!"); + + en.put("stageEditorNoEnchantmentsSet", "No enchantments set"); + en.put("stageEditorNoItemsSet", "No items set"); + en.put("stageEditorNoMobTypesSet", "No mob types set"); + en.put("stageEditorNoLocationsSet", "No locations set"); + en.put("stageEditorNoColorsSet", "No colors set"); + + en.put("stageEditorListNotSameSize", "The block IDs list and the amounts list are not the same size!"); + en.put("stageEditorEnchantmentNotSameSize", "The enchantments list, the item id list and the enchant amount list are not the same size!"); + en.put("stageEditorDeliveriesNotSameSize", "The item list and the NPC list are not equal in size!"); + en.put("stageEditorNPCKillsNotSameSize", "The NPC IDs list and the kill amounts list are not the same size!"); + en.put("stageEditorAllListsNotSameSize", "All of your lists are not the same size!"); + en.put("stageEditorMobTypesNotSameSize", "The mob types list and the mob amounts list are not the same size!"); + en.put("stageEditorTameMobsNotSameSize", "The mob types list and the tame amounts list are not the same size!"); + en.put("stageEditorShearNotSameSize", "The sheep colors list and the shear amounts list are not the same size!"); + en.put("stageEditorBossesNotSameSize", "The Boss IDs list and the Boss amounts list are not the same size!"); + + en.put("stageEditorListContainsDuplicates", " List contains duplicates!"); + + en.put("stageEditorBreakBlocksCleared", "Break blocks objective cleared."); + en.put("stageEditorDamageBlocksCleared", "Damage blocks objective cleared."); + en.put("stageEditorPlaceBlocksCleared", "Place blocks objective cleared."); + en.put("stageEditorUseBlocksCleared", "Use blocks objective cleared."); + en.put("stageEditorCutBlocksCleared", "Cut blocks objective cleared."); + en.put("stageEditorEnchantmentsCleared", "Enchantment objective cleared."); + en.put("stageEditorDeliveriesCleared", "Delivery objective cleared."); + en.put("stageEditorKillNPCsCleared", "Kill NPCs objective cleared."); + en.put("stageEditorKillMobsCleared", "Kill Mobs objective cleared."); + en.put("stageEditorTameCleared", "Tame Mobs objective cleared."); + en.put("stageEditorShearCleared", "Shear Sheep objective cleared."); + en.put("stageEditorBossesCleared", "Kill Bosses objective cleared."); + en.put("stageEditorStartMessageCleared", "Start message cleared."); + en.put("stageEditorCompleteMessageCleared", "Complete message cleared."); + + en.put("stageEditorConfirmStageDelete", "Are you sure you want to delete this stage?"); + en.put("stageEditorConfirmStageNote", "Any Stages after will be shifted back one spot"); + en.put("stageEditorDeleteSucces", "Stage deleted successfully."); + + en.put("stageEditorEnchantments", "Enchantments"); + en.put("stageEditorNPCNote", "Note: You may specify the name of the NPC with "); + en.put("stageEditorOptional", "Optional"); + en.put("stageEditorColors", "Sheep Colors"); + en.put("stageEditorBosses", "Bosses"); + + + //Events + en.put("eventEditorTitle", "Event Editor"); + en.put("eventEditorCreate", "Create new Event"); + en.put("eventEditorEdit", "Edit an Event"); + en.put("eventEditorDelete", "Delete an Event"); + + en.put("eventEditorNoneToEdit", "No Events currently exist to be edited!"); + en.put("eventEditorNoneToDelete", "No Events currently exist to be deleted!"); + en.put("eventEditorNotFound", "Event not found!"); + en.put("eventEditorExists", "Event already exists!"); + en.put("eventEditorSomeone", "Someone is already creating or editing an Event with that name!"); + en.put("eventEditorAlpha", "Name must be alphanumeric!"); + + en.put("eventEditorErrorReadingFile", "Error reading Events file."); + en.put("eventEditorErrorSaving", "An error occurred while saving."); + en.put("eventEditorDeleted", "Event deleted, Quests and Events reloaded."); + en.put("eventEditorSaved", "Event saved, Quests and Events reloaded."); + + en.put("eventEditorEnterEventName", "Enter an Event name, or \"cancel\" to return."); + en.put("eventEditorDeletePrompt", "Are you sure you want to delete the Event"); + en.put("eventEditorQuitWithoutSaving", "Are you sure you want to quit without saving?"); + en.put("eventEditorFinishAndSave", "Are you sure you want to finish and save the Event"); + en.put("eventEditorModifiedNote", "Note: You have modified an Event that the following Quests use:"); + en.put("eventEditorForcedToQuit", "If you save the Event, anyone who is actively doing any of these Quests will be forced to quit them."); + + en.put("eventEditorEventInUse", "The following Quests use the Event"); + en.put("eventEditorMustModifyQuests", "eventEditorNotFound"); + en.put("eventEditorListSizeMismatch", "The lists are not the same size!"); + en.put("eventEditorListDuplicates", "List contains duplicates!"); + en.put("eventEditorNotANumberList", "Input was not a list of numbers!"); + en.put("eventEditorInvalidEntry", "Invalid entry"); + + en.put("eventEditorSetName", "Set name"); + en.put("eventEditorSetMessage", "Set message"); + + en.put("eventEditorClearInv", "Clear player inventory"); + en.put("eventEditorSetExplosions", "Set explosion locations"); + en.put("eventEditorSetLightning", "Set lightning strike locations"); + en.put("eventEditorSetEffects", "Set effects"); + en.put("eventEditorSetStorm", "Set storm"); + en.put("eventEditorSetThunder", "Set thunder"); + en.put("eventEditorSetMobSpawns", "Set mob spawns"); + en.put("eventEditorSetPotionEffects", "Set potion effects"); + en.put("eventEditorSetHunger", "Set player hunger level"); + en.put("eventEditorSetSaturation", "Set player saturation level"); + en.put("eventEditorSetHealth", "Set player health level"); + en.put("eventEditorSetTeleport", "Set player teleport location"); + en.put("eventEditorSetCommands", "Set commands to execute"); + + en.put("eventEditorItems", "Event Items"); + en.put("eventEditorSetItems", "Give items"); + en.put("eventEditorItemsCleared", "Event items cleared."); + en.put("eventEditorSetItemIDs", "Set item IDs"); + en.put("eventEditorSetItemAmounts", "Set item amounts"); + en.put("eventEditorNoIDs", "No IDs set"); + en.put("eventEditorMustSetIDs", "You must set item IDs first!"); + en.put("eventEditorInvalidID", "___ is not a valid item ID!"); + en.put("eventEditorNotGreaterThanZero", "___ is not greater than 0!"); + en.put("eventEditorNotANumber", "___ is not a number!"); + + en.put("eventEditorStorm", "Event Storm"); + en.put("eventEditorSetWorld", "Set world"); + en.put("eventEditorSetDuration", "Set duration"); + en.put("eventEditorNoWorld", "(No world set)"); + en.put("eventEditorSetWorldFirst", "You must set a world first!"); + en.put("eventEditorInvalidWorld", "___ is not a valid world name!"); + en.put("eventEditorMustSetStormDuration", "You must set a storm duration!"); + en.put("eventEditorStormCleared", "Storm data cleared."); + en.put("eventEditorEnterStormWorld", "Enter a world name for the storm to occur in, or enter \"cancel\" to return"); + en.put("eventEditorEnterDuration", "Enter duration (in milliseconds)"); + en.put("eventEditorAtLeastOneSecond", "Amount must be at least 1 second! (1000 milliseconds)"); + en.put("eventEditorNotGreaterThanOneSecond", "___ is not greater than 1 second! (1000 milliseconds)"); + + en.put("eventEditorThunder", "Event Thunder"); + en.put("eventEditorInvalidWorld", "___ is not a valid world name!"); + en.put("eventEditorMustSetThunderDuration", "You must set a thunder duration!"); + en.put("eventEditorThunderCleared", "Thunder data cleared."); + en.put("eventEditorEnterThunderWorld", "Enter a world name for the thunder to occur in, or enter \"cancel\" to return"); + + en.put("eventEditorEffects", "Event Effects"); + en.put("eventEditorAddEffect", "Add effect"); + en.put("eventEditorAddEffectLocation", "Add effect location"); + en.put("eventEditorNoEffects", "No effects set"); + en.put("eventEditorMustAddEffects", "You must add effects first!"); + en.put("eventEditorInvalidEffect", "___ is not a valid effect name!"); + en.put("eventEditorEffectsCleared", "Event effects cleared."); + en.put("eventEditorEffectLocationPrompt", "Right-click on a block to play an effect at, then enter \"add\" to add it to the list, or enter \"cancel\" to return"); + + en.put("eventEditorMobSpawns", "Event Mob Spawns"); + en.put("eventEditorAddMobTypes", "Add mob"); + en.put("eventEditorNoTypesSet", "(No type set)"); + en.put("eventEditorMustSetMobTypesFirst", "You must set the mob type first!"); + en.put("eventEditorSetMobAmounts", "Set mob amount"); + en.put("eventEditorNoAmountsSet", "(No amounts set)"); + en.put("eventEditorMustSetMobAmountsFirst", "You must set mob amount first!"); + en.put("eventEditorAddSpawnLocation", "Set spawn location"); + en.put("eventEditorMobSpawnsCleared", "Mob spawns cleared."); + en.put("eventEditorMustSetMobLocationFirst", "You must set a spawn-location first!"); + en.put("eventEditorInvalidMob", "___ is not a valid mob name!"); + en.put("eventEditorSetMobName", "Set custom name for mob"); + en.put("eventEditorSetMobType", "Set mob type"); + en.put("eventEditorSetMobItemInHand", "Set item in hand"); + en.put("eventEditorSetMobItemInHandDrop", "Set drop chance of item in hand"); + en.put("eventEditorSetMobBoots", "Set boots"); + en.put("eventEditorSetMobBootsDrop", "Set drop chance of boots"); + en.put("eventEditorSetMobLeggings", "Set leggings"); + en.put("eventEditorSetMobLeggingsDrop", "Set drop chance of leggings"); + en.put("eventEditorSetMobChestPlate", "Set chest plate"); + en.put("eventEditorSetMobChestPlateDrop", "Set drop chance of chest plate"); + en.put("eventEditorSetMobHelmet", "Set helmet"); + en.put("eventEditorSetMobHelmetDrop", "Set drop chance of helmet"); + en.put("eventEditorSetMobSpawnLoc", "Right-click on a block to spawn a mob at, then enter \"add\" to the confirm it, or enter \"cancel\" to return"); + en.put("eventEditorSetMobSpawnAmount", "Set the amount of mobs to spawn"); + en.put("eventEditorSetDropChance", "Set the drop chance"); + en.put("eventEditorInvalidDropChance", "Drop chance has to be between 0.0 and 1.0"); + + en.put("eventEditorLightningPrompt", "Right-click on a block to spawn a lightning strike at, then enter \"add\" to add it to the list, or enter \"clear\" to clear the locations list, or \"cancel\" to return"); + + en.put("eventEditorPotionEffects", "Event Potion Effects"); + en.put("eventEditorSetPotionEffects", "Set potion effect types"); + en.put("eventEditorMustSetPotionTypesFirst", "You must set potion effect types first!"); + en.put("eventEditorSetPotionDurations", "Set potion effect durations"); + en.put("eventEditorMustSetPotionDurationsFirst", "You must set potion effect durations first!"); + en.put("eventEditorMustSetPotionTypesAndDurationsFirst", "You must set potion effect types and durations first!"); + en.put("eventEditorNoDurationsSet", "(No durations set)"); + en.put("eventEditorSetPotionMagnitudes", "Set potion effect magnitudes"); + en.put("eventEditorPotionsCleared", "Potion effects cleared."); + en.put("eventEditorInvalidPotionType", "___ is not a valid potion effect type!"); + + en.put("eventEditorEnterNPCId", "Enter NPC ID (or -1 to return)"); + en.put("eventEditorNoNPCExists", "No NPC exists with that id!"); + en.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"); + en.put("eventEditorSelectBlockFirst", "You must select a block first."); + en.put("eventEditorSetMessagePrompt", "Enter message, or enter \'none\' to delete, (or \'cancel\' to return)"); + en.put("eventEditorSetItemIDsPrompt", "Enter item IDs separating each one by a space, or enter \"cancel\" to return."); + en.put("eventEditorSetItemAmountsPrompt", "Enter item amounts (numbers) separating each one by a space, or enter \"cancel\" to return."); + en.put("eventEditorSetMobTypesPrompt", "Enter mob name, or enter \"cancel\" to return"); + en.put("eventEditorSetMobAmountsPrompt", "Enter mob amount, or enter \"cancel\" to return"); + en.put("eventEditorSetMobNamePrompt", "Set the name for this mob, or enter \"cancel\" to return"); + en.put("eventEditorSetMobLocationPrompt", "Right-click on a block to select it, then enter \"add\" to add it to the mob spawn location list, or enter \"cancel\" to return"); + en.put("eventEditorSetPotionEffectsPrompt", "Enter potion effect types separating each one by a space, or enter \"cancel\" to return"); + en.put("eventEditorSetPotionDurationsPrompt", "Enter effect durations (in milliseconds) separating each one by a space, or enter \"cancel\" to return"); + en.put("eventEditorSetPotionMagnitudesPrompt", "Enter potion effect magnitudes separating each one by a space, or enter \"cancel\" to return"); + en.put("eventEditorSetHungerPrompt", "Enter hunger level, or -1 to remove it"); + en.put("eventEditorHungerLevelAtLeastZero", "Hunger level must be at least 0!"); + en.put("eventEditorSetSaturationPrompt", "Enter saturation level, or -1 to remove it"); + en.put("eventEditorSaturationLevelAtLeastZero", "Saturation level must be at least 0!"); + en.put("eventEditorSetHealthPrompt", "Enter health level, or -1 to remove it"); + en.put("eventEditorHealthLevelAtLeastZero", "Health level must be at least 0!"); + en.put("eventEditorSetTeleportPrompt", "Right-click on a block to teleport the player to, then enter \"done\" to finish,\nor enter \"clear\" to clear the teleport location, or \"cancel\" to return"); + en.put("eventEditorCommandsNote", "Note: You may use to refer to the player's name."); + en.put("eventEditorSetCommandsPrompt", "Enter commands separating each one by a comma, or enter \"clear\" to clear the list, or enter \"cancel\" to return."); + en.put("eventEditorSet", ""); + //en.put("eventEditorSet", ""); + //en.put("eventEditorSet", ""); - //Events - en.put("eventEditorTitle", "Event Editor"); - en.put("eventEditorCreate", "Create new Event"); - en.put("eventEditorEdit", "Edit an Event"); - en.put("eventEditorDelete", "Delete an Event"); + // - en.put("eventEditorNoneToEdit", "No Events currently exist to be edited!"); - en.put("eventEditorNoneToDelete", "No Events currently exist to be deleted!"); - en.put("eventEditorNotFound", "Event not found!"); - en.put("eventEditorExists", "Event already exists!"); - en.put("eventEditorSomeone", "Someone is already creating or editing an Event with that name!"); - en.put("eventEditorAlpha", "Name must be alphanumeric!"); + //Effects + en.put("effBlazeShoot", "Sound of a Blaze firing"); + en.put("effBowFire", "Sound of a bow firing"); + en.put("effClick1", "A click sound"); + en.put("effClick2", "A different click sound"); + en.put("effDoorToggle", "Sound of a door opening or closing"); + en.put("effExtinguish", "Sound of fire being extinguished"); + en.put("effGhastShoot", "Sound of a Ghast firing"); + en.put("effGhastShriek", "Sound of a Ghast shrieking"); + en.put("effZombieWood", "Sound of a Zombie chewing an iron door"); + en.put("effZombieIron", "Sound of a Zombie chewing a wooden door"); + en.put("effEnterName", "Enter an effect name to add it to the list, or enter \"cancel\" to return"); - en.put("eventEditorErrorReadingFile", "Error reading Events file."); - en.put("eventEditorErrorSaving", "An error occurred while saving."); - en.put("eventEditorDeleted", "Event deleted, Quests and Events reloaded."); - en.put("eventEditorSaved", "Event saved, Quests and Events reloaded."); + // - en.put("eventEditorEnterEventName", "Enter an Event name, or \"cancel\" to return."); - en.put("eventEditorDeletePrompt", "Are you sure you want to delete the Event"); - en.put("eventEditorQuitWithoutSaving", "Are you sure you want to quit without saving?"); - en.put("eventEditorFinishAndSave", "Are you sure you want to finish and save the Event"); - en.put("eventEditorModifiedNote", "Note: You have modified an Event that the following Quests use:"); - en.put("eventEditorForcedToQuit", "If you save the Event, anyone who is actively doing any of these Quests will be forced to quit them."); + //Inputs + en.put("cmdCancel", "cancel"); + en.put("cmdAdd", "add"); + en.put("cmdClear", "clear"); + en.put("cmdNone", "none"); + en.put("cmdDone", "done"); + // - en.put("eventEditorEventInUse", "The following Quests use the Event"); - en.put("eventEditorMustModifyQuests", "eventEditorNotFound"); - en.put("eventEditorListSizeMismatch", "The lists are not the same size!"); - en.put("eventEditorListDuplicates", "List contains duplicates!"); - en.put("eventEditorNotANumberList", "Input was not a list of numbers!"); - en.put("eventEditorInvalidEntry", "Invalid entry"); + //Misc + en.put("event", "Event"); + en.put("delay", "Delay"); + en.put("save", "Save"); + en.put("exit", "Exit"); + en.put("exited", "Exited"); + en.put("cancel", "Cancel"); + en.put("yes", "Yes"); + en.put("no", "No"); + en.put("clear", "Clear"); + en.put("none", "None"); + en.put("done", "Done"); + en.put("quit", "Quit"); + en.put("noneSet", "None set"); + en.put("noDelaySet", "No delay set"); + en.put("noIdsSet", "No IDs set"); + en.put("worlds", "Worlds"); + en.put("mobs", "Mobs"); + en.put("invalidOption", "Invalid option!"); + // + // - en.put("eventEditorSetName", "Set name"); - en.put("eventEditorSetMessage", "Set message"); + File file = new File(plugin.getDataFolder(), "/lang/" + lang + ".yml"); + YamlConfiguration langFile = YamlConfiguration.loadConfiguration(file); + for (Entry e : langFile.getValues(true).entrySet()) { + en.put(e.getKey(), (String) e.getValue()); + } + } - en.put("eventEditorClearInv", "Clear player inventory"); - en.put("eventEditorSetExplosions", "Set explosion locations"); - en.put("eventEditorSetLightning", "Set lightning strike locations"); - en.put("eventEditorSetEffects", "Set effects"); - en.put("eventEditorSetStorm", "Set storm"); - en.put("eventEditorSetThunder", "Set thunder"); - en.put("eventEditorSetMobSpawns", "Set mob spawns"); - en.put("eventEditorSetPotionEffects", "Set potion effects"); - en.put("eventEditorSetHunger", "Set player hunger level"); - en.put("eventEditorSetSaturation", "Set player saturation level"); - en.put("eventEditorSetHealth", "Set player health level"); - en.put("eventEditorSetTeleport", "Set player teleport location"); - en.put("eventEditorSetCommands", "Set commands to execute"); + public void save() { + File file = new File(plugin.getDataFolder(), "/lang/" + lang + ".yml"); + YamlConfiguration langFile = YamlConfiguration.loadConfiguration(file); - en.put("eventEditorItems", "Event Items"); - en.put("eventEditorSetItems", "Give items"); - en.put("eventEditorItemsCleared", "Event items cleared."); - en.put("eventEditorSetItemIDs", "Set item IDs"); - en.put("eventEditorSetItemAmounts", "Set item amounts"); - en.put("eventEditorNoIDs", "No IDs set"); - en.put("eventEditorMustSetIDs", "You must set item IDs first!"); - en.put("eventEditorInvalidID", "___ is not a valid item ID!"); - en.put("eventEditorNotGreaterThanZero", "___ is not greater than 0!"); - en.put("eventEditorNotANumber", "___ is not a number!"); + for (Entry e : en.entrySet()) { + langFile.set(e.getKey(), e.getValue()); + } - en.put("eventEditorStorm", "Event Storm"); - en.put("eventEditorSetWorld", "Set world"); - en.put("eventEditorSetDuration", "Set duration"); - en.put("eventEditorNoWorld", "(No world set)"); - en.put("eventEditorSetWorldFirst", "You must set a world first!"); - en.put("eventEditorInvalidWorld", "___ is not a valid world name!"); - en.put("eventEditorMustSetStormDuration", "You must set a storm duration!"); - en.put("eventEditorStormCleared", "Storm data cleared."); - en.put("eventEditorEnterStormWorld", "Enter a world name for the storm to occur in, or enter \"cancel\" to return"); - en.put("eventEditorEnterDuration", "Enter duration (in milliseconds)"); - en.put("eventEditorAtLeastOneSecond", "Amount must be at least 1 second! (1000 milliseconds)"); - en.put("eventEditorNotGreaterThanOneSecond", "___ is not greater than 1 second! (1000 milliseconds)"); - - en.put("eventEditorThunder", "Event Thunder"); - en.put("eventEditorInvalidWorld", "___ is not a valid world name!"); - en.put("eventEditorMustSetThunderDuration", "You must set a thunder duration!"); - en.put("eventEditorThunderCleared", "Thunder data cleared."); - en.put("eventEditorEnterThunderWorld", "Enter a world name for the thunder to occur in, or enter \"cancel\" to return"); - - en.put("eventEditorEffects", "Event Effects"); - en.put("eventEditorAddEffect", "Add effect"); - en.put("eventEditorAddEffectLocation", "Add effect location"); - en.put("eventEditorNoEffects", "No effects set"); - en.put("eventEditorMustAddEffects", "You must add effects first!"); - en.put("eventEditorInvalidEffect", "___ is not a valid effect name!"); - en.put("eventEditorEffectsCleared", "Event effects cleared."); - en.put("eventEditorEffectLocationPrompt", "Right-click on a block to play an effect at, then enter \"add\" to add it to the list, or enter \"cancel\" to return"); - - en.put("eventEditorMobSpawns", "Event Mob Spawns"); - en.put("eventEditorSetMobTypes", "Set mob types"); - en.put("eventEditorNoTypesSet", "(No types set)"); - en.put("eventEditorMustSetMobTypesFirst", "You must set mob types first!"); - en.put("eventEditorSetMobAmounts", "Set mob amounts"); - en.put("eventEditorNoAmountsSet", "(No amounts set)"); - en.put("eventEditorMustSetMobAmountsFirst", "You must set mob amounts first!"); - en.put("eventEditorMustSetMobTypesAndAmountsFirst", "You must set mob types and amounts first!"); - en.put("eventEditorAddSpawnLocation", "Add spawn location"); - en.put("eventEditorMobSpawnsCleared", "Mob spawns cleared."); - en.put("eventEditorInvalidMob", "___ is not a valid mob name!"); - - en.put("eventEditorLightningPrompt", "Right-click on a block to spawn a lightning strike at, then enter \"add\" to add it to the list, or enter \"clear\" to clear the locations list, or \"cancel\" to return"); - - en.put("eventEditorPotionEffects", "Event Potion Effects"); - en.put("eventEditorSetPotionEffects", "Set potion effect types"); - en.put("eventEditorMustSetPotionTypesFirst", "You must set potion effect types first!"); - en.put("eventEditorSetPotionDurations", "Set potion effect durations"); - en.put("eventEditorMustSetPotionDurationsFirst", "You must set potion effect durations first!"); - en.put("eventEditorMustSetPotionTypesAndDurationsFirst", "You must set potion effect types and durations first!"); - en.put("eventEditorNoDurationsSet", "(No durations set)"); - en.put("eventEditorSetPotionMagnitudes", "Set potion effect magnitudes"); - en.put("eventEditorPotionsCleared", "Potion effects cleared."); - en.put("eventEditorInvalidPotionType", "___ is not a valid potion effect type!"); - - en.put("eventEditorEnterNPCId", "Enter NPC ID (or -1 to return)"); - en.put("eventEditorNoNPCExists", "No NPC exists with that id!"); - en.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"); - en.put("eventEditorSelectBlockFirst", "You must select a block first."); - en.put("eventEditorSetMessagePrompt", "Enter message, or enter \'none\' to delete, (or \'cancel\' to return)"); - en.put("eventEditorSetItemIDsPrompt", "Enter item IDs separating each one by a space, or enter \"cancel\" to return."); - en.put("eventEditorSetItemAmountsPrompt", "Enter item amounts (numbers) separating each one by a space, or enter \"cancel\" to return."); - en.put("eventEditorSetMobTypesPrompt", "Enter mob names separating each one by a space, or enter \"cancel\" to return"); - en.put("eventEditorSetMobAmountsPrompt", "Enter mob amounts separating each one by a space, or enter \"cancel\" to return"); - en.put("eventEditorMobLocationPrompt", "Right-click on a block to select it, then enter \"add\" to add it to the mob spawn location list, or enter \"cancel\" to return"); - en.put("eventEditorSetPotionEffectsPrompt", "Enter potion effect types separating each one by a space, or enter \"cancel\" to return"); - en.put("eventEditorSetPotionDurationsPrompt", "Enter effect durations (in milliseconds) separating each one by a space, or enter \"cancel\" to return"); - en.put("eventEditorSetPotionMagnitudesPrompt", "Enter potion effect magnitudes separating each one by a space, or enter \"cancel\" to return"); - en.put("eventEditorSetHungerPrompt", "Enter hunger level, or -1 to remove it"); - en.put("eventEditorHungerLevelAtLeastZero", "Hunger level must be at least 0!"); - en.put("eventEditorSetSaturationPrompt", "Enter saturation level, or -1 to remove it"); - en.put("eventEditorSaturationLevelAtLeastZero", "Saturation level must be at least 0!"); - en.put("eventEditorSetHealthPrompt", "Enter health level, or -1 to remove it"); - en.put("eventEditorHealthLevelAtLeastZero", "Health level must be at least 0!"); - en.put("eventEditorSetTeleportPrompt", "Right-click on a block to teleport the player to, then enter \"done\" to finish,\nor enter \"clear\" to clear the teleport location, or \"cancel\" to return"); - en.put("eventEditorCommandsNote", "Note: You may use to refer to the player's name."); - en.put("eventEditorSetCommandsPrompt", "Enter commands separating each one by a comma, or enter \"clear\" to clear the list, or enter \"cancel\" to return."); - en.put("eventEditorSet", ""); - //en.put("eventEditorSet", ""); - //en.put("eventEditorSet", ""); - - - // - - //Effects - en.put("effBlazeShoot", "Sound of a Blaze firing"); - en.put("effBowFire", "Sound of a bow firing"); - en.put("effClick1", "A click sound"); - en.put("effClick2", "A different click sound"); - en.put("effDoorToggle", "Sound of a door opening or closing"); - en.put("effExtinguish", "Sound of fire being extinguished"); - en.put("effGhastShoot", "Sound of a Ghast firing"); - en.put("effGhastShriek", "Sound of a Ghast shrieking"); - en.put("effZombieWood", "Sound of a Zombie chewing an iron door"); - en.put("effZombieIron", "Sound of a Zombie chewing a wooden door"); - en.put("effEnterName", "Enter an effect name to add it to the list, or enter \"cancel\" to return"); - - // - - //Inputs - en.put("cmdCancel", "cancel"); - en.put("cmdAdd", "add"); - en.put("cmdClear", "clear"); - en.put("cmdNone", "none"); - en.put("cmdDone", "done"); - // - - //Misc - en.put("event", "Event"); - en.put("delay", "Delay"); - en.put("save", "Save"); - en.put("exit", "Exit"); - en.put("exited", "Exited."); - en.put("yes", "Yes"); - en.put("no", "No"); - en.put("clear", "Clear"); - en.put("done", "Done"); - en.put("quit", "Quit"); - en.put("noneSet", "None set"); - en.put("noDelaySet", "No delay set"); - en.put("noIdsSet", "No IDs set"); - en.put("worlds", "Worlds"); - en.put("mobs", "Mobs"); - en.put("invalidOption", "Invalid option!"); - // - // - - File file = new File(plugin.getDataFolder(), "/lang/" + lang + ".yml"); - YamlConfiguration langFile = YamlConfiguration.loadConfiguration(file); - - for (Entry e : langFile.getValues(true).entrySet()) { - en.put(e.getKey(), (String) e.getValue()); - } - - } - - public void save() { - File file = new File(plugin.getDataFolder(), "/lang/" + lang + ".yml"); - YamlConfiguration langFile = YamlConfiguration.loadConfiguration(file); - - for (Entry e : en.entrySet()) { - langFile.set(e.getKey(), e.getValue()); - } - - try { + try { langFile.save(file); } catch (IOException e1) { e1.printStackTrace(); } - } + } } diff --git a/src/main/java/me/blackvein/quests/util/QuestMob.java b/src/main/java/me/blackvein/quests/util/QuestMob.java new file mode 100644 index 000000000..cf7129acf --- /dev/null +++ b/src/main/java/me/blackvein/quests/util/QuestMob.java @@ -0,0 +1,242 @@ +package me.blackvein.quests.util; + +import me.blackvein.quests.Quests; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.inventory.EntityEquipment; +import org.bukkit.inventory.ItemStack; + +public class QuestMob { + + private String name = null; + private EntityType entityType = null; + private Location spawnLocation = null; + private Integer spawnAmounts = null; + public ItemStack[] inventory = new ItemStack[5]; + public Float[] dropChances = new Float[5]; + + public QuestMob (EntityType entityType, Location spawnLocation, int spawnAmounts) { + this.entityType = entityType; + this.spawnLocation = spawnLocation; + this.spawnAmounts = spawnAmounts; + } + + public QuestMob() { + + } + + public void setSpawnLocation(Location spawnLocation) { + this.spawnLocation = spawnLocation; + } + + public Location getSpawnLocation() { + return spawnLocation; + } + + public void setType(EntityType entityType) { + this.entityType = entityType; + } + + public EntityType getType() { + return entityType; + } + + public void setSpawnAmounts(int spawnAmounts) { + this.spawnAmounts = spawnAmounts; + } + + public Integer getSpawnAmounts() { + return spawnAmounts; + } + + + public void setName(String name) { + this.name = name; + } + + + public String getName() { + return name; + } + + public void setHelmet(ItemStack helmet, float dropChance) { + inventory[4] = helmet; + dropChances[4] = dropChance; + } + + public void setChest(ItemStack chest, float dropChance) { + inventory[3] = chest; + dropChances[3] = dropChance; + } + + public void setLeggings(ItemStack leggings, float dropChance) { + inventory[2] = leggings; + dropChances[2] = dropChance; + } + + public void setBoots(ItemStack boots, float dropChance) { + inventory[1] = boots; + dropChances[1] = dropChance; + } + + public void setHeldItem(ItemStack heldItem, float dropChance) { + inventory[0] = heldItem; + dropChances[0] = dropChance; + } + + + public void spawn() { + System.out.println("Spawned!"); + World world = spawnLocation.getWorld(); + + for (int i = 0; i < spawnAmounts; i++) { + + Entity entity = world.spawnEntity(spawnLocation, entityType); + + if (name != null) { + ((LivingEntity) entity).setCustomName(name); + ((LivingEntity) entity).setCustomNameVisible(true); + } + + for (int j = 0; j < 5; j++) { + if (inventory[j] != null) + ((CraftEntity) entity).getHandle().setEquipment(j, CraftItemStack.asNMSCopy(inventory[j])); + } + + EntityEquipment eq = ((CraftLivingEntity) entity).getEquipment(); + + if (dropChances[0] != null) eq.setItemInHandDropChance(dropChances[0]); + if (dropChances[1] != null) eq.setBootsDropChance(dropChances[1]); + if (dropChances[2] != null) eq.setLeggingsDropChance(dropChances[2]); + if (dropChances[3] != null) eq.setChestplateDropChance(dropChances[3]); + if (dropChances[4] != null) eq.setHelmetDropChance(dropChances[4]); + + } + } + + public String serialize() { + String string = ""; + string += "type-" + entityType.getName(); + if (name != null) string += "::name-" + name; + if (spawnLocation != null) string += "::spawn-" + Quests.getLocationInfo(spawnLocation); + if (spawnAmounts != null) string += "::amounts-" + spawnAmounts; + + if (inventory[0] != null) { + string += "::hand-" + ItemUtil.serialize(inventory[0]); + string += "::hand_drop-" + dropChances[0]; + } + + if (inventory[1] != null) { + string += "::boots-" + ItemUtil.serialize(inventory[1]); + string += "::boots_drop-" + dropChances[1]; + } + + if (inventory[2] != null) { + string += "::leggings-" + ItemUtil.serialize(inventory[2]); + string += "::leggings_drop-" + dropChances[2]; + } + + if (inventory[3] != null) { + string += "::chest-" + ItemUtil.serialize(inventory[3]); + string += "::chest_drop-" + dropChances[3]; + } + + if (inventory[4] != null) { + string += "::helmet-" + ItemUtil.serialize(inventory[4]); + string += "::helmet_drop-" + dropChances[4]; + } + + return string; + } + + public static QuestMob fromString(String str) { + + String name = null; + EntityType entityType = null; + Location loc = null; + Integer amounts = null; + ItemStack[] inventory = new ItemStack[5]; + Float[] dropChances = new Float[5]; + + String[] args = str.split("::"); + for (String string : args) { + if (string.startsWith("type-")) { + entityType = Quests.getMobType(string.substring(5)); + } else if (string.startsWith("name-")) { + name = string.substring(5); + } else if (string.startsWith("spawn-")) { + loc = Quests.getLocation(string.substring(6)); + } else if (string.startsWith("amounts-")) { + amounts = Integer.parseInt(string.substring(8)); + } else if (string.startsWith("hand-")) { + inventory[0] = ItemUtil.readItemStack(string.substring(5)); + } else if (string.startsWith("hand_drop-")) { + dropChances[0] = Float.parseFloat(string.substring(10)); + } else if (string.startsWith("boots-")) { + inventory[1] = ItemUtil.readItemStack(string.substring(6)); + } else if (string.startsWith("boots_drop-")) { + dropChances[1] = Float.parseFloat(string.substring(11)); + } else if (string.startsWith("leggings-")) { + inventory[2] = ItemUtil.readItemStack(string.substring(9)); + } else if (string.startsWith("leggings_drop-")) { + dropChances[2] = Float.parseFloat(string.substring(14)); + } else if (string.startsWith("chest-")) { + inventory[3] = ItemUtil.readItemStack(string.substring(6)); + } else if (string.startsWith("chest_drop-")) { + dropChances[3] = Float.parseFloat(string.substring(11)); + } else if (string.startsWith("helmet-")) { + inventory[4] = ItemUtil.readItemStack(string.substring(7)); + } else if (string.startsWith("helmet_drop-")) { + dropChances[4] = Float.parseFloat(string.substring(12)); + } + + } + + QuestMob qm = new QuestMob(entityType, loc, amounts); + qm.setName(name); + qm.inventory = inventory; + qm.dropChances = dropChances; + return qm; + } + + @Override + public boolean equals(Object o) { + if ((o instanceof QuestMob) == false) { + return false; + } + QuestMob other = (QuestMob) o; + + if (name.equalsIgnoreCase(other.name) == false) + return false; + + if (entityType != other.entityType) + return false; + + if (dropChances != other.dropChances) + return false; + + if (inventory.length == other.inventory.length) { + for (int i = 0; i < inventory.length; i++) { + if (ItemUtil.compareItems(inventory[i], other.inventory[i], false) != 0) + return false; + } + } else { + return false; + } + + if (spawnAmounts != other.spawnAmounts) + return false; + + if (spawnLocation != other.spawnLocation) + return false; + + return true; + } +}