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
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Failing after 24s
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user