Search in sources :

Example 1 with MatchGame

use of pl.themolka.arcade.match.MatchGame 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());
    }
}
Also used : Participator(pl.themolka.arcade.game.Participator) MatchGame(pl.themolka.arcade.match.MatchGame) MatchWinner(pl.themolka.arcade.match.MatchWinner) MatchModule(pl.themolka.arcade.match.MatchModule) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with MatchGame

use of pl.themolka.arcade.match.MatchGame in project Arcade2 by ShootGame.

the class TeamsGame method onEnable.

@Override
public void onEnable() {
    this.commands = new TeamCommands(this);
    MatchGame module = (MatchGame) this.getGame().getModule(MatchModule.class);
    this.match = module.getMatch();
    for (Team team : this.teamsById.values()) {
        team.setMatch(this.match);
        this.match.registerWinner(team);
    }
    this.teamsById.put(this.match.getObservers().getId(), this.match.getObservers());
    this.window = new TeamWindow(this);
    this.window.create();
    // register
    this.getGame().getWindowRegistry().addWindow(this.getWindow());
    this.match.setPlayWindow(this.getWindow());
    this.match.setObserverHandler(this);
    // cache
    Observers observers = this.match.getObservers();
    for (GamePlayer observer : observers.getOnlineMembers()) {
        this.teamsByPlayer.put(observer, observers);
    }
}
Also used : MatchGame(pl.themolka.arcade.match.MatchGame) GamePlayer(pl.themolka.arcade.game.GamePlayer) Observers(pl.themolka.arcade.match.Observers) MatchModule(pl.themolka.arcade.match.MatchModule)

Example 3 with MatchGame

use of pl.themolka.arcade.match.MatchGame 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);
    }
}
Also used : Participator(pl.themolka.arcade.game.Participator) MatchGame(pl.themolka.arcade.match.MatchGame) MatchWinner(pl.themolka.arcade.match.MatchWinner) MatchModule(pl.themolka.arcade.match.MatchModule) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

MatchGame (pl.themolka.arcade.match.MatchGame)3 MatchModule (pl.themolka.arcade.match.MatchModule)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Participator (pl.themolka.arcade.game.Participator)2 MatchWinner (pl.themolka.arcade.match.MatchWinner)2 GamePlayer (pl.themolka.arcade.game.GamePlayer)1 Observers (pl.themolka.arcade.match.Observers)1