Search in sources :

Example 1 with KitContent

use of pl.themolka.arcade.kit.content.KitContent in project Arcade2 by ShootGame.

the class Match method end.

public void end(MatchWinner winner, boolean force) {
    if (!this.isRunning()) {
        return;
    }
    MatchEndEvent endEvent = new MatchEndEvent(this.plugin, this, winner, force);
    this.plugin.getEventBus().publish(endEvent);
    if (endEvent.isCanceled()) {
        return;
    }
    this.endTime = Time.now();
    this.broadcastEndMessage(winner);
    this.setForceEnd(force);
    this.setState(MatchState.CYCLING);
    for (ArcadePlayer online : this.plugin.getPlayers()) {
        GamePlayer player = online.getGamePlayer();
        if (player == null || !player.isParticipating()) {
            continue;
        }
        player.setCurrentChannel(null);
        player.setParticipating(false);
        for (KitContent<?> content : new KitContent[] { ObserversKit.RESET, ObserversKit.GAME_MODE, ObserversKit.NAVIGATION_ITEM, ObserversKit.HELD_SLOT, ObserversKit.NIGHT_VISION_EFFECT, ObserversKit.CAN_FLY, ObserversKit.FLY, ObserversKit.FLY_SPEED, ObserversKit.WALK_SPEED }) {
            content.applyIfApplicable(player);
        }
    }
    this.plugin.getEventBus().publish(new MatchEndedEvent(this.plugin, this, winner, force));
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer) GamePlayer(pl.themolka.arcade.game.GamePlayer) KitContent(pl.themolka.arcade.kit.content.KitContent)

Aggregations

GamePlayer (pl.themolka.arcade.game.GamePlayer)1 KitContent (pl.themolka.arcade.kit.content.KitContent)1 ArcadePlayer (pl.themolka.arcade.session.ArcadePlayer)1