From 764c8ed3e5fb749b6443f2b96eee6933bf1fcb5f Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 30 Aug 2020 07:09:52 -0400 Subject: [PATCH] Fix compile error While we're at it, change the newly-introduced shutdown API to use a generic Adventure component instead. --- .../com/velocitypowered/api/proxy/ProxyServer.java | 4 +--- .../com/velocitypowered/proxy/VelocityServer.java | 12 ++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java b/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java index 7e2e570c4..874ee595c 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java @@ -18,8 +18,6 @@ import java.util.Collection; import java.util.Optional; import java.util.UUID; import net.kyori.adventure.audience.Audience; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import org.checkerframework.checker.nullness.qual.NonNull; /** @@ -32,7 +30,7 @@ public interface ProxyServer extends Audience { * * @param reason message to kick online players with */ - void shutdown(TextComponent reason); + void shutdown(net.kyori.adventure.text.Component reason); /** * Shuts down the proxy, kicking players with the default reason. diff --git a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java index 7bbb35f0c..5e4382443 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java @@ -76,9 +76,9 @@ import java.util.function.IntFunction; import java.util.stream.Collectors; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.ForwardingAudience; +import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TranslatableComponent; -import net.kyori.text.Component; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.asynchttpclient.AsyncHttpClient; @@ -168,7 +168,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience { @Override public @NonNull BossBar createBossBar( - @NonNull Component title, + net.kyori.text.@NonNull Component title, @NonNull BossBarColor color, @NonNull BossBarOverlay overlay, float progress) { @@ -392,7 +392,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience { * @param explicitExit whether the user explicitly shut down the proxy * @param reason message to kick online players with */ - public void shutdown(boolean explicitExit, TextComponent reason) { + public void shutdown(boolean explicitExit, Component reason) { if (eventManager == null || pluginManager == null || cm == null || scheduler == null) { throw new AssertionError(); } @@ -461,7 +461,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience { } /** - * Calls {@link #shutdown(boolean, TextComponent)} with the default reason "Proxy shutting down." + * Calls {@link #shutdown(boolean, Component)} with the default reason "Proxy shutting down." * * @param explicitExit whether the user explicitly shut down the proxy */ @@ -470,7 +470,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience { } @Override - public void shutdown(TextComponent reason) { + public void shutdown(Component reason) { shutdown(true, reason); } @@ -554,7 +554,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience { } @Override - public void broadcast(Component component) { + public void broadcast(net.kyori.text.Component component) { Preconditions.checkNotNull(component, "component"); Chat chat = Chat.createClientbound(component); for (ConnectedPlayer player : connectionsByUuid.values()) {