Skip to content
Permalink
Browse files

loottracker: fix order on client reload

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 1abadb0c9c36dddbd3ccdff83ec04eac4cac0c8c
@@ -37,6 +37,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -607,17 +608,17 @@ private LootTrackerItem buildLootTrackerItem(int itemId, int quantity)

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

trackerRecords.add(new LootTrackerRecord(record.getEventId(), "", drops));
}
return records.stream()
.sorted(Comparator.comparing(LootRecord::getTime))
.map(record ->
{
LootTrackerItem[] drops = record.getDrops().stream().map(itemStack ->
buildLootTrackerItem(itemStack.getId(), itemStack.getQty())
).toArray(LootTrackerItem[]::new);

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

/**

0 comments on commit 1abadb0

Please sign in to comment.
You can’t perform that action at this time.