Search in sources :

Example 1 with Accessory

use of org.lanternpowered.server.extra.accessory.Accessory in project LanternServer by LanternPowered.

the class AccessoryRegistryModule method getCatalogMappings.

@Override
public List<CatalogMappingData> getCatalogMappings() {
    final ImmutableList.Builder<CatalogMappingData> mappingData = ImmutableList.builder();
    mappingData.addAll(super.getCatalogMappings());
    final ImmutableMap.Builder<String, Accessory> topHatMappings = ImmutableMap.builder();
    getAll().stream().filter(accessory -> accessory instanceof TopHat).forEach(accessory -> topHatMappings.put(accessory.getName().replace("_top_hat", ""), accessory));
    mappingData.add(new CatalogMappingData(TopHats.class, topHatMappings.build()));
    return mappingData.build();
}
Also used : List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) PluginCatalogRegistryModule(org.lanternpowered.server.game.registry.PluginCatalogRegistryModule) DyeColors(org.spongepowered.api.data.type.DyeColors) ImmutableMap(com.google.common.collect.ImmutableMap) TopHats(org.lanternpowered.server.extra.accessory.TopHats) RegistrationDependency(org.spongepowered.api.registry.util.RegistrationDependency) CatalogMappingData(org.lanternpowered.server.game.registry.CatalogMappingData) TopHat(org.lanternpowered.server.extra.accessory.TopHat) DyeColorRegistryModule(org.lanternpowered.server.game.registry.type.data.DyeColorRegistryModule) LanternTopHat(org.lanternpowered.server.extra.accessory.LanternTopHat) Accessory(org.lanternpowered.server.extra.accessory.Accessory) TopHat(org.lanternpowered.server.extra.accessory.TopHat) LanternTopHat(org.lanternpowered.server.extra.accessory.LanternTopHat) Accessory(org.lanternpowered.server.extra.accessory.Accessory) ImmutableList(com.google.common.collect.ImmutableList) TopHats(org.lanternpowered.server.extra.accessory.TopHats) CatalogMappingData(org.lanternpowered.server.game.registry.CatalogMappingData) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 List (java.util.List)1 Accessory (org.lanternpowered.server.extra.accessory.Accessory)1 LanternTopHat (org.lanternpowered.server.extra.accessory.LanternTopHat)1 TopHat (org.lanternpowered.server.extra.accessory.TopHat)1 TopHats (org.lanternpowered.server.extra.accessory.TopHats)1 CatalogMappingData (org.lanternpowered.server.game.registry.CatalogMappingData)1 PluginCatalogRegistryModule (org.lanternpowered.server.game.registry.PluginCatalogRegistryModule)1 DyeColorRegistryModule (org.lanternpowered.server.game.registry.type.data.DyeColorRegistryModule)1 DyeColors (org.spongepowered.api.data.type.DyeColors)1 RegistrationDependency (org.spongepowered.api.registry.util.RegistrationDependency)1