Thats not how PMPM works. Although its not a bad idea. How PMPM currently works is /download <pluginname> and it downloads that plugin from Poggit.
Nobody will trust you with their FTP and RCON. Have you ever seen any online MySQL clients (public-hosted ones, not self-hosted ones like phpMyAdmin)? No. I forgot to emphasize, It is discouraged that you change the content of a running phar file. You should not change the contents of a loaded plugin when the server is running. Therefore, I don't think a plugin as a plugin manager is a good idea.
Good point . Updates will be a feature. (/update <plugin> or /updateall). Why is it discouraged to edit running phars? They are already in memory when the server starts so editing them should not affect anything, right?
Wait do you mean that while PMPM is updating the plugin a method on that plugin gets called but it wouldn't exist at that moment?
PocketMine uses a JIT class loader. Unless the class is needed, it won't get loaded. So for example, if a plugin creates a DisableTask when it is disabled, and the class is not used anywhere else, PocketMine would attempt to load such class, but if you have already modified the phar, the file can no longer be loaded. This may lead to severe consequences, because it will crash, and some plugin data may not be saved.
No. Nothing inside the context of a plugin. You can of course find a way to execute it after server stops, e.g. use a cron job, but that's definitely a bad idea. Or you can register_shutdown_function, but that's unreliable.
What about writing to the plugin and the restarting the server afterwards? That would ensure everything worked right?
What do you mean by "writing to the plugin and the restarting the server afterwards"? Isn't this what we are talking about?
I thought you meant simply editing the running phar and not restarting it. I meant editing the phar and then restarting the server immediatly afterwards.
Your best bet would be to check which plugins need to be updated, disable them, install the updated phar and then enable them or reload the server.
Did you notice that I keep mentioning disable? Even if you restart the server immediately afterwards, you still have to let that plugin disable first. Of course you can disable that plugin before writing the phar, but look at that comic. You are destroying code that is already loaded, which is always bad even if it should not happen.