enebo / Purugin

Ruby Minecraft Plugin support on top of bukkit
238 stars 32 forks source link

Creating a "help" plugin fails #1

Closed ghost closed 13 years ago

ghost commented 13 years ago

I created a plugin and got this

13:17:39 [SEVERE] NameError: uninitialized constant Purugin::Colors const_missing at org/jruby/RubyModule.java:2569 HelpPlugin at /Volumes/HD-II/humza/MinecraftServer/plugins/help.rb:2 (root) at /Volumes/HD-II/humza/MinecraftServer/plugins/help.rb:1 on_load at /purugin.rb:21 onLoad at /purugin/base.rb:44

13:17:39 [SEVERE] NativeException: org.jruby.embed.EvalFailedException: (NameError) uninitialized constant Purugin::Colors on_load at /purugin.rb:21 onLoad at /purugin/base.rb:44

13:17:39 [SEVERE] Native Exception: 'class org.jruby.embed.EvalFailedException'; Message: (NameError) uninitialized constant Purugin::Colors; StackTrace: org.jruby.embed.EvalFailedException: (NameError) uninitialized constant Purugin::Colors at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127) at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1231) at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1262) at org.purugin.PuruginPlugin.executeScript(PuruginPlugin.java:45) at org.purugin.PuruginPlugin.executeScriptAt(PuruginPlugin.java:53) at org.purugin.RubyPluginLoader.loadPlugin(RubyPluginLoader.java:33) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:213) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136) Caused by: org.jruby.exceptions.RaiseException: (NameError) uninitialized constant Purugin::Colors initializing PuruginPlugin v0.1 (Is it up to date?) org.jruby.embed.InvokeFailedException: Native Exception: 'class org.jruby.embed.EvalFailedException'; Message: (NameError) uninitialized constant Purugin::Colors; StackTrace: org.jruby.embed.EvalFailedException: (NameError) uninitialized constant Purugin::Colors at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127) at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1231) at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1262) at org.purugin.PuruginPlugin.executeScript(PuruginPlugin.java:45) at org.purugin.PuruginPlugin.executeScriptAt(PuruginPlugin.java:53) at org.purugin.RubyPluginLoader.loadPlugin(RubyPluginLoader.java:33) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:213) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136) Caused by: org.jruby.exceptions.RaiseException: (NameError) uninitialized constant Purugin::Colors

at org.jruby.embed.internal.EmbedRubyObjectAdapterImpl.call(EmbedRubyObjectAdapterImpl.java:406)
at org.jruby.embed.internal.EmbedRubyObjectAdapterImpl.callMethod(EmbedRubyObjectAdapterImpl.java:331)
at org.jruby.embed.ScriptingContainer.callMethod(ScriptingContainer.java:1334)
at org.purugin.PuruginPlugin.onLoad(PuruginPlugin.java:40)
at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:146)
at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:110)
at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:51)
at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:133)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:337)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)

Caused by: org.jruby.exceptions.RaiseException: Native Exception: 'class org.jruby.embed.EvalFailedException'; Message: (NameError) uninitialized constant Purugin::Colors; StackTrace: org.jruby.embed.EvalFailedException: (NameError) uninitialized constant Purugin::Colors at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127) at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1231) at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1262) at org.purugin.PuruginPlugin.executeScript(PuruginPlugin.java:45) at org.purugin.PuruginPlugin.executeScriptAt(PuruginPlugin.java:53) at org.purugin.RubyPluginLoader.loadPlugin(RubyPluginLoader.java:33) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:213) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136) Caused by: org.jruby.exceptions.RaiseException: (NameError) uninitialized constant Purugin::Colors

Caused by: org.jruby.embed.EvalFailedException: (NameError) uninitialized constant Purugin::Colors at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127) at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1231) at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1262) at org.purugin.PuruginPlugin.executeScript(PuruginPlugin.java:45) at org.purugin.PuruginPlugin.executeScriptAt(PuruginPlugin.java:53) at org.purugin.RubyPluginLoader.loadPlugin(RubyPluginLoader.java:33) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:213) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136) Caused by: org.jruby.exceptions.RaiseException: (NameError) uninitialized constant Purugin::Colors

