From 708a899dab93d6cf66a12578328601478e26ff29 Mon Sep 17 00:00:00 2001 From: Shuiling <1668589925@qq.com> Date: Thu, 18 Jul 2024 05:05:46 -0700 Subject: [PATCH] =?UTF-8?q?feat(LoginPlayerHelper):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=99=BB=E5=BD=95IP=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../baka9/catseedlogin/bukkit/object/LoginPlayerHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/cc/baka9/catseedlogin/bukkit/object/LoginPlayerHelper.java b/src/main/java/cc/baka9/catseedlogin/bukkit/object/LoginPlayerHelper.java index e60b30e..53c5f49 100644 --- a/src/main/java/cc/baka9/catseedlogin/bukkit/object/LoginPlayerHelper.java +++ b/src/main/java/cc/baka9/catseedlogin/bukkit/object/LoginPlayerHelper.java @@ -147,15 +147,15 @@ public static Long getLastLoginTime(String name) { } // 记录登录IP - public static void recordCurrentIP(Player player, LoginPlayer lp){ + public static void recordCurrentIP(Player player, LoginPlayer lp){ String currentIp = player.getAddress().getAddress().getHostAddress(); List ipsList = lp.getIpsList(); ipsList.add(currentIp); ipsList = ipsList.stream().distinct().collect(Collectors.toList()); - if (ipsList.size() > 0) { + if (!ipsList.isEmpty()) { ipsList.remove(0); } - lp.setIps(String.join(";", ipsList.toArray(new String[0]))); + lp.setIps(String.join(";", ipsList)); CatSeedLogin.instance.runTaskAsync(() -> { try { CatSeedLogin.sql.edit(lp);