😀SimpleTimer

How to implement SimpleTimer?

public class SimpleStartGameTimer extends SimpleGameTimer {

    public SimpleStartGameTimer(Game game, int minPlayers, int time) {
        super(game, minPlayers, time);
    }

    @Override
    public void onCancel() {
        game.sendMessage("starting cancelled");
        //the method calls when the countdown was stopped
    }

    @Override
    public void onEnd() {
    //the method calls when the countdown was ended
        game.getPlayingUsers().forEach(userGame -> {
            Player player = userGame.toPlayer();

            player.getInventory().clear();

            player.teleport(game.getArena().getLocationByName("spawn"));
        });

        game.setState(new PlayingGameState());
    }

    @Override
    public void onStart() {
        //the method calls when the countdown was started
    }
}

Last updated