generic tweaks

started implementation of FightDetector
This commit is contained in:
2025-06-09 13:52:39 +02:00
parent a4289d5ac9
commit b1f188dece
12 changed files with 158 additions and 44 deletions

View File

@ -92,7 +92,12 @@ public abstract class HttpRepository extends Repository {
private <TResponse> ReqResp<TResponse> execute(HttpRequest request, Class<TResponse> clazz) {
ReqResp<String> rawResponse = this.sendHttp(request);
Main.logger().info(String.format("HTTP-Repository fired %s, response: %s", request, rawResponse));
Main.logger().info(String.format(
"HTTP-Repository fired %s, sending: %s, response: %s",
request,
request.bodyPublisher().orElse(HttpRequest.BodyPublishers.ofString("none")),
rawResponse
));
return new ReqResp<>(rawResponse.status(), this.gson.fromJson(rawResponse.data(), clazz));
}

View File

@ -1,6 +1,7 @@
package eu.mhsl.craftattack.spawn.core.api.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import eu.mhsl.craftattack.spawn.core.Main;
import org.bukkit.Bukkit;
@ -12,7 +13,9 @@ public abstract class Repository {
public Repository(URI basePath) {
this.basePath = basePath;
this.gson = new Gson();
this.gson = new GsonBuilder()
.serializeNulls()
.create();
}
protected void validateThread(String commandName) {