Purugin
Quick Intro
Purugin is a thin layer on top of Bukkit which allows you to write plugins using the Ruby programming language. You can open up a text editor, then create a .rb file in your plugins directory and it will just load the plugin. If you edit that plugin it will do its best to reload that plugin on the fly.
The basic syntax hopefully will feel natural to a Rubyist. For Java programmers, you will get to drastically reduce the size of most simple plugins down to a single file (although you will need to learn a little Ruby). Here is a simple example showing how to print out a custom message whenever a user joins of quits the game:
#--------- examples/player_joined_full_class.rb ---------- class PlayerJoinedPlugin include Purugin::Plugin, Purugin::Colors description 'PlayerJoined', 0.1 def on_enable # Tell everyone in players world that they have joined event(:player_join) do |e| e.player.world.players.each do |p| p.msg red("Player #{e.player.name} has joined") end end # Tell everyone in players world that they have quit event(:player_quit) do |e| e.player.world.players.each do |p| p.msg red("Player #{e.player.name} has quit") end end end end
For more information check out the projects main website on github (be sure to check the wiki out).
Other Resources
Here is a dated talk on Purugin at Rubyconf 2011: http://www.confreaks.com/videos/696-rubyconf2011-be-a-minecraft-modman-with-purugin Movie showing a demo of the 3D Logo implementation that is part of Purugin called Purogo: http://www.youtube.com/watch?v=iAiS2noYWI8
Installation
- Download version of Purugin (Choose 'Files' above).
- copy Purugin.jar into your servers plugins directory. If you are unfamiliar with setting up your own CraftBukkit server for Minecraft you should visit the page (http:wiki.bukkit.org/Setting_up_a_server).
- Download latest version of jruby-complete.jar from http://www.jruby.org/download. Be sure to get jruby-complete jar.
- Copy jruby-complete.jar to your minecraft server directory (sibling of your plugins directory).
To execute the server you need a slightly special command-line (on Unix/Mac systems):
GEM_HOME=./gems java -Xms1024M -Xmx1024M -cp jruby-complete.jar:craftbukkit.jar org.bukkit.craftbukkit.Main
Or on windows:
set GEM_HOME=.\gems java -Xms1024M -Xmx1024M -cp jruby-complete.jar;craftbukkit.jar org.bukkit.craftbukkit.Main
Putting these commands into a run.sh (linux) or run.bat (windows) can save a bunch of typing.
Hi Enebo, I am new on jRuby. But I am very interested in your Purugin implementation.
However, i can't resolve one of my problems. I would like to use multiple file in order to organise my plugin folder etc. Is it possible with purugin because everything I tried failed.