enebo / Purugin

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

Can't get TagAPI to load #34

Closed NigelThorne closed 12 years ago

NigelThorne commented 12 years ago

My plugin https://gist.github.com/3847484 tries to hook into the TagAPI plugins events... but I get errors.

19:02:18 [SEVERE] NameError: cannot load Java class org.kitteh.tag.TagAPI for_name at org/jruby/javasupport/JavaClass.java:1206 get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34 java_import at jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/jruby/java/core_ext/object.rb:45 map at org/jruby/RubyArray.java:2350 java_import at jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/jruby/java/core_ext/object.rb:41 import at jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/jruby/java/core_ext/module.rb:53 Event at /home/nigel/projects/4giggles/minecraftserver/plugins/PurpleOpPlugin.rb:11 Purugin at /home/nigel/projects/4giggles/minecraftserver/plugins/PurpleOpPlugin.rb:5 (root) at /home/nigel/projects/4giggles/minecraftserver/plugins/PurpleOpPlugin.rb:4 load_plugin at jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/purugin/change_listener.rb:33 start_plugin at jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/purugin/change_listener.rb:77

19:02:18 [INFO] [MyChunk] Enabling MyChunk v1.2.2 19:02:18 [SEVERE] Exception in thread "RubyThread-20: jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/purugin/change_listener.rb:75" 19:02:18 [SEVERE] org.jruby.embed.EvalFailedException: (NameError) cannot load Java class org.kitteh.tag.TagAPI 19:02:18 [SEVERE] at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:132) 19:02:18 [SEVERE] at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1264) 19:02:18 [SEVERE] at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1295) 19:02:18 [SEVERE] at org.purugin.PuruginPlugin.executeScript(PuruginPlugin.java:47) 19:02:18 [SEVERE] at org.purugin.PuruginPlugin.executeScriptAt(PuruginPlugin.java:55) 19:02:18 [SEVERE] at org.purugin.RubyPluginLoader.loadPlugin(RubyPluginLoader.java:36) 19:02:18 [SEVERE] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305) 19:02:18 [SEVERE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 19:02:18 [SEVERE] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 19:02:18 [SEVERE] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 19:02:18 [SEVERE] at java.lang.reflect.Method.invoke(Method.java:616) 19:02:18 [SEVERE] at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:455) 19:02:18 [SEVERE] at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:316) 19:02:18 [SEVERE] at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:59) 19:02:18 [SEVERE] at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61) 19:02:18 [SEVERE] at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312) 19:02:18 [SEVERE] at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169) 19:02:18 [SEVERE] at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) 19:02:18 [SEVERE] at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) 19:02:18 [SEVERE] at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) 19:02:18 [SEVERE] at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75) 19:02:18 [SEVERE] at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:190) 19:02:18 [SEVERE] at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312) 19:02:18 [SEVERE] at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169) 19:02:18 [SEVERE] at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36) 19:02:18 [SEVERE] at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) 19:02:18 [SEVERE] at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) 19:02:18 [SEVERE] at org.jruby.ast.RescueNode.executeBody(RescueNode.java:226) 19:02:18 [SEVERE] at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:123) 19:02:18 [SEVERE] at org.jruby.ast.RescueNode.interpret(RescueNode.java:113) 19:02:18 [SEVERE] at org.jruby.ast.BeginNode.interpret(BeginNode.java:83) 19:02:18 [SEVERE] at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) 19:02:18 [SEVERE] at org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112) 19:02:18 [SEVERE] at org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209) 19:02:18 [SEVERE] at org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:197) 19:02:18 [SEVERE] at org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:128) 19:02:18 [SEVERE] at org.jruby.runtime.Block.call(Block.java:89) 19:02:18 [SEVERE] at org.jruby.RubyProc.call(RubyProc.java:269) 19:02:18 [SEVERE] at org.jruby.RubyProc.call(RubyProc.java:223) 19:02:18 [SEVERE] at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:101) 19:02:18 [SEVERE] at java.lang.Thread.run(Thread.java:679) 19:02:18 [SEVERE] Caused by: org.jruby.exceptions.RaiseException: (NameError) cannot load Java class org.kitteh.tag.TagAPI 19:02:18 [SEVERE] at org.jruby.javasupport.JavaClass.for_name(org/jruby/javasupport/JavaClass.java:1206) 19:02:18 [SEVERE] at org.jruby.javasupport.JavaUtilities.get_proxy_class(org/jruby/javasupport/JavaUtilities.java:34) 19:02:18 [SEVERE] at RUBY.java_import(jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/jruby/java/core_ext/object.rb:45) 19:02:18 [SEVERE] at org.jruby.RubyArray.map(org/jruby/RubyArray.java:2350) 19:02:18 [SEVERE] at RUBY.java_import(jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/jruby/java/core_ext/object.rb:41) 19:02:18 [SEVERE] at RUBY.import(jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/jruby/java/core_ext/module.rb:53) 19:02:18 [SEVERE] at RUBY.Event(/home/nigel/projects/4giggles/minecraftserver/plugins/PurpleOpPlugin.rb:11) 19:02:18 [SEVERE] at RUBY.Purugin(/home/nigel/projects/4giggles/minecraftserver/plugins/PurpleOpPlugin.rb:5) 19:02:18 [SEVERE] at RUBY.(root)(/home/nigel/projects/4giggles/minecraftserver/plugins/PurpleOpPlugin.rb:4) 19:02:18 [SEVERE] at RUBY.load_plugin(jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/purugin/change_listener.rb:33) 19:02:18 [SEVERE] at RUBY.start_plugin(jar:file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.1-R1.0-SNAPSHOT.jar!/purugin/change_listener.rb:77)

NigelThorne commented 12 years ago

ok fixed it.. I didn't even have the TagAPI library loaded.. https://gist.github.com/3844656 is the working code. Now to work out how to make the TagAPI optional.

enebo commented 12 years ago

Ah I need to update the events list. Unfortunately the new annotations support for Bukkit events means having to periodically update this list of classes.

enebo commented 12 years ago

Oh crap. I just realized that this is an external lib which adds its own events....ugh. Ok. I will try and figure out how we can detect these event classes so we can auto-hookup these (might not be possible).

NigelThorne commented 12 years ago

Yes I don't mind the monkey patching to add in the custom event. I'd love to be able to only do it if the plugin is loaded though. Any idea how I can do that?

Nigel On Oct 9, 2012 1:31 AM, "Thomas E Enebo" notifications@github.com wrote:

Oh crap. I just realized that this is an external lib which adds its own events....ugh. Ok. I will try and figure out how we can detect these event classes so we can auto-hookup these (might not be possible).

— Reply to this email directly or view it on GitHubhttps://github.com/enebo/Purugin/issues/34#issuecomment-9227607.

enebo commented 12 years ago

Nigel, This is still cruddy but better than before. If you know you want to consume new events you still need to make your own listener

enebo commented 12 years ago

Nigel, you still need to make your own listener but now things should be quite a bit less painful:

require 'purugin/event'

extend Purugin::EventDefiner

define_event_listener('TheEventType', 'the.event.package')

This should make the class for you and register under the event map as the same name. Hopefully this makes things slightly less painful.

NigelThorne commented 12 years ago

Like it. Nice!


"Man, I'm going to have so many chickens when this lot hatch!"

On Mon, Oct 22, 2012 at 4:09 AM, Thomas E Enebo notifications@github.comwrote:

Nigel, you still need to make your own listener but now things should be quite a bit less painful:

require 'purugin/event' extend Purugin::EventDefiner define_event_listener('TheEventType', 'the.event.package')

This should make the class for you and register under the event map as the same name. Hopefully this makes things slightly less painful.

— Reply to this email directly or view it on GitHubhttps://github.com/enebo/Purugin/issues/34#issuecomment-9644949.