From 23ab2126f8a04617284e3c79fe6456f7c1b9533c Mon Sep 17 00:00:00 2001 From: yukonisen Date: Wed, 10 Apr 2024 23:50:50 +0800 Subject: [PATCH] fix event address --- .../potato_ip_display/listener/PlayerJoinListener.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/bukkit/src/main/kotlin/indi/nightfish/potato_ip_display/listener/PlayerJoinListener.kt b/bukkit/src/main/kotlin/indi/nightfish/potato_ip_display/listener/PlayerJoinListener.kt index f775c39..324cebe 100644 --- a/bukkit/src/main/kotlin/indi/nightfish/potato_ip_display/listener/PlayerJoinListener.kt +++ b/bukkit/src/main/kotlin/indi/nightfish/potato_ip_display/listener/PlayerJoinListener.kt @@ -20,18 +20,10 @@ class PlayerJoinListener : Listener { object : BukkitRunnable() { override fun run() { - val playerAddress = event.realAddress.hostAddress + val playerAddress = event.address.hostAddress val playerName = event.player.name val ipParse = IpParseFactory.getIpParse(playerAddress) - var result = ipParse.getProvince() - - if (result == "未知" || result == "") { - result = ipParse.getCity() - if (result == "未知" || result == "") { - result = ipParse.getCountry() - } - } - + val result = ipParse.getFallback() IpAttributeMap.playerIpAttributeMap[playerName] = result plugin.log("Player named $playerName connect to proxy from ${ipParse.getProvince()}${ipParse.getCity()} ${ipParse.getISP()}") }