You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An instance of Plugin is required to register an event listener. At the moment only one listener exists in IF: GuiListener, so I will exclusively use that in my examples. The Gui class has a static hasRegisteredListeners boolean variable that is used to register an event listener if one hasn't been registered yet. The plugin instance is the one passed into the Gui constructor. What happens if that plugin gets disabled? Even if we ignore the broken reload command and the even better PlugMan plugin, plugins are still disabled if they throw an exception in their onEnable(). If the plugin associated with IF's event listener is disabled, IF's event listener gets unregistered without IF knowing about it. I see three options:
don't rely on a real plugin, try to "mock" one for Bukkit (it's a hackish solution, but luckily only the server itself can have access to this "virtual" plugin instance)
listen to PluginDisableEvent, migrate to another plugin and register a new listener when it's called (this solution seems a bit complicated, could go wrong a thousand ways)
don't worry about this, since if a plugin gets disabled, something's wrong and IF can't make itself that much fool- and bugproof
I would be more than happy to implement and PR whatever we decide on (if it's not the "don't worry about this" option, of course). This is a place for arguments and counter-arguments.
The text was updated successfully, but these errors were encountered:
I'm not certain if this is really a problem. IF is meant to be shaded in the plugin and relocated. If multiple plugins use IF that exist on the same server, each of those would then therefore have their own instance of IF; as far as I'm aware, the data between these different shaded IFs is not shared. Each plugin that makes use of IF should therefore get their own listener, so the plugin that uses IF registers the event listener exclusively for their own guis. Of course this plugin could get disabled, but then only that plugin's even listener would get unregistered; any other plugins on the same server that make use of IF should still be fine, since those should still have their own registered listener for their guis. And if the plugin gets disabled, the plugin won't be running anymore and therefore shouldn't be able to make use of any guis.
Of course it is technically possible to register the first gui via a different plugin than your own by grabbing a different plugin instance (which is a very questionable choice on the developer's part in my opinion), so that may be something we could prevent from happening (although in my opinion not really needed).
An instance of
Plugin
is required to register an event listener. At the moment only one listener exists in IF:GuiListener
, so I will exclusively use that in my examples. TheGui
class has a statichasRegisteredListeners
boolean variable that is used to register an event listener if one hasn't been registered yet. The plugin instance is the one passed into theGui
constructor. What happens if that plugin gets disabled? Even if we ignore the broken reload command and the even better PlugMan plugin, plugins are still disabled if they throw an exception in theironEnable()
. If the plugin associated with IF's event listener is disabled, IF's event listener gets unregistered without IF knowing about it. I see three options:PluginDisableEvent
, migrate to another plugin and register a new listener when it's called (this solution seems a bit complicated, could go wrong a thousand ways)I would be more than happy to implement and PR whatever we decide on (if it's not the "don't worry about this" option, of course). This is a place for arguments and counter-arguments.
The text was updated successfully, but these errors were encountered: