Fixed data combining for Extension tabs

- All aggregate data now displayed properly
This commit is contained in:
Rsl1122 2019-04-15 08:45:46 +03:00
parent 0ea9389a9b
commit cb6c8affa3
2 changed files with 18 additions and 16 deletions

View File

@ -113,6 +113,22 @@ public class ExtensionTabData implements Comparable<ExtensionTabData> {
this.stringData.putAll(other.stringData); this.stringData.putAll(other.stringData);
this.tableData.addAll(other.tableData); this.tableData.addAll(other.tableData);
createOrderingList();
}
private void createOrderingList() {
List<ExtensionDescriptive> descriptives = new ArrayList<>();
booleanData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
doubleData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
percentageData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
numberData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
stringData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
order = descriptives.stream().sorted()
.map(ExtensionDescriptive::getName)
.distinct()// Method names are usually different, but in case someone had same method name with different parameters.
.collect(Collectors.toList());
} }
public static class Factory { public static class Factory {
@ -153,22 +169,8 @@ public class ExtensionTabData implements Comparable<ExtensionTabData> {
return this; return this;
} }
private void createOrderingList() {
List<ExtensionDescriptive> descriptives = new ArrayList<>();
data.booleanData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
data.doubleData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
data.percentageData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
data.numberData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
data.stringData.values().stream().map(ExtensionData::getDescriptive).forEach(descriptives::add);
data.order = descriptives.stream().sorted()
.map(ExtensionDescriptive::getName)
.distinct()// Method names are usually different, but in case someone had same method name with different parameters.
.collect(Collectors.toList());
}
public ExtensionTabData build() { public ExtensionTabData build() {
createOrderingList(); data.createOrderingList();
Collections.sort(data.tableData); Collections.sort(data.tableData);
return data; return data;
} }

View File

@ -2,7 +2,7 @@ dependencies {
compile project(path: ":api") compile project(path: ":api")
compile "com.djrapitops:Extension-AdvancedAchievements:1.1-R0.2" compile "com.djrapitops:Extension-AdvancedAchievements:1.1-R0.2"
compile "com.djrapitops:Extension-AdvancedBan:2.1.5-R0.5" compile "com.djrapitops:Extension-AdvancedBan:2.1.5-R0.5"
compile "com.djrapitops:Extension-ASkyBlock:3.0.9.4-R0.1" compile "com.djrapitops:Extension-ASkyBlock:3.0.9.4-R0.2"
compile "com.djrapitops:Extension-BanManager:5.15.0-R0.4" compile "com.djrapitops:Extension-BanManager:5.15.0-R0.4"
compile "com.djrapitops:Extension-CoreProtect:2.16.0-R0.2" compile "com.djrapitops:Extension-CoreProtect:2.16.0-R0.2"
compile "com.djrapitops:Extension-DiscordSRV:1.16.6-R0.2" compile "com.djrapitops:Extension-DiscordSRV:1.16.6-R0.2"