Create a Stendhal server extension: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Hendrik Brummermann
imported>Hendrik Brummermann
Line 7: Line 7:
*A ready stendhal server
*A ready stendhal server
*Java knowledge is recommened
*Java knowledge is recommened

=Getting started with a example=
If you download the source code, there is a extension already there for you! It's the Spouse extension. This allows marriage in-game! Here's how to add it to your server. First, open up marauroa.ini in your server directory (or wherever else everything is). Add this:
<pre>
# load StendhalServerExtension(s)
groovy=games.stendhal.server.scripting.StendhalGroovyRunner
http=games.stendhal.server.StendhalHttpServer
spouse=games.stendhal.server.extension.SpouseExtension
server_extension=groovy,spouse
</pre>
Here is the run down:
<code>
groovy=games.stendhal.server.scripting.StendhalGroovyRunner
spouse=games.stendhal.server.extension.SpouseExtension
</code>
These are just variables that hold the pointer to a specfic class that is the actual extension itself
<code>
server_extension=groovy,spouse
</code>
This is the line marauroa reads. After the equal, the list of variables are pointers to the extension class.

Recompile and restart your server and have a blast! If you can run /jail, then you're a priest! Read the comments in the source code of SpouseExtension.java to learn of the command's syntax. (/marry and /spouse are the two commands added)



=Getting your own setup=
=Getting your own setup=