Skip to main content

Overview

This is an overview of how to use the BattleArena API to create a custom gamemode. Before we start writing code, there's a few things to keep in mind regarding how BattleArena works and manages arenas:

Arena:

The Arena class contains the root logic of a game. This is where global options regarding a specific arena are configured, such as game events, the number of lives a player should have, and anything not linked to a specific competition. Each individual gamemode (i.e. Battlegrounds, SkyWars, etc.) will only have a single Arena instance.

Additionally, an Arena is directly tied to it's respective <arena>.yml file, so most any value accessible in code is directly taken from the YML. 

Competition:

A Competition represents an active Arena. Where Arena contains all the actual game logic, a Competition will be responsible for handling anything pertinent to an active game. For instance, all the logic handling which phase a competition is in will be managed here.

CompetitionMap:

A CompetitionMap is the map in which the Competition is active in. In many cases, this is something that will not need to be extended, however for certain gamemodes where it is desired to store additional information (i.e. the layers in a spleef game), it may be useful to use this class.

No game logic is handled in the map class. It simply stores all the information necessary for a Competition to run (i.e. spawnpoints, the game border, the type of map, etc.