Skip to content

Commit

Permalink
Add weight to the mission slots (#601)
Browse files Browse the repository at this point in the history
* Let the mission slot be a weight

* Reverse order
  • Loading branch information
dlsf authored Feb 7, 2022
1 parent 26955d1 commit 06e80f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ private void resetIslandMissions() {
@Override
public void run() {
databaseManager.getIslandMissionTableManager().delete(
databaseManager.getIslandMissionTableManager().getEntries().stream().filter(islandMission ->
islandMission.getType() == Mission.MissionType.DAILY).collect(Collectors.toList()
)
databaseManager.getIslandMissionTableManager().getEntries().stream()
.filter(islandMission -> islandMission.getType() == Mission.MissionType.DAILY)
.collect(Collectors.toList())
);
Bukkit.getScheduler().runTask(IridiumSkyblock.getInstance(), () -> resetIslandMissions());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,12 +807,13 @@ private synchronized String getDailyIslandMission(@NotNull Island island, int in
* @return The daily missions
*/
public synchronized Map<String, Mission> getDailyIslandMissions(@NotNull Island island) {
Map<String, Mission> missions = new HashMap<>();
Map<String, Mission> missions = new LinkedHashMap<>();

IntStream.range(0, IridiumSkyblock.getInstance().getMissions().dailySlots.size())
.boxed()
.map(i -> getDailyIslandMission(island, i))
.forEach(mission ->
.sorted(Comparator.comparingInt(mission -> IridiumSkyblock.getInstance().getMissionsList().get(mission).getItem().slot))
.forEachOrdered(mission ->
missions.put(mission, IridiumSkyblock.getInstance().getMissionsList().get(mission))
);

Expand Down

0 comments on commit 06e80f7

Please sign in to comment.