Adding Game Logic
Now that you have a basic understanding of how the event system works, along with a base to work off of. It's time to implement some game logic!
Game logic can be implemented in two places: the Arena, or your Competition class. While we do not have a Competition class yet, it is typically recommended to leave most code inside of your Arena class, with a custom Competition class being responsible for storing values that change throughout the game (i.e. the number of blocks broken). We will get to this later.
Using Events
Going from our previous example of a grace period, let's add some listeners to make this functional!
package org.battleplugins.arena.example;
import org.battleplugins.arena.Arena;
import org.battleplugins.arena.config.ArenaOption;
public class MyArena extends Arena {
@ArenaOption(name = "grace-period", description = "The grace period of the game")
private Duration gracePeriod = Duration.ofMinutes(5);
}