From 73345e0edfad43a95e26bba87895248a8902f61d Mon Sep 17 00:00:00 2001 From: justuser-31 Date: Sun, 7 Sep 2025 20:33:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B5=D1=81?= =?UTF-8?q?=D0=BA=D0=BE=D0=BB=D1=8C=D0=BA=D0=B8=D1=85=20=D1=80=D0=B0=D0=B7?= =?UTF-8?q?=D1=80=D0=B5=D1=88=D1=91=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B0=D0=B9?= =?UTF-8?q?=D0=BF=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/main/vpSecure/VpSecure.kt | 13 +++++-------- src/main/resources/config.yml | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/main/vpSecure/VpSecure.kt b/src/main/kotlin/main/vpSecure/VpSecure.kt index 78f3652..18dd7bd 100644 --- a/src/main/kotlin/main/vpSecure/VpSecure.kt +++ b/src/main/kotlin/main/vpSecure/VpSecure.kt @@ -5,13 +5,10 @@ import org.bukkit.event.Listener import org.bukkit.event.player.PlayerLoginEvent import org.bukkit.plugin.java.JavaPlugin import java.io.File -import java.io.FileOutputStream -import java.io.InputStream -import java.io.OutputStream class VpSecure : JavaPlugin(), Listener { - public var PROXYIP: String? = "1.1.1.1" + private var ALLOWED_PROXY_IPS: List = listOf("127.0.0.1") override fun onEnable() { // Load configuration @@ -20,7 +17,7 @@ class VpSecure : JavaPlugin(), Listener { // Register event listener server.pluginManager.registerEvents(this, this) - logger.info("VpSecure has been enabled with proxy IP: $PROXYIP") + logger.info("VpSecure has been enabled with allowed proxy IPs: $ALLOWED_PROXY_IPS") } override fun onDisable() { @@ -42,15 +39,15 @@ class VpSecure : JavaPlugin(), Listener { // Load the configuration val config = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(configFile) - PROXYIP = config.getString("proxy_ip", "1.1.1.1") + ALLOWED_PROXY_IPS = config.getStringList("allowed_proxy_ips") } @EventHandler fun onPlayerLogin(event: PlayerLoginEvent) { val ip = event.realAddress.toString().replace("/", "") - // Check if player's IP matches the configured proxy IP - if (ip != PROXYIP) { + // Check if player's IP matches any of the configured proxy IPs + if (ip !in ALLOWED_PROXY_IPS) { event.disallow( PlayerLoginEvent.Result.KICK_OTHER, "Подключение с этого айпи запрещено: ${ip}. Если это ошибка - напишите по контактам voidproject.del.pw" diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 1924e4f..c64edd5 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,2 +1,2 @@ -# VpSecure Configuration -proxy_ip: "127.0.0.1" \ No newline at end of file +allowed_proxy_ips: + - "127.0.0.1" \ No newline at end of file