Not a developer and as far as I know the plugin system is not yet fully implemented, so my suggestion is to take a look at the code other developers used for their plugins.
Just search github for "osTicket" and you'll find several plugin repos like these:
https://github.com/berezuev/osticket-spreader
https://github.com/kevinoconnor7/osTicket-auth-cas
And several more.
Beside you could also open an issue/pull request regarding your plugin over at github at the official plugin repo to get help with your code from the devs:
https://github.com/osTicket/core-plugins
Cheers
Michael