(UNSTABLE) Lang corrections, reduce duplicate strings - part 4

This commit is contained in:
HappyPikachu 2018-02-01 02:00:57 -05:00
parent 623d349c61
commit b55ad6930c
11 changed files with 185 additions and 164 deletions

View File

@ -2192,7 +2192,7 @@ public class EventFactory implements ConversationAbandonedListener {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] commands = input.split(",");
String[] commands = input.split(Lang.get("charSemi"));
LinkedList<String> cmdList = new LinkedList<String>();
cmdList.addAll(Arrays.asList(commands));
context.setSessionData(CK.E_COMMANDS, cmdList);

View File

@ -17,10 +17,12 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
@ -249,7 +251,8 @@ public class Quest {
return false;
}
} else {
plugin.getLogger().warning("Quester \"" + player.getName() + "\" attempted to take Quest \"" + name + "\", but the Custom Requirement \"" + s + "\" could not be found. Does it still exist?");
plugin.getLogger().warning("Quester \"" + player.getName() + "\" attempted to take Quest \"" + name + "\", but the Custom Requirement \"" + s
+ "\" could not be found. Does it still exist?");
}
}
if (quester.questPoints < questPointsReq) {
@ -375,25 +378,40 @@ public class Quest {
none = null;
}
for (ItemStack i : itemRewards) {
String text = "error";
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount();
} else {
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " " + Lang.get("with")
+ ChatColor.DARK_PURPLE;
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
}
text += ChatColor.GRAY + " x " + i.getAmount();
}
} else if (i.getDurability() != 0) {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount();
} else {
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " " + Lang.get("with");
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
}
text += ChatColor.GRAY + " x " + i.getAmount();
}
} else {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount());
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount();
} else {
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " " + Lang.get("with");
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
}
text += ChatColor.GRAY + " x " + i.getAmount();
}
}
player.sendMessage(text);
none = null;
}
for (ItemStack i : phatLootItems) {

View File

@ -1482,6 +1482,12 @@ public class Quester {
return prettyString;
}
/**
* Gets player-friendly name from type. 'ENDER_DRAGON' becomes 'Ender Dragon'
*
* @param type any mob type, ideally
* @return cleaned-up string
*/
public static String prettyMobString(EntityType type) {
String baseString = type.toString();
String[] substrings = baseString.split("_");
@ -1500,20 +1506,25 @@ public class Quester {
return prettyString;
}
public static String prettyString(String s) {
String[] substrings = s.split("_");
String prettyString = "";
int size = 1;
for (String sb : substrings) {
prettyString = prettyString.concat(Quester.getCapitalized(sb));
if (size < substrings.length) {
prettyString = prettyString.concat(" ");
}
size++;
public static String prettyColorString(DyeColor color) {
return Lang.get("COLOR_" + color.name());
}
public static String prettyEnchantmentString(Enchantment e) {
String prettyString = enchantmentString(e);
prettyString = capitalsToSpaces(prettyString);
return prettyString;
}
public static String enchantmentString(Enchantment e) {
try {
return (Lang.get("ENCHANTMENT_" + e.getName()));
} catch (NullPointerException ne) {
Bukkit.getLogger().warning(e.getName() + " was not found in Lang.yml, please ask the developer to " + "update the file or simply add an entry for the enchantment");
return e.getName().toLowerCase().replaceAll("_", " ");
}
}
public static String capitalsToSpaces(String s) {
int max = s.length();
for (int i = 1; i < max; i++) {
@ -1536,24 +1547,6 @@ public class Quester {
return s;
}
public static String prettyEnchantmentString(Enchantment e) {
String prettyString = enchantmentString(e);
prettyString = capitalsToSpaces(prettyString);
return prettyString;
}
public static String enchantmentString(Enchantment e) {
if (Lang.get("ENCHANTMENT_" + e.getName()).equals("NULL")) {
Bukkit.getLogger().warning(e.getName() + " was not found in Lang.yml, please ask the developer to " + "update the file or simply add an entry for the enchantment");
return e.getName().toLowerCase().replaceAll("_", " ");
}
return (Lang.get("ENCHANTMENT_" + e.getName()));
}
public static String prettyColorString(DyeColor color) {
return Lang.get("COLOR_" + color.name());
}
public void saveData() {
FileConfiguration data = getBaseData();
try {

View File

@ -2812,7 +2812,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
stageFailed("enchantments: in Stage " + s2 + " of Quest " + quest.name + " is not a list of enchantment names!");
}
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".enchantment-item-names")) {
if (Quests.checkList(config.getList("quests." + questName + ".stages.ordered." + s2 + ".enchantment-item-names"), Integer.class)) {
if (Quests.checkList(config.getList("quests." + questName + ".stages.ordered." + s2 + ".enchantment-item-names"), String.class)) {
for (String item : config.getStringList("quests." + questName + ".stages.ordered." + s2 + ".enchantment-item-names")) {
if (Material.matchMaterial(item) != null) {
itemsToEnchant.add(Material.matchMaterial(item));
@ -2821,7 +2821,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
}
} else {
stageFailed("enchantment-item-names: in Stage " + s2 + " of Quest " + quest.name + " is not a list of numbers!");
stageFailed("enchantment-item-names: in Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!");
}
} else {
stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing enchantment-item-names:");
@ -3847,60 +3847,60 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
public static Enchantment getEnchantment(String enchant) {
String ench = Lang.getKey(enchant);
String ench = Lang.getKey(enchant.replaceAll(" ", ""));
ench = ench.replace("ENCHANTMENT_", "");
Enchantment e = Enchantment.getByName(ench);
return e != null ? e : getEnchantmentLegacy(ench);
return e != null ? e : getEnchantmentLegacy(ench.replaceAll(" ", ""));
}
public static Enchantment getEnchantmentLegacy(String enchant) {
if (enchant.equalsIgnoreCase("Power")) {
if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_DAMAGE"))) {
return Enchantment.ARROW_DAMAGE;
} else if (enchant.equalsIgnoreCase("Flame")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_FIRE"))) {
return Enchantment.ARROW_FIRE;
} else if (enchant.equalsIgnoreCase("Infinity")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_INFINITE"))) {
return Enchantment.ARROW_INFINITE;
} else if (enchant.equalsIgnoreCase("Punch")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_KNOCKBACK"))) {
return Enchantment.ARROW_KNOCKBACK;
} else if (enchant.equalsIgnoreCase("Sharpness")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DAMAGE_ALL"))) {
return Enchantment.DAMAGE_ALL;
} else if (enchant.equalsIgnoreCase("BaneOfArthropods")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DAMAGE_ARTHROPODS"))) {
return Enchantment.DAMAGE_ARTHROPODS;
} else if (enchant.equalsIgnoreCase("Smite")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DAMAGE_UNDEAD"))) {
return Enchantment.DAMAGE_UNDEAD;
} else if (enchant.equalsIgnoreCase("Efficiency")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DIG_SPEED"))) {
return Enchantment.DIG_SPEED;
} else if (enchant.equalsIgnoreCase("Unbreaking")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DURABILITY"))) {
return Enchantment.DURABILITY;
} else if (enchant.equalsIgnoreCase("FireAspect")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_FIRE_ASPECT"))) {
return Enchantment.FIRE_ASPECT;
} else if (enchant.equalsIgnoreCase("Knockback")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_KNOCKBACK"))) {
return Enchantment.KNOCKBACK;
} else if (enchant.equalsIgnoreCase("Fortune")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LOOT_BONUS_BLOCKS"))) {
return Enchantment.LOOT_BONUS_BLOCKS;
} else if (enchant.equalsIgnoreCase("Looting")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LOOT_BONUS_MOBS"))) {
return Enchantment.LOOT_BONUS_MOBS;
} else if (enchant.equalsIgnoreCase("LuckOfTheSea")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LUCK"))) {
return Enchantment.LOOT_BONUS_MOBS;
} else if (enchant.equalsIgnoreCase("Lure")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LURE"))) {
return Enchantment.LOOT_BONUS_MOBS;
} else if (enchant.equalsIgnoreCase("Respiration")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_OXYGEN"))) {
return Enchantment.OXYGEN;
} else if (enchant.equalsIgnoreCase("Protection")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_ENVIRONMENTAL"))) {
return Enchantment.PROTECTION_ENVIRONMENTAL;
} else if (enchant.equalsIgnoreCase("BlastProtection")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_EXPLOSIONS"))) {
return Enchantment.PROTECTION_EXPLOSIONS;
} else if (enchant.equalsIgnoreCase("FeatherFalling")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_FALL"))) {
return Enchantment.PROTECTION_FALL;
} else if (enchant.equalsIgnoreCase("FireProtection")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_FIRE"))) {
return Enchantment.PROTECTION_FIRE;
} else if (enchant.equalsIgnoreCase("ProjectileProtection")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_PROJECTILE"))) {
return Enchantment.PROTECTION_PROJECTILE;
} else if (enchant.equalsIgnoreCase("SilkTouch")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_SILK_TOUCH"))) {
return Enchantment.SILK_TOUCH;
} else if (enchant.equalsIgnoreCase("Thorns")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_THORNS"))) {
return Enchantment.THORNS;
} else if (enchant.equalsIgnoreCase("AquaAffinity")) {
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_WATER_WORKER"))) {
return Enchantment.WATER_WORKER;
} else {
return null;

View File

@ -136,7 +136,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_ENCHANT_NAMES);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS);
for (int i = 0; i < enchants.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA + Quester.prettyString(enchants.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA + Quester.prettyEnchantmentString(Quests.getEnchantment(enchants.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
}
}
if (questFactory.quests.citizens != null) {
@ -188,7 +188,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_MOB_AMOUNTS);
if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) == null) {
for (int i = 0; i < mobs.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + Quester.prettyString(mobs.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA + Quester.prettyMobString(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
}
} else {
LinkedList<String> locs = (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS);
@ -197,7 +197,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
for (int i = 0; i < mobs.size(); i++) {
String msg = Lang.get("blocksWithin");
msg = msg.replaceAll("<amount>", ChatColor.DARK_PURPLE + "" + radii.get(i) + ChatColor.GRAY);
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyString(mobs.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + ChatColor.GRAY + msg + ChatColor.YELLOW + names.get(i) + " (" + locs.get(i) + ")\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyMobString(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + ChatColor.GRAY + msg + ChatColor.YELLOW + names.get(i) + " (" + locs.get(i) + ")\n";
}
}
}
@ -509,8 +509,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.YELLOW + Lang.get("stageEditorPasswordPhrasePrompt") + "\n";
text += ChatColor.ITALIC + "" + ChatColor.GOLD + Lang.get("stageEditorPasswordPhraseHint1") + "\n";
text += ChatColor.RESET + "" + ChatColor.YELLOW + Lang.get("stageEditorPasswordPhraseHint2");
text += ChatColor.ITALIC + "" + ChatColor.GOLD + Lang.get("stageEditorPasswordPhraseHint");
return text;
}
@ -521,13 +520,13 @@ public class CreateStagePrompt extends FixedSetPrompt {
@SuppressWarnings("unchecked")
LinkedList<LinkedList<String>> phrases = (LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
LinkedList<String> newPhrases = new LinkedList<String>();
newPhrases.addAll(Arrays.asList(input.split("\\|")));
newPhrases.addAll(Arrays.asList(input.split(Lang.get("charSemi"))));
phrases.add(newPhrases);
context.setSessionData(pref + CK.S_PASSWORD_PHRASES, phrases);
} else {
LinkedList<LinkedList<String>> phrases = new LinkedList<LinkedList<String>>();
LinkedList<String> newPhrases = new LinkedList<String>();
newPhrases.addAll(Arrays.asList(input.split("\\|")));
newPhrases.addAll(Arrays.asList(input.split(Lang.get("charSemi"))));
phrases.add(newPhrases);
context.setSessionData(pref + CK.S_PASSWORD_PHRASES, phrases);
}
@ -1805,8 +1804,12 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.DARK_PURPLE + Lang.get("stageEditorEnchantments") + ChatColor.LIGHT_PURPLE + " -\n";
for (Enchantment e : Enchantment.values()) {
text += ChatColor.GREEN + Quester.prettyEnchantmentString(e) + ", ";
for (int i = 0; i < Enchantment.values().length; i++) {
if (i == Enchantment.values().length - 1) {
text += ChatColor.GREEN + Quester.prettyEnchantmentString(Enchantment.values()[i]) + " ";
} else {
text += ChatColor.GREEN + Quester.prettyEnchantmentString(Enchantment.values()[i]) + ", ";
}
}
text = text.substring(0, text.length() - 1);
return text + "\n" + ChatColor.YELLOW + Lang.get("stageEditorEnchantTypePrompt");
@ -1815,7 +1818,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(",");
String[] args = input.split(Lang.get("charSemi"));
LinkedList<String> enchs = new LinkedList<String>();
boolean valid;
for (String s : args) {
@ -2082,7 +2085,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(";");
String[] args = input.split(Lang.get("charSemi"));
LinkedList<String> messages = new LinkedList<String>();
messages.addAll(Arrays.asList(args));
context.setSessionData(pref + CK.S_DELIVERY_MESSAGES, messages);
@ -2612,7 +2615,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
LinkedList<String> locNames = new LinkedList<String>();
locNames.addAll(Arrays.asList(input.split(",")));
locNames.addAll(Arrays.asList(input.split(Lang.get("charSemi"))));
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES, locNames);
}
return new MobListPrompt();
@ -2813,7 +2816,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
LinkedList<String> locNames = new LinkedList<String>();
locNames.addAll(Arrays.asList(input.split(",")));
locNames.addAll(Arrays.asList(input.split(Lang.get("charSemi"))));
context.setSessionData(pref + CK.S_REACH_LOCATIONS_NAMES, locNames);
}
return new ReachListPrompt();

View File

@ -417,7 +417,7 @@ public class ItemStackPrompt extends FixedSetPrompt {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
input = Quests.parseString(input);
LinkedList<String> lore = new LinkedList<String>();
lore.addAll(Arrays.asList(input.split(";")));
lore.addAll(Arrays.asList(input.split(Lang.get("charSemi"))));
cc.setSessionData("tempLore", lore);
} else if (input.equalsIgnoreCase("clear")) {
cc.setSessionData("tempLore", null);

View File

@ -261,16 +261,14 @@ public class RequirementsPrompt extends FixedSetPrompt {
text = text.substring(0, (text.length() - 2));
text += "\n";
}
String lang = Lang.get("reqQuestPrompt");
lang = lang.replaceAll("<comma>", ChatColor.RED + "" + ChatColor.BOLD + Lang.get("comma") + ChatColor.RESET + ChatColor.YELLOW);
text += ChatColor.YELLOW + lang;
text += ChatColor.YELLOW + Lang.get("reqQuestPrompt");
return text;
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(",");
String[] args = input.split(Lang.get("charSemi"));
LinkedList<String> questNames = new LinkedList<String>();
for (String s : args) {
if (quests.getQuest(s) == null) {

View File

@ -328,7 +328,7 @@ public class RewardsPrompt extends FixedSetPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(",");
String[] args = input.split(Lang.get("charSemi"));
LinkedList<String> commands = new LinkedList<String>();
for (String s : args) {
if (s.startsWith("/")) {

View File

@ -165,11 +165,14 @@ public class ItemUtil {
if (is.getDurability() != 0) {
text += ChatColor.AQUA + ":" + is.getDurability();
}
text += ChatColor.AQUA + " x " + is.getAmount();
if (is.getEnchantments().isEmpty() == false) {
text += " " + ChatColor.DARK_PURPLE + Lang.get("enchantedItem");
text += " " + ChatColor.GRAY + Lang.get("with") + ChatColor.DARK_PURPLE;
for (Entry<Enchantment, Integer> e : is.getEnchantments().entrySet()) {
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
}
}
text += ChatColor.AQUA + " x " + is.getAmount();
}
return text;
}

View File

@ -35,7 +35,6 @@ public class Lang {
private static final LangToken tokens = new LangToken();
public static final LinkedHashMap<String, String> langMap = new LinkedHashMap<String, String>();
private final Quests plugin;
//public static String orCancelToReturn = "or 'cancel' to return";
public Lang(Quests plugin) {
tokens.initTokens();
@ -107,8 +106,6 @@ public class Lang {
+ " same folder to stay up-to-date and suppress console warnings.");
config_new.options().copyHeader(true);
config_new.save(langFile_new);
langMap.putAll(allStrings);
finishLang();
} else {
plugin.getLogger().severe("Failed loading lang files for " + iso + " because they were not found. Using default en-US");
iso = "en-US";
@ -116,34 +113,43 @@ public class Lang {
for (String key : config.getKeys(false)) {
allStrings.put(key, config.getString(key));
}
}
String cmdAdd = allStrings.get("cmdAdd");
String cmdClear = allStrings.get("cmdClear");
String cmdCancel = allStrings.get("cmdCancel");
String cmdDone = allStrings.get("cmdDone");
String strAdd = allStrings.get("strAdd").replaceAll("<command>", cmdAdd);
String strClear = allStrings.get("strClear").replaceAll("<command>", cmdClear);
String strCancel = allStrings.get("strCancel").replaceAll("<command>", cmdCancel);
String strDone = allStrings.get("strDone").replaceAll("<command>", cmdDone);
String strSpace = allStrings.get("strSpace");
String strSemicolon = allStrings.get("strSemicolon");
for (Entry<String, String> entry : allStrings.entrySet()) {
if (entry.getValue().contains("<add>")) {
allStrings.put(entry.getKey(), entry.getValue().replaceAll("<add>", strAdd));
}
if (entry.getValue().contains("<clear>")) {
allStrings.put(entry.getKey(), entry.getValue().replaceAll("<clear>", strClear));
}
if (entry.getValue().contains("<cancel>")) {
allStrings.put(entry.getKey(), entry.getValue().replaceAll("<cancel>", strCancel));
}
if (entry.getValue().contains("<done>")) {
allStrings.put(entry.getKey(), entry.getValue().replaceAll("<done>", strDone));
}
if (entry.getValue().contains("<space>")) {
allStrings.put(entry.getKey(), entry.getValue().replaceAll("<space>", strSpace));
}
if (entry.getValue().contains("<semicolon>")) {
allStrings.put(entry.getKey(), entry.getValue().replaceAll("<semicolon>", strSemicolon));
}
}
langMap.putAll(allStrings);
finishLang();
}
plugin.getLogger().info("Loaded language " + iso + ". Translations via Crowdin");
}
private void finishLang() {
langMap.put("strAdd", get("strAdd").replaceAll("<command>", get("cmdAdd")));
langMap.put("strClear", get("strClear").replaceAll("<command>", get("cmdClear")));
langMap.put("strCancel", get("strCancel").replaceAll("<command>", get("cmdCancel")));
langMap.put("strDone", get("strDone").replaceAll("<command>", get("cmdDone")));
for (String key : langMap.keySet()) {
String value = get(key);
// then enter 'add' to include it
value.replaceAll("<add>", get("strAdd"));
// or 'clear' to erase all data
value.replaceAll("<clear>", get("strClear"));
// or 'cancel' to return
value.replaceAll("<cancel>", get("strCancel"));
// then enter '<command>' to save
value.replaceAll("<done>", get("strDone"));
langMap.put(key, value);
}
}
/**
* Load YAML file using UTF8 format to allow extended characters
* @param file system file in YAML format

View File

@ -105,7 +105,7 @@ questEditorSave: "Finish and save"
questEditorNeedAskMessage: "You must set an ask message!"
questEditorNeedFinishMessage: "You must set a finish message!"
questEditorNeedStages: "Your Quest has no Stages!"
questEditorSaved: "%bold%Quest saved! %reset%(You will need to perform %red%<command> %reset%for it to appear)"
questEditorSaved: "%bold%Quest saved! %reset%(You will need to perform %red%<command> %reset% for it to appear in-game)"
questEditorExited: "Are you sure you want to exit without saving?"
questEditorDeleted: "Are you sure you want to delete the Quest"
questEditorNoPermsCreate: "You do not have permission to create Quests."
@ -191,33 +191,33 @@ stageEditorCustomPrompt: "Enter the name of a custom objective to add, <clear>,
stageEditorCustomAlreadyAdded: "That custom objective has already been added!"
stageEditorCustomCleared: "Custom objectives cleared."
stageEditorCustomDataPrompt: "Enter value for <data>:"
stageEditorEnterBlockNames: "Enter block names (or IDs), separating each one by a space, <cancel>"
stageEditorBreakBlocksPrompt: "Enter break amounts (numbers), separating each one by a space, <cancel>"
stageEditorDamageBlocksPrompt: "Enter damage amounts (numbers), separating each one by a space, <cancel>"
stageEditorPlaceBlocksPrompt: "Enter place amounts (numbers), separating each one by a space, <cancel>"
stageEditorUseBlocksPrompt: "Enter use amounts (numbers), separating each one by a space, <cancel>"
stageEditorCutBlocksPrompt: "Enter cut amounts (numbers), separating each one by a space, <cancel>"
stageEditorEnterBlockDurability: "Enter block durability (numbers), separating each one by a space, <cancel>"
stageEditorEnterBlockNames: "Enter block names (or IDs), <space>, <cancel>"
stageEditorBreakBlocksPrompt: "Enter break amounts (numbers), <space>, <cancel>"
stageEditorDamageBlocksPrompt: "Enter damage amounts (numbers), <space>, <cancel>"
stageEditorPlaceBlocksPrompt: "Enter place amounts (numbers), <space>, <cancel>"
stageEditorUseBlocksPrompt: "Enter use amounts (numbers), <space>, <cancel>"
stageEditorCutBlocksPrompt: "Enter cut amounts (numbers), <space>, <cancel>"
stageEditorEnterBlockDurability: "Enter block durability (numbers), <space>, <cancel>"
stageEditorCatchFishPrompt: "Enter number of fish to catch, or 0 to clear the fish catch objective, or -1 to cancel"
stageEditorKillPlayerPrompt: "Enter number of players to kill, or 0 to clear the player kill objective, or -1 to cancel"
stageEditorEnchantTypePrompt: "Enter enchantment names, separating each one by a comma, <cancel>"
stageEditorEnchantAmountsPrompt: "Enter enchant amounts (numbers), separating each one by a space, <cancel>"
stageEditorItemNamesPrompt: "Enter item names, separating each one by a space, <cancel>"
stageEditorNPCPrompt: "Enter NPC IDs, separating each one by a space, <cancel>"
stageEditorNPCToTalkToPrompt: "Enter NPC IDs, separating each one by a space, <clear>, <cancel>"
stageEditorDeliveryMessagesPrompt: "Enter delivery messages, separating each one by a semi-colon, <cancel>"
stageEditorKillNPCsPrompt: "Enter kill amounts (numbers), separating each one by a space, <cancel>"
stageEditorMobsPrompt: "Enter mob names separating each one by a space, <cancel>"
stageEditorMobAmountsPrompt: "Enter mob amounts separating each one by a space, <cancel>"
stageEditorEnchantTypePrompt: "Enter enchantment names, <semicolon>, <cancel>"
stageEditorEnchantAmountsPrompt: "Enter enchant amounts (numbers), <space>, <cancel>"
stageEditorItemNamesPrompt: "Enter item names, <space>, <cancel>"
stageEditorNPCPrompt: "Enter NPC IDs, <space>, <cancel>"
stageEditorNPCToTalkToPrompt: "Enter NPC IDs, <space>, <clear>, <cancel>"
stageEditorDeliveryMessagesPrompt: "Enter delivery messages, <semicolon>, <cancel>"
stageEditorKillNPCsPrompt: "Enter kill amounts (numbers), <space>, <cancel>"
stageEditorMobsPrompt: "Enter mob names, <space>, <cancel>"
stageEditorMobAmountsPrompt: "Enter mob amounts, <space>, <cancel>"
stageEditorMobLocationPrompt: "Right-click on a block to select it, <add>, <cancel>"
stageEditorMobLocationRadiiPrompt: "Enter kill location radii (number of blocks) separating each one by a space, <cancel>"
stageEditorMobLocationNamesPrompt: "Enter location names separating each one by a comma, <cancel>"
stageEditorMobLocationRadiiPrompt: "Enter kill location radii (number of blocks), <space>, <cancel>"
stageEditorMobLocationNamesPrompt: "Enter location names, <semicolon>, <cancel>"
stageEditorReachLocationPrompt: "Right-click on a block to select it, <add>, <cancel>"
stageEditorReachLocationRadiiPrompt: "Enter reach location radii (number of blocks) separating each one by a space, <cancel>"
stageEditorReachLocationNamesPrompt: "Enter location names separating each one by a comma, <cancel>"
stageEditorTameAmountsPrompt: "Enter tame amounts separating each one by a space, <cancel>"
stageEditorShearColorsPrompt: "Enter sheep colors separating each one by a space, <cancel>"
stageEditorShearAmountsPrompt: "Enter shear amounts separating each one by a space, <cancel>"
stageEditorReachLocationRadiiPrompt: "Enter reach location radii (number of blocks), <space>, <cancel>"
stageEditorReachLocationNamesPrompt: "Enter location names, <semicolon>, <cancel>"
stageEditorTameAmountsPrompt: "Enter tame amounts, <space>, <cancel>"
stageEditorShearColorsPrompt: "Enter sheep colors, <space>, <cancel>"
stageEditorShearAmountsPrompt: "Enter shear amounts, <space>, <cancel>"
stageEditorEventsPrompt: "Enter an event name, <clear>, <cancel>"
stageEditorChatEventsPrompt: "Enter an event name to add, <clear>, <cancel>"
stageEditorChatEventsTriggerPrompt: "%yellow%Enter a chat trigger for%aqua% <event>%yellow% <cancel>"
@ -228,11 +228,10 @@ stageEditorDelayMessagePrompt: "Enter delay message, <clear>, <cancel>"
stageEditorScriptPrompt: "Enter script name, <clear>, <cancel>"
stageEditorStartMessagePrompt: "Enter start message, <clear>, <cancel>"
stageEditorCompleteMessagePrompt: "Enter complete message, <clear>, <cancel>"
stageEditorPasswordDisplayPrompt: "Enter a password display, <cancel>"
stageEditorPasswordDisplayPrompt: "Enter password display, <cancel>"
stageEditorPasswordDisplayHint: "(This is the text that will be displayed to the player as their objective)"
stageEditorPasswordPhrasePrompt: "Enter a password phrase, <cancel>"
stageEditorPasswordPhraseHint1: "(This is the text that a player has to say to complete the objective)"
stageEditorPasswordPhraseHint2: "If you want multiple password phrases, separate them by a | (pipe)"
stageEditorPasswordPhrasePrompt: "Enter password phrases, <semicolon>, <cancel>"
stageEditorPasswordPhraseHint: "(This is the text that a player must enter to complete the objective)"
stageEditorObjectiveOverridePrompt: "Enter objective display override, <clear>, <cancel>"
stageEditorObjectiveOverrideHint: "(This override will display your own text as the objective)"
stageEditorObjectiveOverrideCleared: "Objective display override cleared."
@ -448,9 +447,9 @@ eventEditorSetMobTypesPrompt: "Enter mob name, <cancel>"
eventEditorSetMobAmountsPrompt: "Enter mob amount, <cancel>"
eventEditorSetMobNamePrompt: "Enter the name for this mob, <cancel>"
eventEditorSetMobLocationPrompt: "Right-click on a block to select it, <add>, <cancel>"
eventEditorSetPotionEffectsPrompt: "Enter potion effect types separating each one by a space, <cancel>"
eventEditorSetPotionDurationsPrompt: "Enter effect durations (in milliseconds) separating each one by a space, <cancel>"
eventEditorSetPotionMagnitudesPrompt: "Enter potion effect magnitudes separating each one by a space, <cancel>"
eventEditorSetPotionEffectsPrompt: "Enter potion effect types, <space>, <cancel>"
eventEditorSetPotionDurationsPrompt: "Enter effect durations (in milliseconds), <space>, <cancel>"
eventEditorSetPotionMagnitudesPrompt: "Enter potion effect magnitudes, <space>, <cancel>"
eventEditorSetHungerPrompt: "Enter hunger level, or -1 to clear"
eventEditorHungerLevelAtLeastZero: "Hunger level must be at least 0!"
eventEditorSetSaturationPrompt: "Enter saturation level, or -1 to clear"
@ -459,7 +458,7 @@ eventEditorSetHealthPrompt: "Enter health level, or -1 to clear"
eventEditorHealthLevelAtLeastZero: "Health level must be at least 0!"
eventEditorSetTeleportPrompt: "Right-click on a block to teleport the player to, <done>, <clear>, <cancel>"
eventEditorCommandsNote: "Note: You may use <player> to refer to the player's name."
eventEditorSetCommandsPrompt: "Enter commands separating each one by a comma, <clear>, <cancel>"
eventEditorSetCommandsPrompt: "Enter commands, <semicolon>, <clear>, <cancel>"
reqSetMoney: "Set money requirement"
reqSetQuestPoints: "Set Quest Points requirement"
reqSetItem: "Set item requirements"
@ -477,12 +476,12 @@ reqHeroesSetSecondary: "Set Secondary Class"
reqMoneyPrompt: "Enter amount of <money>, or 0 to clear the money requirement, or -1 to cancel"
reqQuestPointsPrompt: "Enter amount of Quest Points, or 0 to clear the Quest Point requirement, or -1 to cancel"
reqQuestListTitle: "- Quests Available -"
reqQuestPrompt: "Enter a list of Quest names separating each one by a <comma>, <clear>, <cancel>"
reqRemoveItemsPrompt: "Enter a list of true/false values, separating each one by a space, <cancel>"
reqPermissionsPrompt: "Enter permission requirements separating each one by a space, <clear>, <cancel>"
reqQuestPrompt: "Enter a list of Quest names, <semicolon>, <clear>, <cancel>"
reqRemoveItemsPrompt: "Enter a list of true/false values, <space>, <cancel>"
reqPermissionsPrompt: "Enter permission requirements, <space>, <clear>, <cancel>"
reqCustomPrompt: "Enter the name of a custom requirement to add, <clear>, <cancel>"
reqMcMMOPrompt: "Enter mcMMO skills, separating each one by a space, <clear>, <cancel>"
reqMcMMOAmountsPrompt: "Enter mcMMO skill amounts, separating each one by a space, <clear>, <cancel>"
reqMcMMOPrompt: "Enter mcMMO skills, <space>, <clear>, <cancel>"
reqMcMMOAmountsPrompt: "Enter mcMMO skill amounts, <space>, <clear>, <cancel>"
reqHeroesPrimaryPrompt: "Enter a Heroes Primary Class name, <clear>, <cancel>"
reqHeroesSecondaryPrompt: "Enter a Heroes Secondary Class name, <clear>, <cancel>"
reqFailMessagePrompt: "Enter fail requirements message, <cancel>"
@ -528,15 +527,15 @@ rewSetHeroesClasses: "Set classes"
rewSetHeroesAmounts: "Set experience amounts"
rewMoneyPrompt: "Enter amount of <money>, or 0 to clear the money reward, or -1 to cancel"
rewExperiencePrompt: "Enter amount of experience, or 0 to clear the experience reward, or -1 to cancel"
rewCommandPrompt: "Enter command rewards separating each one by a <comma>, <clear>, <cancel>"
rewCommandPrompt: "Enter command rewards, <semicolon>, <clear>, <cancel>"
rewCommandPromptHint: 'Note: You may put <player> to specify the player who completed the Quest. e.g. smite <player>'
rewPermissionsPrompt: "Enter permission rewards separating each one by a space, <clear>, <cancel>"
rewPermissionsPrompt: "Enter permission rewards, <space>, <clear>, <cancel>"
rewQuestPointsPrompt: "Enter amount of Quest Points, or 0 to clear the Quest Point reward, or -1 to cancel"
rewMcMMOPrompt: "Enter mcMMO skills, separating each one by a space, <cancel>"
rewMcMMOPrompt: "Enter mcMMO skills, <space>, <cancel>"
rewMcMMOPromptHint: "Note: Typing 'All' will give levels to all skills."
rewHeroesClassesPrompt: "Enter Heroes classes separating each one by a space, <cancel>"
rewHeroesExperiencePrompt: "Enter experience amounts (numbers, decimals are allowed) separating each one by a space, <cancel>"
rewPhatLootsPrompt: "Enter PhatLoots separating each one by a space, <clear>, <cancel>"
rewHeroesClassesPrompt: "Enter Heroes classes, <space>, <cancel>"
rewHeroesExperiencePrompt: "Enter experience amounts (numbers, decimals are allowed), <space>, <cancel>"
rewPhatLootsPrompt: "Enter PhatLoots, <space>, <clear>, <cancel>"
rewCustomRewardPrompt: "Enter the name of a custom reward to add, <clear>, <cancel>"
rewItemsCleared: "Item rewards cleared."
rewNoMcMMOSkills: "No skills set"
@ -567,7 +566,7 @@ itemCreateEnterDurab: "Enter item durability, <clear>, <cancel>"
itemCreateEnterEnch: "Enter an enchantment name, <clear>, <cancel>"
itemCreateEnterLevel: "Enter a level (number) for <enchantment>"
itemCreateEnterDisplay: "Enter item display name, <clear>, <cancel>"
itemCreateEnterLore: "Enter item lore, separating each line by a semi-colon, <clear>, <cancel>"
itemCreateEnterLore: "Enter item lore, <semicolon>, <clear>, <cancel>"
itemCreateLoaded: "Item loaded."
itemCreateNoItem: "No item in hand!"
itemCreateNoName: "You must set a name first!"
@ -644,9 +643,12 @@ cmdCancel: "cancel"
strCancel: "or '<command>' to return"
cmdDone: "done"
strDone: "then enter '<command>' to save"
strSpace: separating each by a space
strSemicolon: separating each by a semicolon
charSemi: ";"
acceptQuest: "Accept Quest?"
enterAnOption: "Enter an option"
questAccepted: 'Quest accepted: <quest>'
questAccepted: "Quest accepted: <quest>"
currentQuest: "Current Quests:"
noMoreQuest: "No more quests available."
break: "Break"
@ -822,7 +824,6 @@ clear: "Clear"
edit: "Edit"
none: "None"
done: "Done"
comma: "comma"
finish: "Finish"
quit: "Quit"
noneSet: "None set"
@ -833,7 +834,7 @@ worlds: "Worlds"
mobs: "Mobs"
points: "points"
invalidOption: "Invalid option!"
npcHint: "Note: You can left or right click on NPC's to get their ID."
npcHint: "Note: You can left or right click on NPCs to get their ID."
listDuplicate: "List contains duplicates!"
id: "ID"
quest: "Quest"
@ -848,11 +849,10 @@ usage: "Usage"
redoableEvery: "Redoable every <time>."
requirements: "Requirements"
money: "Money"
with: "With"
with: "with"
to: "to"
blocksWithin: "within <amount> blocks of"
valRequired: "Value required"
enchantedItem: "*Enchanted*"
experience: "Experience"
timerMessage: "%green%Time left to finish the quest/stage:%red% <time> seconds"
timerStart: "%green%You have%red% <time> seconds%green% to finish this quest/stage"