diff --git a/BetonQuest-core/src/main/java/pl/betoncraft/betonquest/Journal.java b/BetonQuest-core/src/main/java/pl/betoncraft/betonquest/Journal.java index e1dbd34d42..1c69b3cb23 100644 --- a/BetonQuest-core/src/main/java/pl/betoncraft/betonquest/Journal.java +++ b/BetonQuest-core/src/main/java/pl/betoncraft/betonquest/Journal.java @@ -191,7 +191,7 @@ public void generateTexts(String lang) { if (dateParts.length > 1) { hour = "§" + Config.getString("config.journal_colors.date.hour") + dateParts[1]; } - datePrefix = day + " " + hour; + datePrefix = day + " " + hour + "\n"; } // get package and name of the pointer String[] parts = pointer.getPointer().split("\\."); @@ -230,8 +230,7 @@ public void generateTexts(String lang) { } // add the entry to the list - texts.add(datePrefix + "§" + Config.getString("config.journal_colors.text") + "\n" - + text); + texts.add(datePrefix + "§" + Config.getString("config.journal_colors.text") + text); } } @@ -316,8 +315,7 @@ private String generateMainPage() { for (int i : sorted) { sortedLines.add(lines.get(i)); } - String finalLine = StringUtils.join(sortedLines, '\n').replace('&', '§'); - return finalLine; + return StringUtils.join(sortedLines, '\n').replace('&', '§'); } /** @@ -371,22 +369,33 @@ public ItemStack getAsItem() { BookMeta meta = (BookMeta) item.getItemMeta(); meta.setTitle(Utils.format(Config.getMessage(lang, "journal_title"))); meta.setAuthor(PlayerConverter.getPlayer(playerID).getName()); - List lore = new ArrayList(); + List lore = new ArrayList<>(); lore.add(Utils.format(Config.getMessage(lang, "journal_lore"))); meta.setLore(lore); // add main page and generate pages from texts List finalList = new ArrayList<>(); if (Config.getString("config.journal.one_entry_per_page").equalsIgnoreCase("false")) { String color = Config.getString("config.journal_colors.line"); + String separator = Config.parseMessage(playerID, "journal_separator", null); + if (separator == null) { + separator = "---------------"; + } + String line = "\n§" + color + separator + "\n"; + + if (Config.getString("config.journal.show_separator") != null && + Config.getString("config.journal.show_separator").equalsIgnoreCase("false")) { + line = "\n"; + } + StringBuilder stringBuilder = new StringBuilder(); for (String entry : getText()) { - stringBuilder.append(entry + "\n§" + color + "---------------\n"); + stringBuilder.append(entry).append(line); } if (mainPage != null && mainPage.length() > 0) { if (Config.getString("config.journal.full_main_page").equalsIgnoreCase("true")) { finalList.addAll(Utils.pagesFromString(mainPage)); } else { - stringBuilder.insert(0, mainPage + "\n§" + color + "---------------\n"); + stringBuilder.insert(0, mainPage + line); } } String wholeString = stringBuilder.toString().trim(); diff --git a/docs/02-Installation-and-Configuration.md b/docs/02-Installation-and-Configuration.md index a37beee450..cd6d08d164 100644 --- a/docs/02-Installation-and-Configuration.md +++ b/docs/02-Installation-and-Configuration.md @@ -48,6 +48,7 @@ The configuration of BetonQuest is done mainly in _config.yml_ file. All options - `reversed_order` controls the chronological order of entries in the journal. By default the entries are ordered from newest to oldest. You can reverse it, but it will force players to click through a lot of pages to get to the latest entry. - `hide_date` hides the date of each entry. Set it to true if you don't want this functionality. - `full_main_page` makes the main page take always a full page. If you display a lot of information you should probably make this true. If you use main page only for small notifications, set it to false, so the entries can follow immediately. + - `show_separator` shows a separator between journal entries (default: true). Customize the separator in `messages.yml` with the key `journal_separator`. * `journal_colors` controls the colors used in the journal. It takes color codes without the `&` character. - `date.day` is a day number - `date.hour` is a hour number