Skip to content

Inconvenient to set values in a Propery Listener/ActionΒ #36

@My-Name-Is-Jeff

Description

@My-Name-Is-Jeff

As seen here (implementation still has the same behavior in the current version of Vigilance), the value of the field is set after the listener is called:

https://github.com/Sk1erLLC/Vigilance/blob/553f6cb8612101ecddaa1fac59b171c1e81a0612/src/main/kotlin/club/sk1er/vigilance/data/PropertyData.kt#L29-L32

This means you cannot directly set any given value in the listener, because it will be overwritten right after the action has been completed

Because of this, to set the same field as the one called in the listener to a different value, you must wait until after the setValue function is completed before calling your own code

Example:

https://github.com/Skytils/SkytilsMod/blob/5aea845da5ecfe8f94a345dab4c15240e2e19096/src/main/kotlin/skytils/skytilsmod/core/Config.kt#L2397

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions