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

Already on GitHub? Sign in to your account

Not much of an issue, but.. #1

Open
gdude2002 opened this Issue Jun 27, 2012 · 19 comments

Comments

Projects
None yet
2 participants

Have you got any more on this? I know it's been a while, however, I'm looking to do exactly the same thing with my own server, and I haven't got a clue where to begin (Mostly because I have next to no Java experience), and I haven't found anything like this anywhere on the Nets, aside from your own question on StackOverflow.

Owner

jonnay commented Jun 27, 2012

Oh cool, thanks for the interest!

I was able to get the Clojure runtime running inside of the bukkit server, but I was not able to do the right set of magickal incantations to make it play well with the event system.

Basically the chief problem seemed to be that the event system depends on the specific types and annotations to tell buckkit that this class is in fact an event listener. (a piss poor design decision IMNSHO).

I think that If there was a java class that sat between bukkit and clojure that handled all the events, that might just work, but i never got around to building it.

Ahh, I see..

Would it maybe make sense to do something like the Jython plugin, and provide some kind of wrapper, then? I would almost expect it to be possible using Clojure protocols, to be honest. What do you think?

I'm not a Java dev, as I said, but I'll offer whatever help I can give you if you think we can make this happen.

Owner

jonnay commented Jun 29, 2012

Honestly I just don't have time to devote to it sadly. Perhaps a wrapper might work, or even working with some of the lower level event management details of bukkit, that was where I was going next.

Conversely, I think there is a way you can make Clojure spit out proper java objects, which might give you the required annotations that bukkit wants.

I think a proper Java dev would have to get involved as well. Or you coud learn some java! That will be fun!

but yes, I just don't have time for minecraft anymore, let alone bukkit.

Okay, not a problem. I'll poke a few devs on IRC and see what they have to say.

Thanks for the info, much appreciated. I'll get back to you if I find something.

Owner

jonnay commented Jun 29, 2012

I'd totally be interested! I would like to pick this project up again some day!

I seem to be getting there.. I used Clojure's compile function, but I can't get the dependencies worked out (it can't find Clojure). Any ideas?

21:43:30 [SEVERE] Could not load 'plugins\plugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: clojure/lang/IFn

Just for the sake of argument, I pulled the clojure folder out of the clojure jar and shoved it into my one. Now I get this..

21:51:33 [SEVERE] Could not load 'plugins\plugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.ExceptionInInitializerError
...
Caused by: java.io.FileNotFoundException: Could not locate clojure/core__init.class or clojure/core.clj on classpath:
...

Put a question on StackOverflow to see what people think. Also got the dev of DeathNotify+ helping me out :3

http://stackoverflow.com/questions/11275667/unable-to-find-clojure-in-bukkit-plugin

Owner

jonnay commented Jun 30, 2012

I found I had more luck just using CmdrData's clojure class, and hoking up to it's repl there. My plan eventually was to use his loader to load my clojure code.

https://github.com/CmdrDats/clj-minecraft

Though, I bet you could use gen-class to generate your wrapper class.

Hmm.. The only problem is, there doesn't seem to be any docs there, and I know very little Java :P

Well, I'm using gen-class to do things, but the problem is that it still needs the Clojure library. Which it can't find. Maybe I'll poke around with that code though and see how they did it.. Thanks.

Say, how exactly did you resolve your question here? http://stackoverflow.com/questions/9167993/java-interop-with-clojure-getting-exception-java-lang-classformaterror-dupli

Did you do what I did and just remove :methods from the gen-class?

You might find it interesting that octopusgrabbus referenced your question in a comment on mine, also :P

Owner

jonnay commented Jul 3, 2012

oh, I was re-declaring the onEnable/onDisable methods, which was the problem.

Yes, but how did you solve it? I had the same problem, not sure if I did it right or not :P

Owner

jonnay commented Jul 3, 2012

I just removed the onEnable and onDisable methods definition inside of genclass.

Okay, great, thanks. I think I might poke one of my co-workers about this one before the end of the week, he's a Clojure/Java wizard in comparison to the rest of us there

I got some response from the bukkit forums. It said, simply, "you need to include those classes inside your plugin.jar".

I was thinking a statement like (:import clojure) would work, but nada. What do you reckon?

Owner

jonnay commented Jul 9, 2012

I wouldn't expect the bukkit people to be all that helpful.

I think your best course of action is to use the original plugin from cmdrdata, and try to get that working. Maybe you can even do a gen-class with the REPL, which would make life really easy!

that is really about as far as I got.

@ghost

ghost commented Sep 8, 2012

hey guys, interesting discussion, I'll come back to it later when I learn some clojure. I'm interested in this clojure bukkit plugin, I'll have a look at CmdrDats implementation and hope I'll get somewhere eventually.

@ghost

ghost commented Sep 8, 2012

EDIT: disregard the below, I managed to make it work by running "lein.bat uberjar" (thanks to tomoj) and generated 2 .jar files in 'target' folder: one for standalone and one which requires libs like clojure..jar

I'm using Eclipse and CounterClockwise, no luck trying to get a .jar out from this, even though the documentation here:
https://code.google.com/p/counterclockwise/wiki/Documentation#Distribute_as_a_jar
says I should use the normal eclipse export .jar
For one, the manifest is ignoring the project.clj part: :manifest {"Class-Path" "../lib/clojure-1.4.0.jar"}
or even compiling anything ahead of time: :aot [net.jonnay.watershipdown.WatershipDown]
there are no .class files inside it.

Could anyone point me in the right direction ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment