Battlefield API

Documentation

Find the API documentation here: API

Event System

Classes

The Event is pretty similar to the one from* Bukkit. First of you need to make your Class implement the interface EventListener. Then you have to register your Class with following code:

EventHandler.getInstance().registerEvent(new YourClass());

Methods

To make a Method triggered by the EventHandler there are 2 things you need to do:

  • Add the @BFEvent annotation to your method
  • Take the prefered Event as a parameter

e.g:

@BFEvent
public void onGameStart(GameRoundStartEvent e){
//Code
}

There are a few methods you can invoke on the event, which are documented in the

API Documentation.

Other Classes

Other classes are also documented, but there are a few classes which are very interesting.

  • GameManager with its implementing class(es): Is the main manager of the gamemodes, which controls everything. Do not use them until you use_as_api is turned on.
  • KitManager: Handles all the Gadgets and stuff. You can register different custom gadgets with it. But make sure you also think about what they should do, thats not done for you.
  • GameInfo: Represents some Info about a Game. Not a GameManager in particular. You can get it from the GameManger with getGameInfo().

Comments

Posts Quoted:
Reply
Clear All Quotes