use of pl.themolka.arcade.game.Game in project Arcade2 by ShootGame.
the class Sessions method createSession.
//
// Create Session
//
public CreatedPlayerInfo createSession(Player bukkit) {
ArcadePlayer player = new ArcadePlayer(this.plugin, bukkit);
boolean restored = false;
Game game = this.plugin.getGames().getCurrentGame();
if (game != null) {
// try to restore the GamePlayer first
GamePlayer gamePlayer = game.getPlayer(bukkit);
if (gamePlayer != null) {
restored = true;
} else {
gamePlayer = new GamePlayer(game, player);
}
// link objects
gamePlayer.setPlayer(player);
player.setGamePlayer(gamePlayer);
// register
game.getPlayers().playerJoin(gamePlayer);
// I don't know ;d
gamePlayer.setParticipating(false);
gamePlayer.reset();
gamePlayer.refreshVisibilityArcadePlayer(this.plugin.getPlayers());
}
this.plugin.addPlayer(player);
this.publish(new pl.themolka.arcade.session.PlayerJoinEvent(this.plugin, player, restored));
return new CreatedPlayerInfo(player, restored);
}
use of pl.themolka.arcade.game.Game in project Arcade2 by ShootGame.
the class Sessions method onPlayerRespawn.
//
// Respawn Event
//
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerRespawn(PlayerRespawnEvent event) {
ArcadePlayer player = this.plugin.getPlayer(event.getPlayer().getUniqueId());
Game game = this.plugin.getGames().getCurrentGame();
if (game != null) {
pl.themolka.arcade.respawn.PlayerRespawnEvent respawnEvent = new pl.themolka.arcade.respawn.PlayerRespawnEvent(this.plugin, player);
respawnEvent.setRespawnPosition(game.getMap().getManifest().getWorld().getSpawn());
this.publish(respawnEvent);
Location respawnPosition = respawnEvent.getRespawnPosition();
if (respawnPosition != null) {
event.setRespawnLocation(respawnPosition);
}
}
}
Aggregations