Search in sources :

Example 1 with ArcadePlayer

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

the class CycleCountdown method onTick.

@Override
public void onTick(long ticks) {
    if (!this.plugin.getGames().getQueue().hasNextMap()) {
        this.cancelCountdown();
        return;
    } else if (this.getProgress() > 1) {
        return;
    }
    OfflineMap nextMap = this.plugin.getGames().getQueue().getNextMap();
    Game game = this.plugin.getGames().getCurrentGame();
    if (game == null) {
        return;
    }
    String message = this.getPrintMessage(this.getCycleMessage(nextMap.getName()));
    BossBar bossBar = this.getBossBar();
    bossBar.setProgress(Percentage.finite(this.getProgress()));
    bossBar.setText(new TextComponent(message));
    for (ArcadePlayer online : this.plugin.getPlayers()) {
        GamePlayer player = online.getGamePlayer();
        if (player != null) {
            bossBar.addPlayer(player, BAR_PRIORITY);
        }
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) Game(pl.themolka.arcade.game.Game) ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer) GamePlayer(pl.themolka.arcade.game.GamePlayer) OfflineMap(pl.themolka.arcade.map.OfflineMap) BossBar(pl.themolka.arcade.bossbar.BossBar)

Example 2 with ArcadePlayer

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

the class Match method broadcastStartMessage.

public void broadcastStartMessage() {
    for (ArcadePlayer player : this.plugin.getPlayers()) {
        player.send(" " + CommandUtils.createLine(CommandUtils.CHAT_LINE_LENGTH) + ChatColor.RESET + " ");
        player.send(" " + CommandUtils.createTitle(ChatColor.GREEN + "The match has started!") + " ");
        if (player.getGamePlayer() != null && player.getGamePlayer().isParticipating()) {
            player.send(" " + CommandUtils.createTitle(ChatColor.GOLD.toString() + ChatColor.UNDERLINE + "Good luck!") + " ");
        }
        player.send(" " + CommandUtils.createLine(CommandUtils.CHAT_LINE_LENGTH) + ChatColor.RESET + " ");
    }
    this.plugin.getLogger().info("The match has started.");
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer)

Example 3 with ArcadePlayer

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

the class Match method broadcastEndMessage.

public void broadcastEndMessage(MatchWinner winner) {
    String winnerMessage = null;
    if (winner != null) {
        winnerMessage = CommandUtils.createTitle(ChatColor.GOLD + winner.getMessage());
    }
    for (ArcadePlayer player : this.plugin.getPlayers()) {
        player.send(" " + CommandUtils.createLine(CommandUtils.CHAT_LINE_LENGTH) + ChatColor.RESET + " ");
        player.send(" " + CommandUtils.createTitle(ChatColor.GOLD + "The match has ended!") + " ");
        if (winnerMessage != null) {
            player.send(" " + winnerMessage + " ");
        }
        player.send(" " + CommandUtils.createLine(CommandUtils.CHAT_LINE_LENGTH) + ChatColor.RESET + " ");
    }
    String logMessage = "no result.";
    if (winnerMessage != null) {
        logMessage = "result: " + winner.getMessage();
    }
    this.plugin.getLogger().info(ChatColor.stripColor("The match has ended with " + logMessage));
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer)

Example 4 with ArcadePlayer

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

the class Match method start.

public void start(boolean force) {
    if (!this.isStarting()) {
        return;
    }
    MatchStartEvent startEvent = new MatchStartEvent(this.plugin, this, force);
    this.plugin.getEventBus().publish(startEvent);
    if (startEvent.isCanceled()) {
        return;
    }
    this.startTime = Time.now();
    this.broadcastStartMessage();
    this.setForceStart(force);
    this.setState(MatchState.RUNNING);
    for (ArcadePlayer online : this.plugin.getPlayers()) {
        GamePlayer player = online.getGamePlayer();
        if (player == null || this.getObservers().hasPlayer(player)) {
            continue;
        }
        player.setParticipating(true);
        ObserversKit.RESET.applyIfApplicable(player);
    }
    this.plugin.getEventBus().publish(new MatchStartedEvent(this.plugin, this, force));
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer) GamePlayer(pl.themolka.arcade.game.GamePlayer)

Example 5 with ArcadePlayer

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

the class MatchGame method onEnable.

@Override
public void onEnable() {
    this.match = new Match(this.getPlugin(), this.getGame(), this.getObservers());
    this.getObservers().setMatch(this.getMatch());
    this.startCountdown = new MatchStartCountdown(this.getPlugin(), this.getMatch());
    this.getStartCountdown().setGame(this.getGame());
    // visibility filter
    this.getGame().getVisibility().addFilter(new MatchVisibilityFilter(this.getMatch()));
    for (ArcadePlayer player : this.getPlugin().getPlayers()) {
        if (player.getGamePlayer() != null) {
            this.getObservers().join(player.getGamePlayer(), false, true);
        }
    }
}
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