diff --git a/build.gradle.kts b/build.gradle.kts index a699cc4..1c5909b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "net.azisaba" -version = "6.8.2" +version = "6.8.3" java { toolchain.languageVersion.set(JavaLanguageVersion.of(8)) diff --git a/src/main/java/com/github/mori01231/lifecore/listener/PlayerJoinListener.java b/src/main/java/com/github/mori01231/lifecore/listener/PlayerJoinListener.java index 01ac144..fa0cdc8 100644 --- a/src/main/java/com/github/mori01231/lifecore/listener/PlayerJoinListener.java +++ b/src/main/java/com/github/mori01231/lifecore/listener/PlayerJoinListener.java @@ -9,6 +9,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; public class PlayerJoinListener implements Listener { private final LifeCore plugin; @@ -36,4 +37,14 @@ public void onPlayerJoin(PlayerJoinEvent e) { PlayerUtil.getChannel(e.getPlayer()).pipeline() .addBefore("packet_handler", "lifecore", new PacketHandler(e.getPlayer())); } + + @EventHandler + public void onPlayerLogin(PlayerLoginEvent e) { + if (!Bukkit.getPluginManager().isPluginEnabled("Towny")) { + return; + } + if (e.getPlayer().getName().toLowerCase().startsWith("town_") || e.getPlayer().getName().toLowerCase().startsWith("nation_")) { + e.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Towny is preventing you from logging in using this account name."); + } + } }