add a change state function to plugins