Interface Trigger.Builder<C extends FilteredTriggerConfiguration>

    • Method Detail

      • typeSerializableConfig

        <T extends FilteredTriggerConfigurationTrigger.Builder<T> typeSerializableConfig​(io.leangen.geantyref.TypeToken<T> configClass)
        Sets the class for the FilteredTriggerConfiguration as a config serializable. This configuration will be constructed using Configurate (with TypeSerializers).

        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 FilteredTriggerConfigurationTrigger.Builder<T> typeSerializableConfig​(io.leangen.geantyref.TypeToken<T> configClass,
                                                                                           java.util.function.UnaryOperator<ConfigurationOptions> options)
        Sets the class for the FilteredTriggerConfiguration 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 class
        options - A callback that will receive options to modify
        Returns:
        This builder, for chaining
      • typeSerializableConfig

        <T extends FilteredTriggerConfigurationTrigger.Builder<T> typeSerializableConfig​(java.lang.Class<T> configClass)
        Sets the class for the FilteredTriggerConfiguration as a config serializable. This configuration will be constructed using Configurate (with TypeSerializers).

        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 FilteredTriggerConfigurationTrigger.Builder<T> typeSerializableConfig​(java.lang.Class<T> configClass,
                                                                                           java.util.function.UnaryOperator<ConfigurationOptions> options)
        Sets the class for the FilteredTriggerConfiguration 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 class
        options - A callback that will receive options to modify
        Returns:
        This builder, for chaining
      • jsonSerializableConfig

        <T extends FilteredTriggerConfigurationTrigger.Builder<T> jsonSerializableConfig​(java.lang.Class<T> configClass,
                                                                                           Gson gson)
        Sets the class for the FilteredTriggerConfiguration as a json serializable. This configuration will be constructed using the provided Gson instance.
        Type Parameters:
        T - The configuration type
        Parameters:
        configClass - The configuration class
        gson - The gson instance to use
        Returns:
        This builder, for chaining
      • jsonSerializableConfig

        <T extends FilteredTriggerConfigurationTrigger.Builder<T> jsonSerializableConfig​(java.lang.Class<T> configClass)
        Sets the class for the FilteredTriggerConfiguration as a json serializable. This configuration will be constructed using the default Gson instance.
        Type Parameters:
        T - The configuration type
        Parameters:
        configClass - The configuration class
        Returns:
        This builder, for chaining
      • listener

        Trigger.Builder<C> listener​(java.util.function.Consumer<CriterionEvent.Trigger<C>> eventListener)
        Adds the Consumer to handle the triggers. If no handler is provided then will the result of the trigger always be true, which results in triggering the Criterion.

        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 the Trigger.
        Parameters:
        name - The name
        Returns:
        This builder, for chaining