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: LocationSnapshot

Here’s an example of using a DataAccess (in this case, AllPlayerLocations) in a new plugin, LocationSnapshot. For this plugin, we’ll provide two new commands:

  • /savelocations

  • /loadlocations

You might want to use this kind of feature as part of a competition, where you can return all players back to their starting points at the end.

The savelocations command, as you’d expect, saves the current locations of all online players to disk. loadlocations reads them back in and teleports everyone back to those saved locations. We’ll use Canary’s Database functions with our AllPlayerLocations DataAccess object to save and load a hash of Players and Locations.

There are two main pieces to this plugin: saveLocations and ...

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