Update docs

This commit is contained in:
Braydon 2024-04-06 22:37:44 -04:00
parent 1a268a4496
commit 15e8403eef
2 changed files with 3 additions and 2 deletions

@ -138,12 +138,13 @@ public final class MojangService {
* @param platformName the name of the platform * @param platformName the name of the platform
* @param hostname the hostname of the server * @param hostname the hostname of the server
* @return the resolved Minecraft server * @return the resolved Minecraft server
* @throws BadRequestException if the hostname is unknown
* @throws InvalidMinecraftServerPlatform if the platform is invalid * @throws InvalidMinecraftServerPlatform if the platform is invalid
* @throws ResourceNotFoundException if the server isn't found * @throws ResourceNotFoundException if the server isn't found
*/ */
@NonNull @NonNull
public MinecraftServer getMinecraftServer(@NonNull String platformName, @NonNull String hostname) public MinecraftServer getMinecraftServer(@NonNull String platformName, @NonNull String hostname)
throws InvalidMinecraftServerPlatform, ResourceNotFoundException { throws BadRequestException, InvalidMinecraftServerPlatform, ResourceNotFoundException {
MinecraftServer.Platform platform = EnumUtils.getEnumConstant(MinecraftServer.Platform.class, platformName.toUpperCase()); MinecraftServer.Platform platform = EnumUtils.getEnumConstant(MinecraftServer.Platform.class, platformName.toUpperCase());
if (platform == null) { // Invalid platform if (platform == null) { // Invalid platform
throw new InvalidMinecraftServerPlatform(); throw new InvalidMinecraftServerPlatform();

@ -68,7 +68,7 @@ public final class JavaMinecraftServerPinger implements MinecraftServerPinger<Ja
} catch (IOException ex) { } catch (IOException ex) {
if (ex instanceof UnknownHostException) { if (ex instanceof UnknownHostException) {
throw new BadRequestException("Unknown hostname: %s".formatted(hostname)); throw new BadRequestException("Unknown hostname: %s".formatted(hostname));
} else if (ex instanceof ConnectException) { } else if (ex instanceof ConnectException || ex instanceof SocketTimeoutException) {
throw new ResourceNotFoundException(ex); throw new ResourceNotFoundException(ex);
} }
log.error("An error occurred pinging %s:%s:".formatted(hostname, port), ex); log.error("An error occurred pinging %s:%s:".formatted(hostname, port), ex);