Merge pull request #9585 from dekvall/lootracker-order
Fix loot tracker order on client reload
This commit is contained in:
@@ -378,7 +378,7 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
void add(final String eventName, final int actorLevel, LootTrackerItem[] items)
|
void add(final String eventName, final int actorLevel, LootTrackerItem[] items)
|
||||||
{
|
{
|
||||||
final String subTitle = actorLevel > -1 ? "(lvl-" + actorLevel + ")" : "";
|
final String subTitle = actorLevel > -1 ? "(lvl-" + actorLevel + ")" : "";
|
||||||
final LootTrackerRecord record = new LootTrackerRecord(eventName, subTitle, items, System.currentTimeMillis());
|
final LootTrackerRecord record = new LootTrackerRecord(eventName, subTitle, items);
|
||||||
records.add(record);
|
records.add(record);
|
||||||
LootTrackerBox box = buildBox(record);
|
LootTrackerBox box = buildBox(record);
|
||||||
if (box != null)
|
if (box != null)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import java.time.Instant;
|
|||||||
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;
|
||||||
@@ -611,17 +612,17 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
|
|
||||||
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, -1));
|
return new LootTrackerRecord(record.getEventId(), "", drops);
|
||||||
}
|
})
|
||||||
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
return trackerRecords;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ class LootTrackerRecord
|
|||||||
private final String title;
|
private final String title;
|
||||||
private final String subTitle;
|
private final String subTitle;
|
||||||
private final LootTrackerItem[] items;
|
private final LootTrackerItem[] items;
|
||||||
private final long timestamp;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this record matches specified id
|
* Checks if this record matches specified id
|
||||||
|
|||||||
Reference in New Issue
Block a user