From 502ccd6a7c45494e6164838af30d8b9cbca16e52 Mon Sep 17 00:00:00 2001 From: Shuiling <1668589925@qq.com> Date: Wed, 10 Jul 2024 23:20:09 -0700 Subject: [PATCH] =?UTF-8?q?feat(Listeners):=20=E6=9B=B4=E6=96=B0=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E5=99=A8=E4=BB=A5=E5=A4=84=E7=90=86=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../baka9/catseedlogin/bukkit/Listeners.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/cc/baka9/catseedlogin/bukkit/Listeners.java b/src/main/java/cc/baka9/catseedlogin/bukkit/Listeners.java index d352b4c..0cd4e49 100644 --- a/src/main/java/cc/baka9/catseedlogin/bukkit/Listeners.java +++ b/src/main/java/cc/baka9/catseedlogin/bukkit/Listeners.java @@ -1,9 +1,7 @@ package cc.baka9.catseedlogin.bukkit; -import cc.baka9.catseedlogin.bukkit.database.Cache; -import cc.baka9.catseedlogin.bukkit.object.LoginPlayer; -import cc.baka9.catseedlogin.bukkit.object.LoginPlayerHelper; -import cc.baka9.catseedlogin.bukkit.task.Task; +import java.util.regex.Pattern; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Entity; @@ -15,10 +13,21 @@ import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryOpenEvent; -import org.bukkit.event.player.*; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; import org.geysermc.floodgate.api.FloodgateApi; -import java.util.regex.Pattern; +import cc.baka9.catseedlogin.bukkit.database.Cache; +import cc.baka9.catseedlogin.bukkit.object.LoginPlayer; +import cc.baka9.catseedlogin.bukkit.object.LoginPlayerHelper; +import cc.baka9.catseedlogin.bukkit.task.Task; public class Listeners implements Listener { @@ -186,6 +195,10 @@ public void onPlayerJoin(PlayerJoinEvent event) { p.sendMessage(Config.Language.BEDROCK_LOGIN_BYPASS); return; } + if (Config.Settings.LoginwiththesameIP && LoginPlayerHelper.recordCurrentIP(p)) { + p.sendMessage(Config.Language.LOGIN_WITH_THE_SAME_IP); + return; + } Cache.refresh(p.getName()); if (Config.Settings.CanTpSpawnLocation) { p.teleport(Config.Settings.SpawnLocation); @@ -222,4 +235,4 @@ public void onPlayerPreLogin(AsyncPlayerPreLoginEvent event) { } } -} \ No newline at end of file +}