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);
}
}
}
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.");
}
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));
}
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));
}
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);
}
}
}
Aggregations