|
|
@ -38,11 +38,23 @@ public class AdminController { |
|
|
|
public ResponseEntity kickPlayer( |
|
|
|
@CookieValue(value = "steam64", defaultValue = "") String steam64, |
|
|
|
@CookieValue(value = "steam64_secured", defaultValue = "") String steam64_secured, |
|
|
|
@RequestParam(value = "steam64", required = true) String kicked_steam64 |
|
|
|
@RequestParam(value = "steam64", required = false, defaultValue = "") String kicked_steam64, |
|
|
|
@RequestParam(value = "player_name", required = false, defaultValue = "") String player_name |
|
|
|
) { |
|
|
|
if(!saltedCookie.Validate(steam64, steam64_secured)) return new ResponseEntity<>(HttpStatus.FORBIDDEN); |
|
|
|
if(!ValidateAdmin(steam64, "z")) return new ResponseEntity<>(HttpStatus.FORBIDDEN); |
|
|
|
if(serverService.kickPlayer(profileService.GetProfile(kicked_steam64,List.of()))){ |
|
|
|
if(kicked_steam64.isEmpty() && player_name.isEmpty()) return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|
|
|
|
|
|
|
boolean result = false; |
|
|
|
if(!kicked_steam64.isEmpty()) { |
|
|
|
result = serverService.kickPlayer( |
|
|
|
profileService.GetProfile(kicked_steam64, List.of())); |
|
|
|
} else if (!player_name.isEmpty()) { |
|
|
|
result = serverService.kickPlayer( |
|
|
|
profileService.GetProfileOnPlayerOnServers(player_name, List.of())); |
|
|
|
} |
|
|
|
|
|
|
|
if(result){ |
|
|
|
return new ResponseEntity(HttpStatus.OK); |
|
|
|
} else { |
|
|
|
return new ResponseEntity(HttpStatus.NOT_FOUND); |
|
|
|