Search in sources :

Example 1 with NamedLocationSerialiser

use of io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.NamedLocationSerialiser in project Nucleus by NucleusPowered.

the class ConfigurateHelper method setupCore.

private static TypeSerializerCollection setupCore(final INucleusServiceCollection serviceCollection, final ObjectMapper.Factory factory, final ConfigurationOptions options) {
    final TypeSerializerCollection.Builder typeSerializerCollection = options.serializers().childBuilder();
    // Custom type serialisers for Nucleus
    typeSerializerCollection.registerAnnotatedObjects(factory);
    typeSerializerCollection.register(TypeToken.get(Vector3d.class), new Vector3dTypeSerialiser());
    typeSerializerCollection.register(TypeToken.get(Pattern.class), new PatternTypeSerialiser());
    typeSerializerCollection.register(TypeToken.get(NucleusTextTemplate.class), new NucleusTextTemplateTypeSerialiser(serviceCollection.textTemplateFactory()));
    typeSerializerCollection.register(TypeToken.get(Instant.class), new InstantTypeSerialiser());
    typeSerializerCollection.register(TypeTokens.NAMED_LOCATION, new NamedLocationSerialiser());
    typeSerializerCollection.register(TypeTokens.LOCALE, new LocaleSerialiser());
    return typeSerializerCollection.build();
}
Also used : Pattern(java.util.regex.Pattern) InstantTypeSerialiser(io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.InstantTypeSerialiser) NamedLocationSerialiser(io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.NamedLocationSerialiser) LocaleSerialiser(io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.LocaleSerialiser) Vector3d(org.spongepowered.math.vector.Vector3d) PatternTypeSerialiser(io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.PatternTypeSerialiser) Vector3dTypeSerialiser(io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.Vector3dTypeSerialiser) Instant(java.time.Instant) NucleusTextTemplate(io.github.nucleuspowered.nucleus.api.text.NucleusTextTemplate) TypeSerializerCollection(org.spongepowered.configurate.serialize.TypeSerializerCollection) NucleusTextTemplateTypeSerialiser(io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.NucleusTextTemplateTypeSerialiser)

Aggregations

NucleusTextTemplate (io.github.nucleuspowered.nucleus.api.text.NucleusTextTemplate)1 InstantTypeSerialiser (io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.InstantTypeSerialiser)1 LocaleSerialiser (io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.LocaleSerialiser)1 NamedLocationSerialiser (io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.NamedLocationSerialiser)1 NucleusTextTemplateTypeSerialiser (io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.NucleusTextTemplateTypeSerialiser)1 PatternTypeSerialiser (io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.PatternTypeSerialiser)1 Vector3dTypeSerialiser (io.github.nucleuspowered.nucleus.core.configurate.typeserialisers.Vector3dTypeSerialiser)1 Instant (java.time.Instant)1 Pattern (java.util.regex.Pattern)1 TypeSerializerCollection (org.spongepowered.configurate.serialize.TypeSerializerCollection)1 Vector3d (org.spongepowered.math.vector.Vector3d)1