@SuppressWarnings("WeakerAccess") protected void validatePlayerForGame(final IMPL game, final P player) { if (game instanceof MultiPlayerGame) { if (!game.getAllPlayers().contains(player)) { throw new PlayerNotPartOfGameException(); } } else if (game instanceof SinglePlayerGame) { if (!((SinglePlayerGame) game).getPlayer().equals(player)) { throw new PlayerNotPartOfGameException(); } } }