Skip to content
stefvanschie edited this page Sep 7, 2017 · 1 revision

The plugin has a small API which allows you to directly interact with the plugin itself. You can make players join arenas, leave them, manipulate entities/particles on plot, control the weather and time on the plot, change the theme of the arena, manipulate votes etc.

To use the API add the plugin as a dependency to your plugin, by adding the plugin to your IDE's build path. (It's the same thing you did for the spigot API, so just follow the same steps).

There are three ways to get access to an Arena object. One is to get the arena by name:

Arena arena = BuildingGame.getArena("arena-name");

Second is to get the arena by player:

Arena arena = BuildingGame.getArena(myPlayer);

And last you can get a collection of arenas and then find the correct arena(s) yourself:

List<Arena> arenas = BuildingGame.getArenas();

From there you've got direct access to the arenas, all its plots, scoreboards, some guis etc.


There are also some events you can listen for like:

  • ArenaJoinEvent
  • ArenaLeaveEvent
  • ArenaStartEvent
  • ArenaStopEvent
  • PlayerWinEvent

The names should be self-explanatory. Note that all events are called early, so when listening to for example an ArenaJoinEvent, the arena itself doesn't know anything about the player. Something like this:

@EventHandler
public void onArenaJoin(ArenaJoinEvent event) {
  if (BuildingGame.getArena(event.getPlayer()) == null) {
    //will be true
  }
}

will execute the stuff inside the if statement. So be careful when modifying the arena from this (and the other) events.

Installation steps

Installation
Arenas
Plots

Clone this wiki locally