Adds a KillDataComparator to list the KillData correctly and in the right order

This commit is contained in:
Fuzzlemann 2017-08-01 22:28:58 +02:00
parent 05c893b35c
commit 53cd34978b
2 changed files with 23 additions and 0 deletions

View File

@ -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;

View File

@ -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());
}
}