Showing posts with label plugin. Show all posts
Showing posts with label plugin. Show all posts

Wednesday, February 23, 2011

Bukkit Plugins Updated for 1.3

Hope the forums come back up soon!

Here are my plugins, working with 1.3 [CB#431]:
Persistence v0.50 : Persistence.jar
Spells v0.96 : Spells.jar
Wand v0.64 : Wand.jar
NetherGate v0.44 : NetherGate.jar
CrowdControl v0.17 : CrowdControl.jar

I haven't had time to really see if CC is actually working anymore, but everything else works. Material cycling is temporarily disabled in Wand on account of Player.isSneaking being broken (looks like it points to "isAlive" now!)

Also, Spells v0.96 has two very new, very dangerous spells- fire and lava. Observe the terrifying and devastating effects in my testing, here.

CC changes the order of parameters for "control"- you can now simply do "/crowd control creeper giant" to swap creepers for giants, or "/crowd control creeper giant 50" to swap half of the creepers for giants.

NetherGate hasn't changed much on the outside- but I was right in the middle of getting portal tracking up and running! Should be soon.. OH! Also, I did add that "/nether list worlds" command.

Oh, and the base fire spell closes the gap in constructing and activating a portal entirely with the wand. Pretty cool, and is basically why I got distracted on finally implementing fire (and then lava) in the first place.

Come visit, play around if you want: mine.elmakers.com

Saturday, February 19, 2011

Getting Started With Bukkit Plugin Development

Getting started with Bukkit plugin programming can seem daunting- but if you follow these instructions, to the letter, you should be able to get yourself set up and ready to go!

Before you start: Check out the bukkit wiki first, look in the "Getting Started" section.... I'm going to be updating that instead! This page will stay around for now, for Persistence and Gameplay tutorials.

Contents
Tools
Getting Eclipse Set Up
Donwloading Eclipse Plugins

Tools
This tutorial uses the following technology:

  • Eclipse - get the latest version, for Java devs
  • git - I recommend that you use git for version control, even if just locally
  • EGit - an Eclipse plugin for easy git use, available in the Eclipse Marketplace
  • github.com - It's a good idea to get a github account, and I recommend you go open source!
  • Maven - Maven is a dependency management and build system
  • Eclipse Plugin for Maven - Integrates Maven into Eclipse

If you prefer other tools/environments, you're going to be somewhat on your own, but this tutorial may still be useful.

Getting Eclipse Set Up
Start by downloading Eclipse. This is the only thing you should need to download directly- install it and get it started. Set up a "workspace"- this just a folder where you'll keep your code. Check the "use this as default and don't ask again" box:


Now, you should get a welcome screen like this:


You can close the "Welcome" tab using the "x" or explore what it has to offer if you're a first-time Eclipse user. Eclipse is a very powerful IDE- you will get to learn it over the course of this tutorial, but it's worth you time to explore what's there.

When you're ready, close the "Welcome" tab and you should see the default Eclipse IDE:


Don't feel overwhelmed! Let's take some time to introduce you to Eclipse, step-by-step. Eclipse is a flexible UI framework, it has two main concepts:

Views
A "view" in eclipse is like a sub-window. Every tab that you see on the screen is a "view". You can access any view at any time using "Window", "Show View":


Eclipse has a lot of views, and plugins can add them, as well. This list is mean to contain the most commonly used ones.

Perspectives
A perspective in Eclipse is just a set of views, arranged a certain way. Eclipse comes with some default perspectives- the one you see in front of you is the "Java" perspective, which you can see in the top-right:

 You can have as many different perspectives "open" at one time, and switch between then using these controls. You may also customize any perspective- adding views, toolbar buttons, etc, as you see fit.

The Java Perspective
The default views available in the Java perspective should be as follows:



Download Eclipse Plugins
Eclipse has a built-in "marketplace" for plugins (think "Fill"). Access it via "Help" menu:


Monday, January 24, 2011

Bukkit Plugins

I've started making server plugins for Bukkit, and I'll keep track of them here!

Spells : A collection of easy-to-use magic spells for combat, world construction, exploration, and more.
Wand : An extension to Spells, allows console-free spell use with a magic wand.
Persistence : A persistence framework plugin, allowing easy object saving and loading, using SqlLite.
Wandmin : A version of Wand that works with arbitrary console commands.

I've also started some basic API's- right now, Spells is the only thing I've got going. It should be easy to make your own plugin with new spells in it. If you're interested, check it out here.

If you enjoy using any of my plugins, or you appreciate the Spells API, or you're just feeling generous, I would appreciate a donation!





Sunday, December 19, 2010

Wand-er-ing Off

I've made my Wand plugin official! I've released it on the hMod forums here:

[MECH] Wand

I'll be supporting it there, but probably not adding anything major to it in the future. The core functionality will find its way into the RPG framework, though in a slightly different form.

Wednesday, December 15, 2010

RPG Mod Started!

After a good bit of thinking and research, I dove into code today and got my first "plugin" written!

This plugin is eventually meant to be a general framework for turning Minecraft into an RPG-style game.

This will include a class system, experience points, and some sort of "magic points" for ability use.

Right now, the first thing I wanted to play with was creating a magic wand. It was super easy!

My first try, I hooked up the "boom" spell from the really-fun "MagicSpells" plugin. Basically, I made it so that whenever you swing a stick (your wand), it casts "boom" at whatever you're aiming at.

Wow, it was fun! But, oh-so dangerous. And I'm still not convinced that "boom" behaves well with Cuboid permissions- something I'd need to fix before I let any dark wizards loose on my server...

Anyway, I quickly changed the wand to cast "blink" instead, making it a super handy teleport tool.

I'm considering how best to approach this- obviously I want different spells to be assignable to a wand- but I could also use a unique item for each spell, reservering wand for the assignable one. Not sure. In any case, I can already tell I'm going to have a lot of fun with this.

Tuesday, December 14, 2010

Configuring the Dynamic Map Plugin for hMod

The dynamic map plugin for hMod is awesome. If you haven't seen it, check it out on my server here:

mine.elmakers.com

The forum post is here, originally describing the plugin. It supports dynamic regeneration of map tiles (based on add/remove block notification), and live updating of player locations, and (of course) has a Google Maps client interface.

The newest version (as of this posting) also shows warp locations, home locations, and the spawn point. It even shows player face icons. (Awesome!)

It's definitely worth setting up on any Minecraft server, if you have enough control of the server to do so. It is a bit trickier to get going than your standard plugin, which is why I'm offering this tutorial. I'm hoping it helps!

Server Setup

Much of the server-side setup I have Shagnasticator's post on page 2 to thank for.

My server setup is CentOS, but this guide shouldn't be too different for other flavors of Linux.

First, get the plugin. Currently, in fescen9's signature, the link to the most recent is here:

http://www.fescen9.com/Minecraft/Plugins/DynamicMap.rar

The source code is in an SVN repository here: https://port70.net/svn/dynmap/trunk.  You only need the source if you want to modify the plugin.

Once you have downloaded the file, unrar it.You should see a map.jar, this is the actual plugin.

Setting Up the Plugin


Install map.jar like any other plugin- put it in the plugins folder, add it to "plugins" in server.properties, and then reload both the server config and the map plugin (or restart the server).

Configuration options go right in server.properties, and should be there after the plugin is loaded. The main thing you'll need to modify is "map-tilepath" (possibly- I left mine alone). Make note of "map-serverport", which should be 8123, and check out the other options.

Setting Up the Tiles Folder


Setting up the tiles folder is one of the trickiest parts. I don't claim to have done this the best or most secure way, so the standard disclaimers apply. Please feel free to add a comment if you've got a better setup and I'll be happy to modify this tutorial! And, please don't grief my server using the information I'm providing to try to help people...

So, I went in my web root- this is the folder where Apache serves up your web files. By default, this is /var/www/html. If you want your map to be in the root of your webserver, this is the folder you'll use.

Go into this folder and "mkdir tiles" to create the tiles folder. Make sure it is owned by the same user that the web server runs under (check the owner of "html", it may be root). And, here is the nasty part- make it world-writeable (777). There is probably a better way to do this, setting up a group shared by web and minecraft users, but I haven't gotten here yet, myself.

Now you have a "tiles" folder that the web service can access and that the minecraft user can write to.

Go back to your minecraft server folder, and create a symlink to the tiles folder: "ln -s /var/www/html/tiles tiles". This will let the plugin write there without having to fully path out the tiles folder.

There are obviously other ways to set up tiles so that the webserver can access it, but for me this was the easiest and least prone to errors.

Setting up the Webserver


The webserver is responsible for serving up 3 things to make the map work:

  • The map tiles, dynamically created by the plugin
  • The map index.html, javascript, images, and other static resource
  • An XHR interface for providing live information about the map (player locations, updated tiles, etc).
So far, the first part should be working. Load up your server, walk around a bit, break some blocks. Then go check your "tiles" folder- you should see some png's in there. If not, check server.log for access violation or other errors. If you can't find anything wrong, we may be stuck.

If you've got png's, then great! Let's get the map working. 

This part is pretty easy: first, we need to edit two lines in map.js (inside of the "web" folder from the RAR you downloaded), right at the very top:

tileUrl: Point this to the URL of your tile folder
updateUrl: Points to your update URL, which we'll set up later

If you're following this guide and are using the root of your webserver for your map, then you can just change the example domain name to your domain. Otherwise, change these URLs appropriately, and save the file.

If you don't have a domain, then you'll want to use the public IP address of your webserver.

Then, simply copy the files in the "web" folder to your "/var/www/html" folder on the webserver. You should now be able to navigate to your server and see the map load, and it should even show the tiles that you've created. Success! (Hopefully).

The only problem is you'll get the "error getting update data" message, and player locations/warps/etc won't be shown.

Setting up the Update URL

Now things get a little tricky, and I really have to rely on the groundwork laid out by ShagNasticator. 

The problem is that the plugin serves up its update information on port 8123. Most webservers are firewalled, and wouldn't let anyone connect to that port- and I'm not even sure that the XSS blocking wouldn't catch different ports anyway.

So, you've got to set Apache up to serve that port as a "virtual" address.

For CentOS, I did not have to do this part, but Shagnasticator mentions first having to turn on some Apache modules (all of this will be in httpd.conf - /etc/httpd/conf/httpd.conf on CentOS):

LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Then, on to the important stuff- basically copy+paste this into your httpd.conf, at the very bottom- that's what I did.

<VirtualHost *:80>
RewriteEngine on
RewriteRule /up/(.*) http://localhost:8123/$1 [P,L]
</VirtualHost> 

<VirtualHost 127.0.0.1>
ServerName localhost
</Virtualhost>

<Proxy http://localhost:8123/*>
Order deny,allow
Allow from all
</Proxy>

This sets up a rewrite rule that will map "/up/" to port 8123 on your local machine. This means that the XHR requests sent by the map client will get routed to the plugin, which will be able to report back its status.

Restart apache (apachectl restart), and jump on your mapserver while logged into Minecraft.

If all went well, you should see your player show up!

If not, check the minecraft server logs and check the httpd logs for any errors. And, if all else fails, come back to the forums!