diff options
5 files changed, 21 insertions, 16 deletions
diff --git a/Essentials/src/com/earth2me/essentials/textreader/IText.java b/Essentials/src/com/earth2me/essentials/textreader/IText.java index 851119701..60db6dadf 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/IText.java +++ b/Essentials/src/com/earth2me/essentials/textreader/IText.java @@ -6,9 +6,12 @@ import java.util.Map; public interface IText { + // Contains the raw text lines List<String> getLines(); + // Chapters contain the names that are displayed automatically if the file doesn't contain a introduction chapter. List<String> getChapters(); + // Bookmarks contains the string mappings from 'chapters' to line numbers. Map<String, Integer> getBookmarks(); } diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java index d6462d047..2d35c7a17 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.textreader; import net.ess3.api.IEssentials; import com.earth2me.essentials.User; +import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.StringUtil; import java.io.*; import java.lang.ref.SoftReference; @@ -73,12 +74,15 @@ public class TextInput implements IText { break; } - if (line.length() > 0 && line.charAt(0) == '#') + if (line.length() > 1 && line.charAt(0) == '#') { - bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-fk]", ""), lineNumber); - chapters.add(line.substring(1).replace('&', '§').replace("§§", "&").trim().replace(" ", "_")); + String[] titles = line.substring(1).trim().replace(" ", "_").split(","); + chapters.add(FormatUtil.replaceFormat(titles[0])); + for (String title : titles) { + bookmarks.put(FormatUtil.stripEssentialsFormat(title.toLowerCase(Locale.ENGLISH)), lineNumber); + } } - lines.add(line.replace('&', '§').replace("§§", "&")); + lines.add(FormatUtil.replaceFormat(line)); lineNumber++; } } diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java index d03762ded..b07e0b233 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java @@ -95,11 +95,6 @@ public class TextPager content.append(I18n.capitalCase(title[0])).append(": "); content.append(title[1]); } - else if (chapterPageStr != null) - { - content.append(I18n.capitalCase(commandName)).append(": "); - content.append(chapterPageStr); - } else { content.append(I18n.capitalCase(commandName)); @@ -161,7 +156,10 @@ public class TextPager final int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0); if (!onePage && commandName != null) { - sender.sendMessage(_("infoChapterPages", pageStr, page, pages)); + StringBuilder content = new StringBuilder(); + content.append(I18n.capitalCase(commandName)).append(": "); + content.append(pageStr); + sender.sendMessage(_("infoChapterPages", content, page, pages)); } for (int i = start; i < chapterend && i < start + (onePage ? 20 : 9); i++) { diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 280172058..e4463cc8d 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -161,10 +161,10 @@ hour=hour hours=hours ignorePlayer=\u00a76You ignore player\u00a7c {0} \u00a76from now on. illegalDate=Illegal date format. -infoChapter=Select chapter\: -infoChapterPages=\u00a76Chapter {0}, page \u00a7c{1}\u00a76 of \u00a7c{2}\u00a76\: +infoChapter=\u00a76Select chapter\: +infoChapterPages=\u00a7e ---- \u00a76{0} \u00a7e--\u00a76 Page \u00a7c{1}\u00a76 of \u00a7c{2} \u00a7e---- infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a7c{0}\u00a76/\u00a7c{1} \u00a7e---- -infoUnknownChapter=Unknown chapter. +infoUnknownChapter=\u00a74Unknown chapter. insufficientFunds=\u00a74Insufficient funds available. invalidCharge=\u00a74Invalid charge. invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}\u00a76. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 280172058..e4463cc8d 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -161,10 +161,10 @@ hour=hour hours=hours ignorePlayer=\u00a76You ignore player\u00a7c {0} \u00a76from now on. illegalDate=Illegal date format. -infoChapter=Select chapter\: -infoChapterPages=\u00a76Chapter {0}, page \u00a7c{1}\u00a76 of \u00a7c{2}\u00a76\: +infoChapter=\u00a76Select chapter\: +infoChapterPages=\u00a7e ---- \u00a76{0} \u00a7e--\u00a76 Page \u00a7c{1}\u00a76 of \u00a7c{2} \u00a7e---- infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a7c{0}\u00a76/\u00a7c{1} \u00a7e---- -infoUnknownChapter=Unknown chapter. +infoUnknownChapter=\u00a74Unknown chapter. insufficientFunds=\u00a74Insufficient funds available. invalidCharge=\u00a74Invalid charge. invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}\u00a76. |