I found that AmpMenus needs to be included in the jar of every plugin which depends on it, which may cause unexpected results when there're multiple plugins using AmpMenus. Therefore AmpMenus should be a standalone plugin.
The reason is that the server only load either one class when there're two or more same classes, in order to allow cross-plugin classes share.
That means, for example, your MenuListener, may not work properly. Suppose we have plugins A and B, and they both depends on MenuListener. And the server loaded MenuListener in plugin A. Then when A and B were being enabled, they both invoked MenuListener.getInstance().register(this);
. What's next? Because MenuListener only has one instance and it only store one plugin instance, either A or B would be replaced by the other.
This can be proved by writing to simple plugins which both depend on MenuListener and contain the following in their main classes:
MenuListener.getInstance().register(this);
getLogger().info(String.valueOf(MenuListener.getInstance().isRegistered(this)));