O'Reilly logo

Learn to Program with Minecraft Plugins, 2nd Edition by Andy Hunt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Plugin: NamedSigns

Let’s put a couple of these ideas together and make a plugin that uses helper functions (with and without return values), private functions and variables, some low-level array access, and a hash that will store names and locations.

This plugin lets you create signposts in the game and name them. You can then put text on any one of the signposts by name. For example, suppose I make two signs, named one and two, by typing these commands in the chat window:

 
/signs new one
 
/signs new two
 
/signs set one Hello!
 
/signs set two Goodbye!

I’d see something like this:

images/NamedSigns.png

Now I can go in and change either sign’s text at will just ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required