Package org.freerealm.history

Examples of org.freerealm.history.FreeRealmPlayerHistory


        xml.append("</playerHistory>\n");
        return xml.toString();
    }

    public PlayerHistory initializeFromNode(Realm realm, Node node) {
        PlayerHistory playerHistory = new FreeRealmPlayerHistory();
        Node playerIdNode = XMLConverterUtility.findNode(node, "playerId");
        int playerId = Integer.parseInt(playerIdNode.getFirstChild().getNodeValue());
        playerHistory.setPlayer(realm.getPlayerManager().getPlayer(playerId));
        Node playerHistoryTurnsNode = XMLConverterUtility.findNode(node, "playerHistoryTurns");
        for (Node playerTurnHistoryNode = playerHistoryTurnsNode.getFirstChild(); playerTurnHistoryNode != null; playerTurnHistoryNode = playerTurnHistoryNode.getNextSibling()) {
            if (playerTurnHistoryNode.getNodeType() == Node.ELEMENT_NODE) {
                PlayerTurnHistory playerTurnHistory = new FreeRealmPlayerTurnHistoryXMLConverter().initializeFromNode(realm, playerTurnHistoryNode);
                playerHistory.addTurnHistory(playerTurnHistory);
            }
        }
        return playerHistory;
    }
View Full Code Here


        return new CommandResult(CommandResult.RESULT_OK, "", CommandResult.TURN_ENDED_UPDATE);
    }

    private void managePlayerHistory(Player player) {
        if (realm.getHistory().getPlayerHistory(player) == null) {
            PlayerHistory playerHistory = new FreeRealmPlayerHistory();
            playerHistory.setPlayer(player);
            realm.getHistory().addPlayerHistory(player, playerHistory);
        }
        PlayerTurnHistory playerTurnHistory = new FreeRealmPlayerTurnHistory();
        playerTurnHistory.setTurn(realm.getNumberOfTurns());
        playerTurnHistory.setPopulation(player.getPopulation());
View Full Code Here

TOP

Related Classes of org.freerealm.history.FreeRealmPlayerHistory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.