mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-26 02:57:52 +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 java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Parsing utility for creating jQuery Datatables JSON for a Players Table.
|
||||
@ -70,11 +69,11 @@ public class PlayersTableJSONParser {
|
||||
// Data
|
||||
this.players = players;
|
||||
this.extensionData = extensionData;
|
||||
extensionDescriptives = extensionData.values().stream()
|
||||
.map(ExtensionTabData::getDescriptives)
|
||||
.flatMap(Collection::stream)
|
||||
.distinct().sorted((one, two) -> String.CASE_INSENSITIVE_ORDER.compare(one.getName(), two.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
extensionDescriptives = new ArrayList<>();
|
||||
addExtensionDescriptives(extensionData);
|
||||
extensionDescriptives.sort((one, two) -> String.CASE_INSENSITIVE_ORDER.compare(one.getName(), two.getName()));
|
||||
|
||||
// Settings
|
||||
this.maxPlayers = maxPlayers;
|
||||
this.activeMsThreshold = activeMsThreshold;
|
||||
@ -90,6 +89,18 @@ public class PlayersTableJSONParser {
|
||||
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() {
|
||||
String data = parseData();
|
||||
String columnHeaders = parseColumnHeaders();
|
||||
|
Loading…
Reference in New Issue
Block a user