diff --git a/build.gradle b/build.gradle index 74bed65..60b1644 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { } setGroup("net.elytrium") -setVersion("1.1.5") +setVersion("1.1.6") compileJava { getOptions().setEncoding("UTF-8") diff --git a/gradle.properties b/gradle.properties index 67cfbce..4425632 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -limboapiVersion=1.1.18 +limboapiVersion=1.1.23 velocityVersion=3.3.0-SNAPSHOT nettyVersion=4.1.106.Final serializerVersion=1.1.1 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 15de902..0d18421 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/net/elytrium/limboreconnect/Config.java b/src/main/java/net/elytrium/limboreconnect/Config.java index 843e460..2ae915e 100644 --- a/src/main/java/net/elytrium/limboreconnect/Config.java +++ b/src/main/java/net/elytrium/limboreconnect/Config.java @@ -139,9 +139,6 @@ public static class Title { public String title; public String subtitle = "Please wait..."; - public Title() { - } - public Title(String title) { this.title = title; } diff --git a/src/main/java/net/elytrium/limboreconnect/LimboReconnect.java b/src/main/java/net/elytrium/limboreconnect/LimboReconnect.java index b63dfe6..396804f 100644 --- a/src/main/java/net/elytrium/limboreconnect/LimboReconnect.java +++ b/src/main/java/net/elytrium/limboreconnect/LimboReconnect.java @@ -75,12 +75,6 @@ public LimboReconnect(Logger logger, ProxyServer server, @DataDirectory Path dat setLogger(logger); this.server = server; - try { - MinecraftConnection.class.getDeclaredMethod("getActiveSessionHandler"); - } catch (Throwable throwable) { - throw new UnsupportedOperationException("You are using outdated Velocity! Please update Velocity to b266+"); - } - this.dataDirectory = dataDirectory; this.configPath = dataDirectory.resolve("config.yml"); @@ -171,9 +165,8 @@ public void addPlayer(Player player, RegisteredServer server) { MinecraftConnection connection = connectedPlayer.getConnection(); MinecraftSessionHandler minecraftSessionHandler = connection.getActiveSessionHandler(); if (minecraftSessionHandler != null) { - if (minecraftSessionHandler instanceof ClientPlaySessionHandler) { - ClientPlaySessionHandler sessionHandler = (ClientPlaySessionHandler) minecraftSessionHandler; - for (UUID bossBar : sessionHandler.getServerBossBars()) { + if (minecraftSessionHandler instanceof ClientPlaySessionHandler sessionHandler) { + for (UUID bossBar : sessionHandler.getServerBossBars()) { BossBarPacket deletePacket = new BossBarPacket(); deletePacket.setUuid(bossBar); deletePacket.setAction(BossBarPacket.REMOVE); diff --git a/src/main/java/net/elytrium/limboreconnect/commands/LimboReconnectCommand.java b/src/main/java/net/elytrium/limboreconnect/commands/LimboReconnectCommand.java index de34ce1..d745b6a 100644 --- a/src/main/java/net/elytrium/limboreconnect/commands/LimboReconnectCommand.java +++ b/src/main/java/net/elytrium/limboreconnect/commands/LimboReconnectCommand.java @@ -34,7 +34,7 @@ public class LimboReconnectCommand implements SimpleCommand { private static final List HELP_MESSAGE = List.of(Component.text("This server is using LimboReconnect and LimboAPI.", NamedTextColor.YELLOW), - Component.text("(C) 2022 - 2023 Elytrium", NamedTextColor.YELLOW), Component.text("https://elytrium.net/github/", NamedTextColor.GREEN), + Component.text("(C) 2022 - 2024 Elytrium", NamedTextColor.YELLOW), Component.text("https://elytrium.net/github/", NamedTextColor.GREEN), Component.empty() ); @@ -94,10 +94,9 @@ public boolean hasPermission(Invocation invocation) { private void showHelp(CommandSource source) { HELP_MESSAGE.forEach(source::sendMessage); - List availableSubcommands = Arrays.stream(Subcommand.values()).filter(command -> command.hasPermission(source)) - .collect(Collectors.toList()); + List availableSubcommands = Arrays.stream(Subcommand.values()).filter(command -> command.hasPermission(source)).toList(); - if (availableSubcommands.size() > 0) { + if (!availableSubcommands.isEmpty()) { source.sendMessage(AVAILABLE_SUBCOMMANDS_MESSAGE); availableSubcommands.forEach(command -> source.sendMessage(command.getMessageLine())); } else { diff --git a/src/main/java/net/elytrium/limboreconnect/handler/ReconnectHandler.java b/src/main/java/net/elytrium/limboreconnect/handler/ReconnectHandler.java index 17c9c44..62fecf7 100644 --- a/src/main/java/net/elytrium/limboreconnect/handler/ReconnectHandler.java +++ b/src/main/java/net/elytrium/limboreconnect/handler/ReconnectHandler.java @@ -30,6 +30,7 @@ public class ReconnectHandler implements LimboSessionHandler { + private final PingOptions pingOptions = PingOptions.builder().timeout(Duration.ofMillis(CONFIG.pingTimeout)).build(); private final LimboReconnect plugin; private final RegisteredServer server; private LimboPlayer player; @@ -61,10 +62,7 @@ private void tick() { return; } - PingOptions.Builder options = PingOptions.builder(); - options.timeout(Duration.ofMillis(CONFIG.pingTimeout)); - - this.server.ping(options.build()).whenComplete((ping, exception) -> { + this.server.ping(this.pingOptions).whenComplete((ping, exception) -> { if (exception != null) { if (CONFIG.debug) { LimboReconnect.getLogger()