public static void loadPlayer(Registry registry) { Player p = (Player) getPlayers().get(player); if (p != null) { p.setTransient(registry); } GameController gc = registry.getGameController(); registry.getPlayerManager().clearPlayers(); registry.getPlayerManager().registerPlayer(p); BlockManager bm = (BlockManager) blockManagers.get(player); bm.name = "Saved"; bm = (BlockManager) bm.clone(); bm.name = "Clone"; bm.setTransient(registry); gc.setBlockManager(bm); PlaceableManager pm = (PlaceableManager) placeableManagers.get(player).clone(); gc.setPlaceableManager(pm); MonsterManager mm = (MonsterManager) monsterManagers.get(player).clone(); mm.setTransient(registry); gc.setMonsterManager(mm); if (p != null) { p.resetPlayer(); } // unloadUnused(); }
// public static void unloadUnused() { // if (player > -1) { // for (int i = 0; i < NUMBER_OF_PLAYER_SLOTS; i++) { // if (i != player) { // players.set(i, null); // blockManagers.set(i, null); // placeableManagers.set(i, null); // monsterManagers.set(i, null); // } // } // } // } public static ArrayList getPlayerList() { ArrayList names = new ArrayList(); for (int i = 0; i < players.size(); i++) { Player p = players.get(i); if (p != null) { names.add(p.getName()); } else { names.add(""); } } return names; }