jdash.client.response.UserStatsListResponseDeserializer 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.GDUserStats;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import static jdash.common.internal.InternalUtils.buildUserStats;
import static jdash.common.internal.InternalUtils.splitToMap;
class UserStatsListResponseDeserializer implements Function> {
@Override
public List apply(String response) {
ActionFailedException.throwIfEquals(response, "-1", "Failed to load user(s)");
final var list = new ArrayList();
final var users = response.split("#")[0].split("\\|");
for (String user : users) {
list.add(buildUserStats(splitToMap(user, ":")));
}
return list;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy