Small fixes
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m25s

This commit is contained in:
Braydon 2024-04-10 09:40:19 -04:00
parent 20adfaeaad
commit 2df4a7978c
3 changed files with 12 additions and 6 deletions

@ -238,9 +238,9 @@ public final class JavaMinecraftServer extends MinecraftServer {
@AllArgsConstructor @Getter @ToString @AllArgsConstructor @Getter @ToString
private static class Mod { private static class Mod {
/** /**
* The id of this mod. * The name of this mod.
*/ */
@NonNull @SerializedName("modid") private final String id; @NonNull @SerializedName("modid") private final String name;
/** /**
* The version of this mod. * The version of this mod.

@ -400,10 +400,12 @@ public final class MojangService {
} }
// Build our server model, cache it, and then return it // Build our server model, cache it, and then return it
MinecraftServer response = platform.getPinger().ping(hostname, port); // Ping the server and await a response
if (response == null) { // No response from ping
throw new ResourceNotFoundException("Server didn't respond to ping");
}
CachedMinecraftServer minecraftServer = new CachedMinecraftServer( CachedMinecraftServer minecraftServer = new CachedMinecraftServer(
platform.name() + "-" + lookupHostname, platform.name() + "-" + lookupHostname, response, System.currentTimeMillis()
platform.getPinger().ping(hostname, port),
System.currentTimeMillis()
); );
// Get the blocked status of the Java server // Get the blocked status of the Java server

@ -88,7 +88,11 @@ public final class JavaMinecraftServerPinger implements MinecraftServerPinger<Ja
// Send the status request to the server, and await back the response // Send the status request to the server, and await back the response
JavaPacketStatusInStart packetStatusInStart = new JavaPacketStatusInStart(); JavaPacketStatusInStart packetStatusInStart = new JavaPacketStatusInStart();
packetStatusInStart.process(inputStream, outputStream); packetStatusInStart.process(inputStream, outputStream);
JavaServerStatusToken token = AppConfig.GSON.fromJson(packetStatusInStart.getResponse(), JavaServerStatusToken.class); String response = packetStatusInStart.getResponse();
if (response == null) { // No response
throw new ResourceNotFoundException("Server didn't respond to status request");
}
JavaServerStatusToken token = AppConfig.GSON.fromJson(response, JavaServerStatusToken.class);
return JavaMinecraftServer.create(hostname, ip, port, token); // Return the server return JavaMinecraftServer.create(hostname, ip, port, token); // Return the server
} }
} catch (IOException ex) { } catch (IOException ex) {