From baf0cdbf56b4451e42a6ca27c8ee8396676acc57 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Mon, 10 Feb 2020 00:57:05 -0500 Subject: [PATCH] Use ascending order for the Quest Journal. Bump version number --- dist/pom.xml | 2 +- main/pom.xml | 2 +- main/src/main/java/me/blackvein/quests/Quester.java | 11 ++++++++--- pom.xml | 4 ++-- v1_8_R1/pom.xml | 2 +- v1_8_R2/pom.xml | 2 +- v1_8_R3/pom.xml | 2 +- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/dist/pom.xml b/dist/pom.xml index 905e43e13..3b8cda53b 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -5,7 +5,7 @@ me.blackvein.quests quests-parent - 3.8.6 + 3.8.7 quests-dist pom diff --git a/main/pom.xml b/main/pom.xml index 35ca4ec13..8592bdac2 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -4,7 +4,7 @@ me.blackvein.quests quests-parent - 3.8.6 + 3.8.7 quests-main diff --git a/main/src/main/java/me/blackvein/quests/Quester.java b/main/src/main/java/me/blackvein/quests/Quester.java index c86bc6672..1d7dd47ec 100644 --- a/main/src/main/java/me/blackvein/quests/Quester.java +++ b/main/src/main/java/me/blackvein/quests/Quester.java @@ -16,6 +16,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedList; @@ -27,6 +28,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; +import java.util.stream.Collectors; import org.bukkit.ChatColor; import org.bukkit.DyeColor; @@ -359,7 +361,10 @@ public class Quester { int currentLength = 0; int currentLines = 0; String page = ""; - for (Quest quest : currentQuests.keySet()) { + List sortedList = currentQuests.keySet().stream() + .sorted(Comparator.comparing(Quest::getName)) + .collect(Collectors.toList()); + for (Quest quest : sortedList) { if ((currentLength + quest.getName().length() > 240) || (currentLines + ((quest.getName().length() % 19) == 0 ? (quest.getName().length() / 19) : ((quest.getName().length() / 19) + 1))) > 13) { @@ -373,8 +378,8 @@ public class Quester { currentLength += quest.getName().length(); currentLines += (quest.getName().length() / 19); } - if (getObjectives(quest, false) != null) { - for (String obj : getObjectives(quest, false)) { + if (getCurrentObjectives(quest, false) != null) { + for (String obj : getCurrentObjectives(quest, false)) { // Length/Line check if ((currentLength + obj.length() > 240) || (currentLines + ((obj.length() % 19) == 0 ? (obj.length() / 19) : ((obj.length() / 19) + 1))) > 13) { diff --git a/pom.xml b/pom.xml index 22a677c15..da5135414 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ me.blackvein.quests quests-parent - 3.8.6 + 3.8.7 quests https://github.com/PikaMug/Quests/ - 3.8.6 + 3.8.7 UTF-8 1.8 1.8 diff --git a/v1_8_R1/pom.xml b/v1_8_R1/pom.xml index 368ebd029..cf9196c57 100644 --- a/v1_8_R1/pom.xml +++ b/v1_8_R1/pom.xml @@ -5,7 +5,7 @@ me.blackvein.quests quests-parent - 3.8.6 + 3.8.7 diff --git a/v1_8_R2/pom.xml b/v1_8_R2/pom.xml index 9f365710d..643b94ad1 100644 --- a/v1_8_R2/pom.xml +++ b/v1_8_R2/pom.xml @@ -5,7 +5,7 @@ me.blackvein.quests quests-parent - 3.8.6 + 3.8.7 diff --git a/v1_8_R3/pom.xml b/v1_8_R3/pom.xml index cab62c86c..834594234 100644 --- a/v1_8_R3/pom.xml +++ b/v1_8_R3/pom.xml @@ -5,7 +5,7 @@ me.blackvein.quests quests-parent - 3.8.6 + 3.8.7