use of pl.themolka.arcade.game.GamePlayer 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.GamePlayer in project Arcade2 by ShootGame.
the class SpawnApply method spawn.
public Location spawn(GamePlayer player) {
Player bukkit = player.getBukkit();
if (bukkit != null && bukkit.isOnline()) {
AgentFactory factory = this.getAgentFactory();
SpawnAgent agent = factory.createAgent(this.getSpawn(), player, bukkit);
if (agent != null) {
return agent.spawn();
}
}
return null;
}
use of pl.themolka.arcade.game.GamePlayer in project Arcade2 by ShootGame.
the class TeamApplyListeners method playerPlay.
@Handler(priority = Priority.LOWEST)
public void playerPlay(PlayerJoinedTeamEvent event) {
GamePlayer player = event.getGamePlayer();
Team team = event.getTeam();
if (this.shouldApplyTo(team)) {
player.getPlayer().clearInventory(true);
team.getApplyContext().applyAll(player, MatchApplyContext.EventType.PLAYER_PLAY);
}
}
use of pl.themolka.arcade.game.GamePlayer in project Arcade2 by ShootGame.
the class TeamCommands method forceCommand.
public void forceCommand(Sender sender, String username, String teamId) {
GamePlayer player = this.fetchPlayer(username);
Team team = this.fetchTeam(teamId);
if (team.contains(player)) {
throw new CommandException(player.getUsername() + " is already member of " + team.getName() + ".");
}
team.joinForce(player);
sender.sendSuccess(player.getUsername() + " has been moved to " + team.getName() + ".");
}
use of pl.themolka.arcade.game.GamePlayer in project Arcade2 by ShootGame.
the class TeamCommands method clearCommand.
//
// Commands
//
public void clearCommand(Sender sender, String teamId) {
Team team = this.fetchTeam(teamId);
if (team.isObservers()) {
throw new CommandException("Cannot clear observers.");
}
Observers observers = this.game.getMatch().getObservers();
int result = 0;
for (GamePlayer player : new ArrayList<>(team.getOnlineMembers())) {
observers.joinForce(player);
result++;
}
if (result > 0) {
sender.sendSuccess(team.getName() + " has been cleared (" + result + " players) and moved to " + observers.getName() + ".");
} else {
sender.sendError("No players to clear.");
}
}
Aggregations