在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):CmdrDats/clj-minecraft开源软件地址(OpenSource Url):https://github.com/CmdrDats/clj-minecraft开源编程语言(OpenSource Language):Clojure 74.2%开源软件介绍(OpenSource Introduction):cljminecraftcljminecraft has two specific goals: Open up support for other clojure plugins on Bukkit
Provide convenience functions to make writing plugins more idiomatic to clojure
UsageInstall the modDownload the latest server mod build from http://dev.bukkit.org/server-mods/cljminecraft/files/ or build it yourself by cloning the repo and Copy the jar into the Bukkit plugin folder and fire up your server. Once started, it should have opened a REPL port, by default on port 4005 If all you wanted was to enable clojure plugins on your server, you're done. If you want to write some code, read on. Write some codeFrom now on, you will need leiningen installed - see https://github.com/technomancy/leiningen
Now you have an active connection to push code onto the server, let's try some stuff (the part before => is the REPL prompt...): user=> (in-ns 'cljminecraft.core)
#<Namespace cljminecraft.core>
cljminecraft.core=> (ev/find-event "break")
("painting.painting-break-by-entity" "hanging.hanging-break" "painting.painting-break" "entity.entity-break-door" "hanging.hanging-break-by-entity" "player.player-item-break" "block.block-break")
;; block.block-break looks good.. lets see what we can get out of it
cljminecraft.core=> (ev/describe-event "block.block-break")
#{"setExpToDrop" "isCancelled" "getEventName" "setCancelled" "getExpToDrop" "getPlayer" "getBlock"}
;; Cool, getBlock looks like I can use it..
cljminecraft.core=> (defn mybreakfn [ev] {:msg (format "You broke a %s" (.getBlock ev))})
#'cljminecraft.core/mybreakfn
cljminecraft.core=> (ev/register-event @clj-plugin "block.block-break" #'mybreakfn)
nil
;; Test breaking a block, I get a crazy message, let's make that more sane
cljminecraft.core=> (defn mybreakfn [ev] {:msg (format "You broke a %s" (.getType (.getBlock ev)))})
#'cljminecraft.core/mybreakfn And that's a quick taste of interactive development.. The Rabbit hole goes rather deep :) enjoy. Roll your own modOnce you've got the cljminecraft mod installed on bukkit and you've played a bit with the REPL, you might want to build your own fully capable plugin:
This will create a subfolder called yourplugin with the basics needed to get started, with some sample configuration in src/config.yml and the plugin.yml already setup under src/plugin.yml, ready to roll.
Start up your Bukkit server and go, by default, you'll see a message when you place a sign and there will be a command '/yourplugin.random' which does a dice roll. Very exciting stuff! Remember to update your details in the plugin.yml and README.md files - and very importantly, commit to github to share with the world. Also, be sure to look at the wiki for more in-depth instructions on all the moving parts: http://github.com/CmdrDats/clj-minecraft/wiki Time to hack away. Changelog:30 December 2012:
29 December 2012:
27 December 2012:
21 December 2012:
19 December 2012:
ContributionsA huge thanks to aiscott and basicsensei for their contributions to clj-minecraft! Please feel free to fork and make pull requests if you want to contribute, I love code contributions - it makes the whole project that much more well rounded. On that note, we're desperately needing documentation, so if you're keen to contribute to the wiki, let me know. LicenseCopyright (C) 2012 Deon Moolman Distributed under the Eclipse Public License, the same as Clojure. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论