From fbb24bb9040e1e50a8284fd7712eca633c652057 Mon Sep 17 00:00:00 2001 From: Gravita Date: Wed, 10 Nov 2021 23:44:19 +0700 Subject: [PATCH] [ANY] Deprecated old features --- .../main/java/pro/gravit/launchserver/LaunchServer.java | 3 +-- .../launchserver/command/handler/CommandHandler.java | 1 + .../launchserver/command/service/PingServersCommand.java | 1 + .../launchserver/command/service/SecurityCheckCommand.java | 6 ------ .../pro/gravit/launchserver/config/LaunchServerConfig.java | 2 +- .../gravit/launchserver/manangers/PingServerManager.java | 1 + .../pro/gravit/launchserver/socket/WebSocketService.java | 7 ++----- .../response/management/PingServerReportResponse.java | 1 + .../socket/response/management/PingServerResponse.java | 1 + .../java/pro/gravit/launcher/events/ExceptionEvent.java | 1 + .../main/java/pro/gravit/launcher/events/PingEvent.java | 1 + .../main/java/pro/gravit/launcher/events/SignalEvent.java | 1 + .../java/pro/gravit/launcher/events/request/LogEvent.java | 1 + .../events/request/PingServerReportRequestEvent.java | 1 + .../launcher/events/request/PingServerRequestEvent.java | 1 + .../launcher/events/request/RegisterRequestEvent.java | 1 + .../request/websockets/ClientWebSocketService.java | 1 + .../launcher/request/websockets/StdWebSocketService.java | 2 +- 18 files changed, 18 insertions(+), 15 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java index 622e0894..fe7be0da 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java @@ -102,6 +102,7 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab public final AuthManager authManager; public final ReconfigurableManager reconfigurableManager; public final ConfigManager configManager; + @Deprecated public final PingServerManager pingServerManager; public final FeaturesManager featuresManager; public final KeyAgreementManager keyAgreementManager; @@ -403,14 +404,12 @@ public void restart() { } } - @SuppressWarnings("deprecation") public void registerObject(String name, Object object) { if (object instanceof Reconfigurable) { reconfigurableManager.registerReconfigurable(name, (Reconfigurable) object); } } - @SuppressWarnings("deprecation") public void unregisterObject(String name, Object object) { if (object instanceof Reconfigurable) { reconfigurableManager.unregisterReconfigurable(name); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java index 52c58a72..e794977d 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java @@ -16,6 +16,7 @@ import pro.gravit.utils.command.basic.HelpCommand; public abstract class CommandHandler extends pro.gravit.utils.command.CommandHandler { + @SuppressWarnings("deprecation") public static void registerCommands(pro.gravit.utils.command.CommandHandler handler, LaunchServer server) { BaseCommandCategory basic = new BaseCommandCategory(); // Register basic commands diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/PingServersCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/PingServersCommand.java index 988207e5..368c71de 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/PingServersCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/PingServersCommand.java @@ -6,6 +6,7 @@ import pro.gravit.launchserver.LaunchServer; import pro.gravit.launchserver.command.Command; +@Deprecated public class PingServersCommand extends Command { private transient final Logger logger = LogManager.getLogger(); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java index 486cc769..30db46a8 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java @@ -85,12 +85,6 @@ public void invoke(String... args) { printCheckResult("netty.address", "", true); } - if (config.netty.sendExceptionEnabled) { - printCheckResult("netty.sendExceptionEnabled", "recommend \"false\" in production", false); - } else { - printCheckResult("netty.sendExceptionEnabled", "", true); - } - if (config.netty.launcherURL.startsWith("http://")) { printCheckResult("netty.launcherUrl", "launcher jar download connection not secure", false); } else if (config.netty.launcherURL.startsWith("https://")) { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index 3ba63457..d7cd9bb7 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -77,7 +77,6 @@ public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) { newConfig.netty = new NettyConfig(); newConfig.netty.fileServerEnabled = true; - newConfig.netty.sendExceptionEnabled = false; newConfig.netty.binds = new NettyBindAddress[]{new NettyBindAddress("0.0.0.0", 9274)}; newConfig.netty.performance = new NettyPerformanceConfig(); try { @@ -286,6 +285,7 @@ public static class LauncherConf { public static class NettyConfig { public boolean fileServerEnabled; + @Deprecated public boolean sendExceptionEnabled; public boolean ipForwarding; public boolean disableWebApiInterface; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/PingServerManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/PingServerManager.java index 7a56985f..624d40e0 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/PingServerManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/PingServerManager.java @@ -7,6 +7,7 @@ import java.util.HashMap; import java.util.Map; +@Deprecated public class PingServerManager { public static final long REPORT_EXPIRED_TIME = 20 * 1000; public final Map map = new HashMap<>(); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/WebSocketService.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/WebSocketService.java index 0df4ad31..32d252e9 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/WebSocketService.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/WebSocketService.java @@ -65,6 +65,7 @@ public WebSocketService(ChannelGroup channels, LaunchServer server) { this.gson = Launcher.gsonManager.gson; } + @SuppressWarnings("deprecation") public static void registerResponses() { providers.register("auth", AuthResponse.class); providers.register("checkServer", CheckServerResponse.class); @@ -165,11 +166,7 @@ void process(ChannelHandlerContext ctx, WebSocketServerResponse response, Client } catch (Exception e) { logger.error("WebSocket request processing failed", e); RequestEvent event; - if (server.config.netty.sendExceptionEnabled) { - event = new ExceptionEvent(e); - } else { - event = new ErrorRequestEvent("Fatal server error. Contact administrator"); - } + event = new ErrorRequestEvent("Fatal server error. Contact administrator"); if (response instanceof SimpleResponse) { event.requestUUID = ((SimpleResponse) response).requestUUID; } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerReportResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerReportResponse.java index f7c5fcdf..60ab706c 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerReportResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerReportResponse.java @@ -6,6 +6,7 @@ import pro.gravit.launchserver.socket.Client; import pro.gravit.launchserver.socket.response.SimpleResponse; +@Deprecated public class PingServerReportResponse extends SimpleResponse { public PingServerReportRequest.PingServerReport data; public String name; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerResponse.java index 2917a938..dfac108a 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerResponse.java @@ -11,6 +11,7 @@ import java.util.List; import java.util.Map; +@Deprecated public class PingServerResponse extends SimpleResponse { public List serverNames; //May be null diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/ExceptionEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/ExceptionEvent.java index 910d8395..f91a01e7 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/ExceptionEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/ExceptionEvent.java @@ -2,6 +2,7 @@ import pro.gravit.launcher.LauncherNetworkAPI; +@Deprecated public class ExceptionEvent extends RequestEvent { @LauncherNetworkAPI public final String message; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/PingEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/PingEvent.java index 6a26ea14..8921d2ed 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/PingEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/PingEvent.java @@ -2,5 +2,6 @@ //Пустое событие //Все обработчики обязаны его игнорировать +@Deprecated public final class PingEvent { } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/SignalEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/SignalEvent.java index c4ff91f6..98a21d24 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/SignalEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/SignalEvent.java @@ -4,6 +4,7 @@ import pro.gravit.launcher.request.WebSocketEvent; //Используется, что бы послать короткое сообщение, которое вмещается в int +@Deprecated public class SignalEvent implements WebSocketEvent { @LauncherNetworkAPI public final int signal; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/LogEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/LogEvent.java index c09a607e..6f3e4b49 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/LogEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/LogEvent.java @@ -3,6 +3,7 @@ import pro.gravit.launcher.LauncherNetworkAPI; import pro.gravit.launcher.request.WebSocketEvent; +@Deprecated public class LogEvent implements WebSocketEvent { @LauncherNetworkAPI public final String string; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/PingServerReportRequestEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/PingServerReportRequestEvent.java index ed45ae0f..395dbe32 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/PingServerReportRequestEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/PingServerReportRequestEvent.java @@ -2,6 +2,7 @@ import pro.gravit.launcher.events.RequestEvent; +@Deprecated public class PingServerReportRequestEvent extends RequestEvent { @Override public String getType() { diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/PingServerRequestEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/PingServerRequestEvent.java index c4bf8558..2f8277d3 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/PingServerRequestEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/PingServerRequestEvent.java @@ -5,6 +5,7 @@ import java.util.Map; +@Deprecated public class PingServerRequestEvent extends RequestEvent { public Map serverMap; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/RegisterRequestEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/RegisterRequestEvent.java index f08506c8..1d98c4de 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/RegisterRequestEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/RegisterRequestEvent.java @@ -2,6 +2,7 @@ import pro.gravit.launcher.events.RequestEvent; +@Deprecated public class RegisterRequestEvent extends RequestEvent { @Override public String getType() { diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientWebSocketService.java b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientWebSocketService.java index 44ca653f..4e035caf 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientWebSocketService.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientWebSocketService.java @@ -81,6 +81,7 @@ public void registerRequests() { } + @SuppressWarnings("deprecation") public void registerResults() { results.register("auth", AuthRequestEvent.class); results.register("checkServer", CheckServerRequestEvent.class); diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/StdWebSocketService.java b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/StdWebSocketService.java index 6816ad64..8d6d6445 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/StdWebSocketService.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/StdWebSocketService.java @@ -71,7 +71,7 @@ public void processEventHandlers(T event) { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "deprecation"}) public void eventHandle(T webSocketEvent) { if (webSocketEvent instanceof RequestEvent) { RequestEvent event = (RequestEvent) webSocketEvent;