From 0015682fe47f6289e583f9f43dc36db6d5271eb3 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Mon, 12 Oct 2020 09:51:33 +0200 Subject: [PATCH] Add warning on startup for 1.8 users --- .../main/java/us/myles/ViaVersion/BungeePlugin.java | 5 +++++ .../main/java/us/myles/ViaVersion/ViaManager.java | 3 +++ .../myles/ViaVersion/api/platform/ViaPlatform.java | 12 +++++++++++- .../java/us/myles/ViaVersion/VelocityPlugin.java | 5 +++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java b/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java index bfb2ee78e..e077bc26e 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java +++ b/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java @@ -85,6 +85,11 @@ public class BungeePlugin extends Plugin implements ViaPlatform, return getProxy().getVersion(); } + @Override + public boolean isProxy() { + return true; + } + @Override public String getPluginVersion() { return getDescription().getVersion(); diff --git a/common/src/main/java/us/myles/ViaVersion/ViaManager.java b/common/src/main/java/us/myles/ViaVersion/ViaManager.java index 92653a1bc..f8cf10cb8 100644 --- a/common/src/main/java/us/myles/ViaVersion/ViaManager.java +++ b/common/src/main/java/us/myles/ViaVersion/ViaManager.java @@ -97,6 +97,9 @@ public class ViaManager { platform.getLogger().warning("If you need support for older versions you may need to use one or more ViaVersion addons too."); platform.getLogger().warning("In that case please read the ViaVersion resource page carefully or use https://jo0001.github.io/ViaSetup"); platform.getLogger().warning("and if you're still unsure, feel free to join our Discord-Server for further assistance."); + } else if (ProtocolRegistry.SERVER_PROTOCOL == ProtocolVersion.v1_8.getId() && !platform.isProxy()) { + platform.getLogger().warning("This version of Minecraft is over half a decade old and support for it will be fully dropped eventually. " + + "Please upgrade to a newer version to avoid encountering bugs and stability issues that have long been fixed."); } } // Load Listeners / Tasks diff --git a/common/src/main/java/us/myles/ViaVersion/api/platform/ViaPlatform.java b/common/src/main/java/us/myles/ViaVersion/api/platform/ViaPlatform.java index 4c04c71c4..00a5950d3 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/platform/ViaPlatform.java +++ b/common/src/main/java/us/myles/ViaVersion/api/platform/ViaPlatform.java @@ -16,6 +16,7 @@ import java.util.logging.Logger; * @param - The player type for the platform, used for API related methods */ public interface ViaPlatform { + /** * Get the logger for this platform * @@ -33,10 +34,19 @@ public interface ViaPlatform { /** * Get the platform version * - * @return Platforn version + * @return Platform version */ String getPlatformVersion(); + /** + * Returns true if the server Via is running on is a proxy server. + * + * @return true if the platform is a proxy + */ + default boolean isProxy() { + return false; + } + /** * Get the plugin version * diff --git a/velocity/src/main/java/us/myles/ViaVersion/VelocityPlugin.java b/velocity/src/main/java/us/myles/ViaVersion/VelocityPlugin.java index 1a232aeef..041f8b525 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/VelocityPlugin.java +++ b/velocity/src/main/java/us/myles/ViaVersion/VelocityPlugin.java @@ -102,6 +102,11 @@ public class VelocityPlugin implements ViaPlatform { return (version != null) ? version : "Unknown"; } + @Override + public boolean isProxy() { + return true; + } + @Override public String getPluginVersion() { return VersionInfo.VERSION;