use of pl.themolka.arcade.game.Participator in project Arcade2 by ShootGame.
the class KillEnemiesGame method onEnable.
@Override
public void onEnable() {
MatchGame module = (MatchGame) this.getGame().getModule(MatchModule.class);
this.match = module.getMatch();
this.match.registerDynamicWinnable(this);
for (Map.Entry<Participator, KillEnemies> entry : this.byOwner.entrySet()) {
MatchWinner winner = this.match.findWinnerById(entry.getKey().getId());
if (winner == null) {
continue;
}
winner.addGoal(entry.getValue());
}
}
use of pl.themolka.arcade.game.Participator in project Arcade2 by ShootGame.
the class Core method detectBreak.
//
// Listeners
//
@Handler(priority = Priority.NORMAL)
public void detectBreak(BlockTransformEvent event) {
if (event.isCanceled()) {
return;
}
Block block = event.getBlock();
if (!event.getNewState().getMaterial().equals(Material.AIR) || this.isCompleted() || !this.contains(block) || this.getLiquid().accepts(event.getNewState().getMaterial())) {
return;
}
GamePlayer player = event.getGamePlayer();
if (player == null) {
event.setCanceled(true);
return;
}
Participator winner = this.game.getMatch().findWinnerByPlayer(player);
if (this.getOwner().equals(winner)) {
event.setCanceled(true);
player.sendError("You may not damage your own " + ChatColor.GOLD + this.getColoredName() + Messageable.ERROR_COLOR + ".");
return;
}
if (!this.breakPiece(winner, player, block)) {
event.setCanceled(true);
}
}
use of pl.themolka.arcade.game.Participator in project Arcade2 by ShootGame.
the class ScoreBoxListeners method onPlayerEnterScoreBox.
@Handler(priority = Priority.LOWEST)
public void onPlayerEnterScoreBox(PlayerMoveEvent event) {
if (event.isCanceled() || !this.game.hasAnyScoreBoxes()) {
return;
}
GamePlayer player = event.getGamePlayer();
ScoreBox scoreBox = this.game.getScoreBox(event.getTo().toVector());
if (scoreBox == null || !scoreBox.canScore(player)) {
return;
}
Participator participator = this.game.getMatch().findWinnerByPlayer(player);
if (participator != null) {
Score score = this.game.getScore(participator);
if (score != null) {
scoreBox.score(score, player);
}
}
}
use of pl.themolka.arcade.game.Participator in project Arcade2 by ShootGame.
the class ScoreGame method onEnable.
@Override
public void onEnable() {
MatchGame module = (MatchGame) this.getGame().getModule(MatchModule.class);
this.match = module.getMatch();
this.match.registerDynamicWinnable(this);
for (Map.Entry<Participator, Score> entry : this.byOwner.entrySet()) {
MatchWinner winner = this.match.findWinnerById(entry.getKey().getId());
if (winner == null) {
continue;
}
Score score = entry.getValue();
score.setMatch(this.match);
winner.addGoal(score);
}
}
Aggregations