jdash.client.response.LevelSearchResponseDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdash-client Show documentation
Show all versions of jdash-client Show documentation
The HTTP client used to pull data from Geometry Dash servers
The newest version!
package jdash.client.response;
import jdash.client.exception.ActionFailedException;
import jdash.common.entity.GDLevel;
import jdash.common.entity.GDSong;
import jdash.common.internal.GDCreatorInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import static jdash.common.internal.InternalUtils.*;
class LevelSearchResponseDeserializer implements Function> {
@Override
public List apply(String response) {
ActionFailedException.throwIfEquals(response, "-1", "Failed to load levels");
ArrayList list = new ArrayList<>();
String[] split1 = response.split("#");
String levels = split1[0];
String creators = split1[1];
String songs = split1[2];
Map structuredCreatorsInfo = structureCreatorsInfo(creators);
Map structuredSongsInfo = structureSongsInfo(songs);
String[] levelArray = levels.split("\\|");
for (String l : levelArray) {
Map data = splitToMap(l, ":");
list.add(buildLevel(data, structuredCreatorsInfo, structuredSongsInfo));
}
return list;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy