How to write plugin which fixes certain stanzas from clients?

Hello! I want clear documentation on writing plugins for Openfire: specifically, I need to replace stanzas from clients. Example: the client sends , this comes first to the plugin, which fixes invisible to unavailable, and then the corrected line goes to the openfire server.
if this plugin can be written in NodeJS, I would be very happy.

Openfire plugins are all written in Java, so you’ll be limited to that. A plugin that operates on incoming traffic can be developed using the PacketInterceptor API. That will allow you to ‘intercept’ the data prior to processing.