mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Adds a KillDataComparator to list the KillData correctly and in the right order
This commit is contained in:
parent
05c893b35c
commit
53cd34978b
@ -6,7 +6,9 @@ import main.java.com.djrapitops.plan.data.KillData;
|
||||
import main.java.com.djrapitops.plan.ui.html.Html;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.comparators.KillDataComparator;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -32,6 +34,10 @@ public class KillsTableCreator {
|
||||
html.append(Html.TABLELINE_3.parse(Html.KILLDATA_NONE.parse(), "", ""));
|
||||
} else {
|
||||
int i = 0;
|
||||
|
||||
killData.sort(new KillDataComparator());
|
||||
Collections.reverse(killData);
|
||||
|
||||
for (KillData kill : killData) {
|
||||
if (i >= 20) {
|
||||
break;
|
||||
|
@ -0,0 +1,17 @@
|
||||
package main.java.com.djrapitops.plan.utilities.comparators;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.KillData;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* @author Fuzzlemann
|
||||
*/
|
||||
public class KillDataComparator implements Comparator<KillData> {
|
||||
|
||||
@Override
|
||||
public int compare(KillData o1, KillData o2) {
|
||||
return Long.compare(o1.getDate(), o2.getDate());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user