From b6c483ce92bb0a3f496fb994cc458b4ec9c09bee Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 25 Apr 2024 16:26:03 +1000 Subject: [PATCH] Fix unit tests always seeing Mojang server as unavailable By: md_5 --- .../condition/EnableIfMojangServerAvailableCondition.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paper-server/src/test/java/org/bukkit/support/condition/EnableIfMojangServerAvailableCondition.java b/paper-server/src/test/java/org/bukkit/support/condition/EnableIfMojangServerAvailableCondition.java index 89819cbbf3..d88cc6cea8 100644 --- a/paper-server/src/test/java/org/bukkit/support/condition/EnableIfMojangServerAvailableCondition.java +++ b/paper-server/src/test/java/org/bukkit/support/condition/EnableIfMojangServerAvailableCondition.java @@ -2,6 +2,7 @@ package org.bukkit.support.condition; import com.mojang.authlib.yggdrasil.YggdrasilEnvironment; import java.net.InetAddress; +import java.net.URI; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.extension.ConditionEvaluationResult; import org.junit.jupiter.api.extension.ExecutionCondition; @@ -12,7 +13,8 @@ public class EnableIfMojangServerAvailableCondition implements ExecutionConditio @Override public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext extensionContext) { try { - InetAddress address = InetAddress.getByName(YggdrasilEnvironment.PROD.getEnvironment().servicesHost()); + URI url = new URI(YggdrasilEnvironment.PROD.getEnvironment().servicesHost()); + InetAddress address = InetAddress.getByName(url.getHost()); if (!address.isReachable((int) TimeUnit.SECONDS.toMillis(1))) { return ConditionEvaluationResult.disabled("Mojang server is not available");