Skip to content

Commit

Permalink
loottracker: fix order on client reload
Browse files Browse the repository at this point in the history
The panel is currently rebuilt with the earliest loots at the top.
For the sake of consistency, it should be the other way around.

Closes #9575
  • Loading branch information
dekvall committed Aug 10, 2019
1 parent ef4c628 commit 1abadb0
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
Expand Down Expand Up @@ -607,17 +608,17 @@ private static Collection<GameItem> toGameItems(Collection<ItemStack> items)


private Collection<LootTrackerRecord> convertToLootTrackerRecord(final Collection<LootRecord> records) private Collection<LootTrackerRecord> convertToLootTrackerRecord(final Collection<LootRecord> records)
{ {
Collection<LootTrackerRecord> trackerRecords = new ArrayList<>(); return records.stream()
for (LootRecord record : records) .sorted(Comparator.comparing(LootRecord::getTime))
{ .map(record ->
LootTrackerItem[] drops = record.getDrops().stream().map(itemStack -> {
buildLootTrackerItem(itemStack.getId(), itemStack.getQty()) LootTrackerItem[] drops = record.getDrops().stream().map(itemStack ->
).toArray(LootTrackerItem[]::new); buildLootTrackerItem(itemStack.getId(), itemStack.getQty())

).toArray(LootTrackerItem[]::new);
trackerRecords.add(new LootTrackerRecord(record.getEventId(), "", drops));
}


return trackerRecords; return new LootTrackerRecord(record.getEventId(), "", drops);
})
.collect(Collectors.toCollection(ArrayList::new));
} }


/** /**
Expand Down

0 comments on commit 1abadb0

Please sign in to comment.