Interface Trigger.Builder<C extends FilteredTriggerConfiguration>
-
- Type Parameters:
C
- The configuration type
- All Superinterfaces:
AbstractBuilder<Trigger<C>>
,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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends FilteredTriggerConfiguration & DataSerializable>
Trigger.Builder<T>dataSerializableConfig(java.lang.Class<T> dataConfigClass)
Sets the class for theFilteredTriggerConfiguration
as aDataSerializable
.Trigger.Builder<FilteredTriggerConfiguration.Empty>
emptyConfig()
Sets the class for theFilteredTriggerConfiguration
to useFilteredTriggerConfiguration.Empty
.<T extends FilteredTriggerConfiguration>
Trigger.Builder<T>jsonSerializableConfig(java.lang.Class<T> configClass)
Sets the class for theFilteredTriggerConfiguration
as a json serializable.<T extends FilteredTriggerConfiguration>
Trigger.Builder<T>jsonSerializableConfig(java.lang.Class<T> configClass, Gson gson)
Sets the class for theFilteredTriggerConfiguration
as a json serializable.Trigger.Builder<C>
listener(java.util.function.Consumer<CriterionEvent.Trigger<C>> eventListener)
Adds theConsumer
to handle the triggers.Trigger.Builder<C>
name(java.lang.String name)
Sets the name of theTrigger
.<T extends FilteredTriggerConfiguration>
Trigger.Builder<T>typeSerializableConfig(io.leangen.geantyref.TypeToken<T> configClass)
Sets the class for theFilteredTriggerConfiguration
as a config serializable.<T extends FilteredTriggerConfiguration>
Trigger.Builder<T>typeSerializableConfig(io.leangen.geantyref.TypeToken<T> configClass, java.util.function.UnaryOperator<ConfigurationOptions> options)
Sets the class for theFilteredTriggerConfiguration
as a config serializable.<T extends FilteredTriggerConfiguration>
Trigger.Builder<T>typeSerializableConfig(io.leangen.geantyref.TypeToken<T> configClass, ConfigurationOptions options)
Sets the class for theFilteredTriggerConfiguration
as a config serializable.<T extends FilteredTriggerConfiguration>
Trigger.Builder<T>typeSerializableConfig(java.lang.Class<T> configClass)
Sets the class for theFilteredTriggerConfiguration
as a config serializable.<T extends FilteredTriggerConfiguration>
Trigger.Builder<T>typeSerializableConfig(java.lang.Class<T> configClass, java.util.function.UnaryOperator<ConfigurationOptions> options)
Sets the class for theFilteredTriggerConfiguration
as a config serializable.<T extends FilteredTriggerConfiguration>
Trigger.Builder<T>typeSerializableConfig(java.lang.Class<T> configClass, ConfigurationOptions options)
Sets the class for theFilteredTriggerConfiguration
as a config serializable.-
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(java.lang.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, java.util.function.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(java.lang.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(java.lang.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(java.lang.Class<T> configClass, java.util.function.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(java.lang.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(java.lang.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(java.util.function.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(java.lang.String name)
Sets the name of theTrigger
.- Parameters:
name
- The name- Returns:
- This builder, for chaining
-
-