plugin add_event/3, added polarity handling to input event