Interface Trigger.Builder<C extends FilteredTriggerConfiguration>
-
- Type Parameters:
C
- The configuration type
- All Superinterfaces:
Buildable.Builder<Trigger<C>>
,Builder<Trigger<C>,Trigger.Builder<C>>
,CopyableBuilder<Trigger<C>,Trigger.Builder<C>>
,ResettableBuilder<Trigger<C>,Trigger.Builder<C>>
,ResourceKeyedBuilder<Trigger<C>,Trigger.Builder<C>>
- Enclosing interface:
- Trigger<C extends FilteredTriggerConfiguration>
public static interface Trigger.Builder<C extends FilteredTriggerConfiguration> extends ResourceKeyedBuilder<Trigger<C>,Trigger.Builder<C>>, CopyableBuilder<Trigger<C>,Trigger.Builder<C>>
A builder to createTrigger
s.
-
-
Method Summary
-
Methods inherited from interface net.kyori.adventure.util.Buildable.Builder
build
-
Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
Methods inherited from interface org.spongepowered.api.util.ResourceKeyedBuilder
key
-
-
-
-
Method Detail
-
dataSerializableConfig
<T extends FilteredTriggerConfiguration & DataSerializable> Trigger.Builder<T> dataSerializableConfig(Class<T> dataConfigClass)
Sets the class for theFilteredTriggerConfiguration
as aDataSerializable
. The configuration will be constructed using theDataBuilder
that is registered for theDataSerializable
.- Type Parameters:
T
- The configuration type- Parameters:
dataConfigClass
- The configuration class- Returns:
- This builder, for chaining
-
typeSerializableConfig
<T extends FilteredTriggerConfiguration> Trigger.Builder<T> typeSerializableConfig(io.leangen.geantyref.TypeToken<T> configClass)
Sets the class for theFilteredTriggerConfiguration
as a config serializable. This configuration will be constructed using Configurate (withTypeSerializer
s).By default, the configuration will be loaded with Sponge-default options, with serializers as defined in
ConfigManager.serializers()
.- Type Parameters:
T
- The configuration type- Parameters:
configClass
- The configuration class- Returns:
- This builder, for chaining
-
typeSerializableConfig
<T extends FilteredTriggerConfiguration> Trigger.Builder<T> typeSerializableConfig(io.leangen.geantyref.TypeToken<T> configClass, ConfigurationOptions options)
Sets the class for theFilteredTriggerConfiguration
as a config serializable. This configuration will be constructed using Configurate (withTypeSerializer
s) with a specificTypeSerializerCollection
instead of the global one.- Type Parameters:
T
- The configuration type- Parameters:
configClass
- The configuration classoptions
- The configuration options that control loading of data- Returns:
- This builder, for chaining
-
typeSerializableConfig
<T extends FilteredTriggerConfiguration> Trigger.Builder<T> typeSerializableConfig(io.leangen.geantyref.TypeToken<T> configClass, UnaryOperator<ConfigurationOptions> options)
Sets the class for theFilteredTriggerConfiguration
as a config serializable. This configuration will be constructed using Configurate with specific options.The configuration will be loaded with the returned derivation of Sponge-default options, with serializers as defined in
ConfigManager.serializers()
.- Type Parameters:
T
- The configuration type- Parameters:
configClass
- The configuration classoptions
- A callback that will receive options to modify- Returns:
- This builder, for chaining
-
typeSerializableConfig
<T extends FilteredTriggerConfiguration> Trigger.Builder<T> typeSerializableConfig(Class<T> configClass)
Sets the class for theFilteredTriggerConfiguration
as a config serializable. This configuration will be constructed using Configurate (withTypeSerializer
s).By default, the configuration will be loaded with Sponge-default options, with serializers as defined in
ConfigManager.serializers()
.- Type Parameters:
T
- The configuration type- Parameters:
configClass
- The configuration class- Returns:
- This builder, for chaining
-
typeSerializableConfig
<T extends FilteredTriggerConfiguration> Trigger.Builder<T> typeSerializableConfig(Class<T> configClass, ConfigurationOptions options)
Sets the class for theFilteredTriggerConfiguration
as a config serializable. This configuration will be constructed using Configurate (withTypeSerializer
s) with a specificTypeSerializerCollection
instead of the global one.- Type Parameters:
T
- The configuration type- Parameters:
configClass
- The configuration classoptions
- The configuration options that control loading of data- Returns:
- This builder, for chaining
-
typeSerializableConfig
<T extends FilteredTriggerConfiguration> Trigger.Builder<T> typeSerializableConfig(Class<T> configClass, UnaryOperator<ConfigurationOptions> options)
Sets the class for theFilteredTriggerConfiguration
as a config serializable. This configuration will be constructed using Configurate with customized options based off of the Sponge-default options.The configuration will be loaded with the returned derivation of Sponge-default options, with serializers as defined in
ConfigManager.serializers()
.- Type Parameters:
T
- The configuration type- Parameters:
configClass
- The configuration classoptions
- A callback that will receive options to modify- Returns:
- This builder, for chaining
-
jsonSerializableConfig
<T extends FilteredTriggerConfiguration> Trigger.Builder<T> jsonSerializableConfig(Class<T> configClass, Gson gson)
Sets the class for theFilteredTriggerConfiguration
as a json serializable. This configuration will be constructed using the providedGson
instance.- Type Parameters:
T
- The configuration type- Parameters:
configClass
- The configuration classgson
- The gson instance to use- Returns:
- This builder, for chaining
-
jsonSerializableConfig
<T extends FilteredTriggerConfiguration> Trigger.Builder<T> jsonSerializableConfig(Class<T> configClass)
Sets the class for theFilteredTriggerConfiguration
as a json serializable. This configuration will be constructed using the defaultGson
instance.- Type Parameters:
T
- The configuration type- Parameters:
configClass
- The configuration class- Returns:
- This builder, for chaining
-
emptyConfig
Trigger.Builder<FilteredTriggerConfiguration.Empty> emptyConfig()
Sets the class for theFilteredTriggerConfiguration
to useFilteredTriggerConfiguration.Empty
.- Returns:
- This builder, for chaining
-
listener
Trigger.Builder<C> listener(Consumer<CriterionEvent.Trigger<C>> eventListener)
Adds theConsumer
to handle the triggers. If no handler is provided then will the result of the trigger always betrue
, which results in triggering theCriterion
.The
Cause
of the event should be used to determine whether the configuration matches the requirements to trigger the criterion.- Parameters:
eventListener
- The event listener- Returns:
- This builder, for chaining
-
name
Trigger.Builder<C> name(String name)
Sets the name of theTrigger
.- Parameters:
name
- The name- Returns:
- This builder, for chaining
-
-