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