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
This commit is contained in:
dekvall
2019-08-10 12:23:20 +02:00
parent ef4c628068
commit 1abadb0c9c

View File

@@ -37,6 +37,7 @@ import java.time.Instant;
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 @@ public class LootTrackerPlugin extends Plugin
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);
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);
trackerRecords.add(new LootTrackerRecord(record.getEventId(), "", drops));
}
return trackerRecords;
return new LootTrackerRecord(record.getEventId(), "", drops);
})
.collect(Collectors.toCollection(ArrayList::new));
}
/**