fix server example and add an endpoint to get uuid from username
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Failing after 24s

This commit is contained in:
Lee
2024-04-11 00:21:36 +01:00
parent 624dcc0be6
commit a3b9cb5e77
4 changed files with 18 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@RestController
@ -36,6 +37,17 @@ public class PlayerController {
.body(playerService.getPlayer(id));
}
@ResponseBody
@GetMapping(value = "/uuid/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getPlayerUuid(
@Parameter(description = "The UUID or Username of the player", example = "ImFascinated") @PathVariable String id) {
CachedPlayer player = playerService.getPlayer(id);
return ResponseEntity.ok(Map.of(
"username", player.getUsername(),
"uuid", player.getUuid().toString()
));
}
@GetMapping(value = "/{part}/{id}")
public ResponseEntity<?> getPlayerHead(
@Parameter(description = "The part of the skin", example = "head") @PathVariable String part,