Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visitors_log.rb #60

Open
NigelThorne opened this issue Apr 30, 2017 · 1 comment
Open

visitors_log.rb #60

NigelThorne opened this issue Apr 30, 2017 · 1 comment

Comments

@NigelThorne
Copy link
Contributor

I tried to write a plugin in a file called visitors_log.rb (it could have been visitor_log.rb ) and a plugin called VisitorsLogPlugin. For some reason I couldn't get this to work in any way... finally I ended up removing all content and it still failed to load.
In the end I named it something different and it works fine. same code. different name

What are the limitations on names you can call your plugins?

Cheers
Nigel

@enebo
Copy link
Owner

enebo commented May 3, 2017

Yeah it took me a bit to remember how this works but there is no obvious naming issue I know of for this...unless you happen to be naming the plugin something that MAYBE is registered already via Spigot (if you happen to be using other Java plugins). Or perhaps you are loading multiple plugins across multiple threads (never really thought about people making user threads for that).

The way it works is a tiny bit wonky. We glob on plugins/*.rb and load all files in turn. If those files include Purugin::Plugin then it registers the class which includes it via Module#included. "registers" is the wonky part. It is saved via side-effect via global (since this happens before RubyPluginLoader is ready for it to be registered). Then immediately after it is loaded .new is called on it. It is likely somehow that name is blowing up lower within Java code itself and it is not a Purugin issue. Well it is in that it is crapping the bed and not telling you what went wrong, but I do not think Purugin is what is not loading the plugin.

If you can deduce it is some naming conflict with Java plugin then we can consider how we would deal with it:

  • Error message so we at least know there is a conflict
  • Adding some unique naming on our name so it will just load it with a slightly munged name

Of course I am just guessing at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants