Search in sources :

Example 16 with ArcadePlayer

use of pl.themolka.arcade.session.ArcadePlayer in project Arcade2 by ShootGame.

the class RestartCountdown method onUpdate.

@Override
public void onUpdate(long seconds, long secondsLeft) {
    if (!this.plugin.getGames().isNextRestart()) {
        this.cancelCountdown();
        return;
    } else if (!this.isPrintable(secondsLeft)) {
        return;
    }
    Game game = this.plugin.getGames().getCurrentGame();
    if (game == null) {
        return;
    }
    String message = this.getPrintMessage(this.getRestartMessage());
    for (ArcadePlayer player : this.plugin.getPlayers()) {
        player.getPlayer().send(message);
    }
    this.plugin.getLogger().info(ChatColor.stripColor(message));
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer)

Example 17 with ArcadePlayer

use of pl.themolka.arcade.session.ArcadePlayer 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)

Example 18 with ArcadePlayer

use of pl.themolka.arcade.session.ArcadePlayer in project Arcade2 by ShootGame.

the class MatchStartCountdown method printCount.

private void printCount() {
    long left = this.getLeftSeconds();
    String text = null;
    if (left == 0) {
        text = "";
    } else if (left == 1 || left == 2 || left == 3) {
        text = ChatColor.YELLOW + Long.toString(left);
    }
    if (text != null) {
        String start = ChatColor.GREEN + ChatColor.ITALIC.toString() + "The match has started.";
        Observers observers = this.match.getObservers();
        for (ArcadePlayer online : this.plugin.getPlayers()) {
            GamePlayer player = online.getGamePlayer();
            if (player == null) {
                continue;
            }
            if (observers.contains(online)) {
                if (left == 0) {
                    player.getBukkit().sendTitle(text, start, 3, 60, 10);
                }
            } else {
                player.getBukkit().sendTitle(text, "", 3, 5, 20);
            }
        }
    }
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer) GamePlayer(pl.themolka.arcade.game.GamePlayer)

Example 19 with ArcadePlayer

use of pl.themolka.arcade.session.ArcadePlayer in project Arcade2 by ShootGame.

the class MatchStartCountdown method printMessage.

private void printMessage() {
    String message = this.getPrintMessage(this.getStartMessage());
    for (ArcadePlayer player : this.plugin.getPlayers()) {
        player.getPlayer().send(message);
    }
    this.plugin.getLogger().info(ChatColor.stripColor(message));
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer)

Aggregations

ArcadePlayer (pl.themolka.arcade.session.ArcadePlayer)19 GamePlayer (pl.themolka.arcade.game.GamePlayer)5 TextComponent (net.md_5.bungee.api.chat.TextComponent)3 BossBar (pl.themolka.arcade.bossbar.BossBar)3 Game (pl.themolka.arcade.game.Game)3 OfflineMap (pl.themolka.arcade.map.OfflineMap)2 ArcadeSound (pl.themolka.arcade.session.ArcadeSound)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Handler (net.engio.mbassy.listener.Handler)1 BaseComponent (net.md_5.bungee.api.chat.BaseComponent)1 World (org.bukkit.World)1 CraftWorld (org.bukkit.craftbukkit.CraftWorld)1 Cancellable (org.bukkit.event.Cancellable)1 EventHandler (org.bukkit.event.EventHandler)1 BlockTransformEvent (pl.themolka.arcade.event.BlockTransformEvent)1 KitContent (pl.themolka.arcade.kit.content.KitContent)1 MapManager (pl.themolka.arcade.map.MapManager)1