/** * Get a SpriteEntity list from a ByteBuffer. * * @param p_buffer * @return List<SpriteEntity> */ public static List<SpriteEntity> deserializeEntities(EasyBuffering p_buffer) { List<SpriteEntity> entities = new ArrayList<SpriteEntity>(); while (!p_buffer.eof()) { entities.add(SpriteEntity.deserialize(p_buffer)); } return entities; }
/** * Read the servers configuration file to return a list of {@link ServerInfo}.<br> * In any error case, return an empty list. * * @return List<ServerInfo> */ public static List<ServerInfo> loadServersInfos() { List<ServerInfo> infos = new ArrayList<ServerInfo>(); try { EasyBuffering file = Zildo.pdPlugin.openFile(Constantes.SERVER_FILE); while (!file.eof()) { String name = file.readString(); String ip = file.readString(); int port = file.readInt(); infos.add(new ServerInfo(name, ip, port)); } return infos; } catch (Exception e) { return infos; } }