mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 03:27:37 +01:00
Fixed extension column appearing multiple times
This commit is contained in:
parent
ad48a016a3
commit
ef35312844
@ -34,7 +34,6 @@ import com.djrapitops.plan.utilities.html.icon.Family;
|
|||||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parsing utility for creating jQuery Datatables JSON for a Players Table.
|
* Parsing utility for creating jQuery Datatables JSON for a Players Table.
|
||||||
@ -70,11 +69,11 @@ public class PlayersTableJSONParser {
|
|||||||
// Data
|
// Data
|
||||||
this.players = players;
|
this.players = players;
|
||||||
this.extensionData = extensionData;
|
this.extensionData = extensionData;
|
||||||
extensionDescriptives = extensionData.values().stream()
|
|
||||||
.map(ExtensionTabData::getDescriptives)
|
extensionDescriptives = new ArrayList<>();
|
||||||
.flatMap(Collection::stream)
|
addExtensionDescriptives(extensionData);
|
||||||
.distinct().sorted((one, two) -> String.CASE_INSENSITIVE_ORDER.compare(one.getName(), two.getName()))
|
extensionDescriptives.sort((one, two) -> String.CASE_INSENSITIVE_ORDER.compare(one.getName(), two.getName()));
|
||||||
.collect(Collectors.toList());
|
|
||||||
// Settings
|
// Settings
|
||||||
this.maxPlayers = maxPlayers;
|
this.maxPlayers = maxPlayers;
|
||||||
this.activeMsThreshold = activeMsThreshold;
|
this.activeMsThreshold = activeMsThreshold;
|
||||||
@ -90,6 +89,18 @@ public class PlayersTableJSONParser {
|
|||||||
this.decimalFormatter = formatters.decimals();
|
this.decimalFormatter = formatters.decimals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addExtensionDescriptives(Map<UUID, ExtensionTabData> extensionData) {
|
||||||
|
Set<String> foundDescriptives = new HashSet<>();
|
||||||
|
for (ExtensionTabData tabData : extensionData.values()) {
|
||||||
|
for (ExtensionDescriptive descriptive : tabData.getDescriptives()) {
|
||||||
|
if (!foundDescriptives.contains(descriptive.getName())) {
|
||||||
|
extensionDescriptives.add(descriptive);
|
||||||
|
foundDescriptives.add(descriptive.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String toJSONString() {
|
public String toJSONString() {
|
||||||
String data = parseData();
|
String data = parseData();
|
||||||
String columnHeaders = parseColumnHeaders();
|
String columnHeaders = parseColumnHeaders();
|
||||||
|
Loading…
Reference in New Issue
Block a user