enebo commented 13 years ago

I have a fix for this on master already, but I have not pushed a new Purugin.jar (will do that tonight). If you want to build and test for me then you can confirm it is fixed. Otherwise you can try tomorrow and let me know.

ghost commented 13 years ago

Ok, I can wait until tomorrow; then I'll try.

ghost commented 13 years ago

Is the latest commit the fix? I pulled it into my plugins directory, but it's still throwing a jRuby exception about 'description' being an undefined method.

enebo commented 13 years ago

Are you positive you have the latest Purugin.jar in your plugins directory?

git pull; diff Purugin.jar ../minecraft_or_whereever_it_is/plugins/Purugin.jar

I will figure out how to make the versioning print out so this can be an easier process, but this should at least figure out if you are running what I last updated.

ghost commented 13 years ago

Some further investigation by copying in the examples directory reveals that the update JAR works with only one of the plugin API formats, the one used in motd.rb and player_joined.rb. The one detailed in the README fails.

enebo commented 13 years ago

hmmm, very strange. I will take a look this evening and see if I can figure this out. I am confused why it works on my machine.

ghost commented 13 years ago

I think I've figured it out: Purugin is conflicting with plugins that have Jython bindings, so JRuby needs to stay isolated from the Jython plugins. I've worked out how to make it work with RVM, so now there aren't any problems.

enebo commented 13 years ago

Can you tell me which code is conflicting? I am interested in understanding this better because JRuby and Jython should work fine together (my first guess would be a conflict with jnr-posix since they use that project as well).

ghost commented 13 years ago

A look at the logs shows this:

 2011-08-18 09:59:24 [INFO] Enabling Python Plugin loader.
 2011-08-18 09:59:28 [SEVERE] TypeError: superclass mismatch for class CMD
          Command at /Volumes/HD-II/humza/MinecraftServer/plugins/commands.rb:10
  CommandsPlugin at /Volumes/HD-II/humza/MinecraftServer/plugins/commands.rb:9
           (root) at /Volumes/HD-II/humza/MinecraftServer/plugins/commands.rb:3

 2011-08-18 09:59:28 [SEVERE] Error occurred while enabling PythonLoader v0.1 (Is it up to date?): (TypeError)
superclass mismatch for class CMD
org.jruby.embed.EvalFailedException: (TypeError) superclass mismatch for class CMD
    at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127)
at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1231)
at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1262)
at org.purugin.PuruginPlugin.executeScript(PuruginPlugin.java:45)
at org.purugin.PuruginPlugin.executeScriptAt(PuruginPlugin.java:53)
at org.purugin.RubyPluginLoader.loadPlugin(RubyPluginLoader.java:33)
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:213)
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
at com.master.bukkit.python.PythonLoader.onEnable(PythonLoader.java:44)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:126)
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:885)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:278)
at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:178)
at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:161)
at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:286)
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:273)
at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:149)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:337)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
Caused by: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class CMD

From this excerpt, it looks like the PythonLoader is trying to access some of the same things that Purugin is.

Also, I've noticed a few other bugs in general with the plugin; I'll look into those so I can send a pull request with some fixes. For example, there are several problems with the Commands plugin that make it conflict with the built-in Minecraft commands. However, they seem like they should be fixable.

Sorry if it seems like I'm complaining a lot; I've just been running a private server with all my plugins being written in JRuby or Clojure and I've been finding your plugin quite useful.

enebo commented 13 years ago

Thanks for digging in! I am really confused how CMD could be conflicting with Python loader. It seems like the python loader is reloading all the classes...but with the Ruby loading mechanism.

Cool re/ plugins command. Please send pull requests and knowledge my way :)