protected void prepareAiPlayers() {
for (PlayerSlot slot : slots) {
if (slot != null && slot.isAi() && slot.isOwn()) {
try {
AiPlayer ai = (AiPlayer) Class.forName(slot.getAiClassName()).newInstance();
ai.setGame(game);
ai.setServer(getConnection(), getServer());
for (Player player : game.getAllPlayers()) {
if (player.getSlot().getNumber() == slot.getNumber()) {
ai.setPlayer(player);
break;
}
}
game.getEventBus().register(ai);
logger.info("AI player created - " + slot.getAiClassName());