From f8e65c179bdb47e49fb86851ef93288ef9c31103 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Thu, 14 Apr 2022 17:20:38 -0500 Subject: [PATCH] fix a few things --- build.gradle.kts | 4 ++-- src/main/java/dev/plex/BukkitTelnetModule.java | 5 +++++ .../java/dev/plex/listener/BukkitTelnetListener.java | 12 ++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7cce7d7..700bc55 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,9 +29,9 @@ dependencies { compileOnly("org.projectlombok:lombok:1.18.22") annotationProcessor("org.projectlombok:lombok:1.18.22") compileOnly("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT") - compileOnly("dev.plex:Plex:1.0.1-SNAPSHOT") + compileOnly("dev.plex:Plex:1.0.2-SNAPSHOT") compileOnly("me.totalfreedom:BukkitTelnet:4.8") { - exclude("org.spigotmc", "spigot-api") + exclude("org.papermc.paper", "paper-api") } } diff --git a/src/main/java/dev/plex/BukkitTelnetModule.java b/src/main/java/dev/plex/BukkitTelnetModule.java index a3ae629..6b16361 100644 --- a/src/main/java/dev/plex/BukkitTelnetModule.java +++ b/src/main/java/dev/plex/BukkitTelnetModule.java @@ -27,6 +27,11 @@ public class BukkitTelnetModule extends PlexModule throw new RuntimeException("Plex-BukkitTelnet requires the 'Vault' plugin as well as a Permissions plugin that hooks into 'Vault.' We recommend LuckPerms!"); } + if (!Bukkit.getPluginManager().isPluginEnabled("BukkitTelnet")) + { + throw new RuntimeException("The Plex-BukkitTelnet module requires the BukkitTelnet plugin to work. Please download it from: https://github.com/plexusorg/BukkitTelnet/releases"); + } + this.registerListener(new BukkitTelnetListener()); this.bukkitTelnet = BukkitTelnet.getPlugin(); } diff --git a/src/main/java/dev/plex/listener/BukkitTelnetListener.java b/src/main/java/dev/plex/listener/BukkitTelnetListener.java index 0f7825d..c7ecd41 100644 --- a/src/main/java/dev/plex/listener/BukkitTelnetListener.java +++ b/src/main/java/dev/plex/listener/BukkitTelnetListener.java @@ -5,10 +5,7 @@ import dev.plex.player.PlexPlayer; import dev.plex.rank.enums.Rank; import dev.plex.util.PlexLog; import me.totalfreedom.bukkittelnet.BukkitTelnet; -import me.totalfreedom.bukkittelnet.api.TelnetCommandEvent; import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; import org.bukkit.event.EventHandler; public class BukkitTelnetListener extends PlexListener @@ -18,7 +15,10 @@ public class BukkitTelnetListener extends PlexListener { final String ip = event.getIp(); final PlexPlayer player = DataUtils.getPlayerByIP(ip); - if (player == null) return; + if (player == null) + { + return; + } if (plugin.getSystem().equalsIgnoreCase("ranks")) { PlexLog.debug("Plex-BukkitTelnet using ranks check"); @@ -27,7 +27,8 @@ public class BukkitTelnetListener extends PlexListener event.setBypassPassword(true); event.setName(player.getName()); } - } else if (plugin.getSystem().equalsIgnoreCase("permissions")) + } + else if (plugin.getSystem().equalsIgnoreCase("permissions")) { PlexLog.debug("Plex-BukkitTelnet using permissions check"); if (BukkitTelnet.getPlugin().handler.hasPermission(player.getName(), "plex.telnet.autoconnect")) @@ -38,5 +39,4 @@ public class BukkitTelnetListener extends PlexListener } } - }