Fix deserialization formatting error

This commit is contained in:
2023-06-03 00:27:34 +08:00
parent bcb88740f1
commit c6e0b51ea6
2 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ public final class OpenCommandHandler implements Router {
var req = context.bodyAsClass(JsonRequest.class); var req = context.bodyAsClass(JsonRequest.class);
if (req.action.equals("sendCode")) { if (req.action.equals("sendCode")) {
int playerId = (int) req.data; int playerId = Integer.parseInt(req.data.toString());
var player = plugin.getServer().getPlayerByUid(playerId); var player = plugin.getServer().getPlayerByUid(playerId);
if (player == null) { if (player == null) {
context.json(new JsonResponse(404, "Player Not Found.")); context.json(new JsonResponse(404, "Player Not Found."));

View File

@ -61,7 +61,7 @@ public final class OpenCommandOnlyHttpHandler implements Router {
var req = context.bodyAsClass(JsonRequest.class); var req = context.bodyAsClass(JsonRequest.class);
if (req.action.equals("sendCode")) { if (req.action.equals("sendCode")) {
int playerId = (int) req.data; int playerId = Integer.parseInt(req.data.toString());
var player = SocketData.getPlayer(playerId); var player = SocketData.getPlayer(playerId);
if (player == null) { if (player == null) {
context.json(new JsonResponse(404, "Player Not Found.")); context.json(new JsonResponse(404, "Player Not Found."));