diff options
author | snowleo <schneeleo@gmail.com> | 2011-11-28 20:52:15 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-11-28 20:52:15 +0100 |
commit | 7db7fd4136a525bd6c2b6b180c34b6e9d1fb77cb (patch) | |
tree | 5738bab6b395d532b5eb52e6428ce296696bf13c | |
parent | 5e24584bf7455a8a7a19470c7114b0b11bea2ba2 (diff) | |
download | Essentials-7db7fd4136a525bd6c2b6b180c34b6e9d1fb77cb.tar Essentials-7db7fd4136a525bd6c2b6b180c34b6e9d1fb77cb.tar.gz Essentials-7db7fd4136a525bd6c2b6b180c34b6e9d1fb77cb.tar.lz Essentials-7db7fd4136a525bd6c2b6b180c34b6e9d1fb77cb.tar.xz Essentials-7db7fd4136a525bd6c2b6b180c34b6e9d1fb77cb.zip |
Added info how to read the next page to /info /help /motd /rules
13 files changed, 31 insertions, 11 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 671f1a479..94a095df4 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -173,7 +173,7 @@ public class EssentialsPlayerListener extends PlayerListener final IText input = new TextInput(user, "motd", true, ess); final IText output = new KeywordReplacer(input, user, ess); final TextPager pager = new TextPager(output, true); - pager.showPage("1", null, user); + pager.showPage("1", null, "motd", user); } catch (IOException ex) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 24f463740..328f692ea 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -41,7 +41,7 @@ public class Commandhelp extends EssentialsCommand output = new KeywordReplacer(input, user, ess); } final TextPager pager = new TextPager(output); - pager.showPage(pageStr, chapterPageStr, user); + pager.showPage(pageStr, chapterPageStr, "help", user); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java index 2ae348696..e75eeed9a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java @@ -21,6 +21,6 @@ public class Commandinfo extends EssentialsCommand final IText input = new TextInput(sender, "info", true, ess); final IText output = new KeywordReplacer(input, sender, ess); final TextPager pager = new TextPager(output); - pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, sender); + pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, "info", sender); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java index 5d2d6994a..78ca5c306 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java @@ -21,6 +21,6 @@ public class Commandmotd extends EssentialsCommand final IText input = new TextInput(sender, "motd", true, ess); final IText output = new KeywordReplacer(input, sender, ess); final TextPager pager = new TextPager(output); - pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, sender); + pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, "motd", sender); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java index 32cadf69e..a981fb2f1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java @@ -21,6 +21,6 @@ public class Commandrules extends EssentialsCommand final IText input = new TextInput(sender, "rules", true, ess); final IText output = new KeywordReplacer(input, sender, ess); final TextPager pager = new TextPager(output); - pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, sender); + pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, "rules", sender); } } diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java index dd8422580..c23df734d 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java @@ -23,7 +23,7 @@ public class TextPager this.onePage = onePage; } - public void showPage(final String pageStr, final String chapterPageStr, final CommandSender sender) + public void showPage(final String pageStr, final String chapterPageStr, final String commandName, final CommandSender sender) { List<String> lines = text.getLines(); List<String> chapters = text.getChapters(); @@ -45,16 +45,20 @@ public class TextPager page = 1; } - int start = onePage ? 0 : (page - 1) * 9; + final int start = onePage ? 0 : (page - 1) * 9; + final int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); if (!onePage) { - int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); sender.sendMessage(_("infoPages", page, pages)); } for (int i = start; i < lines.size() && i < start + (onePage ? 20 : 9); i++) { sender.sendMessage(lines.get(i)); } + if (!onePage && page < pages) + { + sender.sendMessage(_("readNextPage", commandName, page + 1)); + } return; } @@ -108,15 +112,20 @@ public class TextPager } } + int pages = end / 9 + (end % 9 > 0 ? 1 : 0); if (!onePage) { - int pages = end / 9 + (end % 9 > 0 ? 1 : 0); + sender.sendMessage(_("infoPages", page, pages)); } for (int i = start; i < end && i < start + (onePage ? 20 : 9); i++) { sender.sendMessage(lines.get(i)); } + if (!onePage && page < pages) + { + sender.sendMessage(_("readNextPage", commandName, page + 1)); + } return; } } @@ -155,15 +164,19 @@ public class TextPager } final int start = chapterstart + (onePage ? 0 : chapterpage * 9); + final int page = chapterpage + 1; + final int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0); if (!onePage) { - final int page = chapterpage + 1; - final int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0); sender.sendMessage(_("infoChapterPages", pageStr, page, pages)); } for (int i = start; i < chapterend && i < start + (onePage ? 20 : 9); i++) { sender.sendMessage(lines.get(i)); } + if (!onePage && page < pages) + { + sender.sendMessage(_("readNextPage", commandName, pageStr + " " + (page + 1))); + } } } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index ce9423503..5a4c67173 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -269,6 +269,7 @@ powerToolsDisabled=All of your power tools have been disabled. powerToolsEnabled=All of your power tools have been enabled. protectionOwner=\u00a76[EssentialsProtect] Protection owner: {0} questionFormat=\u00a77[Question]\u00a7f {0} +readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Reloaded all plugins. repair=You have successfully repaired your: \u00a7e{0}. repairAlreadyFixed=\u00a77This item does not need repairing. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index f1345ab62..4dcd2f24a 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -269,6 +269,7 @@ powerToolsDisabled= All of your power tools have been disabled. powerToolsEnabled= All of your power tools have been enabled. protectionOwner=\u00a76[EssentialsProtect] Beskyttelses ejer: {0} questionFormat=\u00a77[Sp\u00f8rgsm\u00e5l]\u00a7f {0} +readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Genindl\u00e6ste alle tilf\u00f8jelser. repair=You have successfully repaired your: \u00a7e{0}. repairAlreadyFixed=\u00a77This item does not need repairing. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 6b2090676..9cc72bff2 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -269,6 +269,7 @@ powerToolsDisabled=Alle deine Powertools wurden deaktiviert. powerToolsEnabled=Alle deine Powertools wurden aktiviert. protectionOwner=\u00a76[EssentialsProtect] Besitzer dieses Blocks: {0} questionFormat=\u00a77[Frage]\u00a7f {0} +readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Alle plugins neu geladen. repair=Du hast erfolgreich deine {0} repariert. repairAlreadyFixed=\u00a77Dieser Gegenstand ben\u00f6tigt keine Reparatur. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index a9f4b375c..704cdfb68 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -269,6 +269,7 @@ powerToolsDisabled=All of your power tools have been enabled. powerToolsEnabled=All of your power tools have been enabled. protectionOwner=\u00a76[EssentialsProtect] Protection owner: {0} questionFormat=\u00a77[Question]\u00a7f {0} +readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Reloaded all plugins. repair=You have successfully repaired your: \u00a7e{0}. repairAlreadyFixed=\u00a77This item does not need repairing. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index ae3b61f4b..c2d6b6ec3 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -269,6 +269,7 @@ powerToolsDisabled=All of your power tools have been disabled. powerToolsEnabled=All of your power tools have been enabled. protectionOwner=\u00a76[EssentialsProtect] Dueño de la proteccion: {0} questionFormat=\u00a77[Pregunta]\u00a7f {0} +readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Todos los plugins recargados. repair=Has reparado satisfactoriamente tu: \u00a7e{0}. repairAlreadyFixed=\u00a77Este objeto no necesita de reparado. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index a7b73946d..ae8845bc6 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -269,6 +269,7 @@ powerToolsDisabled=Toutes vos commandes assign\u00e9es ont \u00e9t\u00e9 retir\u powerToolsEnabled=Toutes vos commandes assign\u00e9es ont \u00e9t\u00e9 activ\u00e9es. protectionOwner=\u00a76[EssentialsProtect] Propri\u00e9taire de la protection : {0} questionFormat=\u00a77[Question]\u00a7f {0} +readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Toutes les extensions ont \u00e9t\u00e9 recharg\u00e9es. repair=Vous avez r\u00e9par\u00e9 votre : \u00a7e{0}. repairAlreadyFixed=\u00a77Cet objet n''a pas besoin de r\u00e9paration. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index d42077923..73a88cbb5 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -269,6 +269,7 @@ powerToolsDisabled=All of your power tools have been disabled. powerToolsEnabled=All of your power tools have been enabled. protectionOwner=\u00a76[EssentialsProtect] Beschermingeigenaar: {0} questionFormat=\u00a77[Vraag]\u00a7f {0} +readNextPage=Type /{0} {1} to read the next page reloadAllPlugins=\u00a77Alle plugins zijn herladen. repair=You have successfully repaired your: \u00a7e{0}. repairAlreadyFixed=\u00a77This item does not need repairing. |