feat: code

This commit is contained in:
2025-12-19 03:45:28 -08:00
parent 71a9b971d0
commit 9b1f8ae827
2 changed files with 49 additions and 26 deletions

View File

@@ -181,7 +181,7 @@ public class BindRequest {
public class PlayerBindStatusResponse implements Serializable {
@SerializedName("status") private PlayerBindStatusEnum status;
@SerializedName("message") private String message;
@SerializedName("msg") private String message;
@SerializedName("cached") private boolean cached;
@@ -311,10 +311,10 @@ public class BindRequest {
});
}
public class PlayerBindResponse implements Serializable {
public static class PlayerBindResponse implements Serializable {
@SerializedName("status") private PlayerBindEnum status;
@SerializedName("timestamp") private long timestamp;
@SerializedName("message") private String message;
@SerializedName("msg") private String message;
public PlayerBindEnum getStatus() {
return status;
@@ -344,7 +344,7 @@ public class BindRequest {
@SerializedName("error") ERROR
}
private PlayerBindResponse createPlayerBindErrorResponse(String errorMessage) {
public static PlayerBindResponse createPlayerBindErrorResponse(String errorMessage) {
PlayerBindResponse errorRes = new PlayerBindResponse();
errorRes.setStatus(PlayerBindEnum.ERROR);
errorRes.setMessage(errorMessage);
@@ -356,13 +356,13 @@ public class BindRequest {
) {
String path = "/server/user-bind";
Map<String, String> params = new HashMap<>();
JsonObject json = new JsonObject();
params.put("web_email", webEmail);
params.put("mc_uuid", playerUuid);
params.put("mc_username", playerUsername);
json.addProperty("web_email", webEmail);
json.addProperty("mc_uuid", playerUuid);
json.addProperty("mc_username", playerUsername);
return networkService.getData(path, params)
return networkService.postData(path, json)
.thenApply(response -> {
Gson gson = new Gson();
String responseBody = response.getBody();