commit 658780cb3a3bf4ac6d8106ffdf2a01ce0d800a10 Author: justuser-31 Date: Sun Sep 7 20:13:24 2025 +0300 Init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..7e87482 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..942f3a2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..91acafd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..8b7c9c2 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..7ace097 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2b74dbc --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml new file mode 100644 index 0000000..f9f25c2 --- /dev/null +++ b/dependency-reduced-pom.xml @@ -0,0 +1,124 @@ + + + 4.0.0 + main + vpSecure + vpSecure + 1.0 + + ${project.basedir}/src/main/kotlin + clean package + + + true + src/main/resources + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + compile + + compile + + + + + ${java.version} + + + + maven-shade-plugin + 3.5.3 + + + package + + shade + + + + + + + + + myDeploy + + + + maven-antrun-plugin + 3.1.0 + + + ftps-upload + install + + run + + + + + + + + + + + + + + http-notification + install + + run + + + + + + + + + + + + + + + + commons-net + commons-net + 3.9.0 + + + + + + + + + + spigotmc-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + + org.spigotmc + spigot-api + 1.12.2-R0.1-SNAPSHOT + provided + + + + 2.2.20-RC2 + 17 + UTF-8 + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..41f4f43 --- /dev/null +++ b/pom.xml @@ -0,0 +1,145 @@ + + + 4.0.0 + + main + vpSecure + 1.0 + jar + + vpSecure + + + 17 + 2.2.20-RC2 + UTF-8 + + + + clean package + ${project.basedir}/src/main/kotlin + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + compile + + compile + + + + + ${java.version} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.5.3 + + + package + + shade + + + + + + + + src/main/resources + true + + + + + + + spigotmc-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + + + org.spigotmc + spigot-api + 1.12.2-R0.1-SNAPSHOT + provided + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + + + + + myDeploy + + + + org.apache.maven.plugins + maven-antrun-plugin + 3.1.0 + + + commons-net + commons-net + 3.9.0 + + + + + + ftps-upload + install + + + + + + + + + + + + run + + + + + + http-notification + install + + + + + + + + + + + + run + + + + + + + + + diff --git a/src/main/kotlin/main/vpSecure/VpSecure.kt b/src/main/kotlin/main/vpSecure/VpSecure.kt new file mode 100644 index 0000000..78f3652 --- /dev/null +++ b/src/main/kotlin/main/vpSecure/VpSecure.kt @@ -0,0 +1,60 @@ +package main.vpSecure + +import org.bukkit.event.EventHandler +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" + + override fun onEnable() { + // Load configuration + loadConfig() + + // Register event listener + server.pluginManager.registerEvents(this, this) + + logger.info("VpSecure has been enabled with proxy IP: $PROXYIP") + } + + override fun onDisable() { + logger.info("VpSecure has been disabled") + } + + private fun loadConfig() { + val configFile = File(dataFolder, "config.yml") + + // Create data folder if it doesn't exist + if (!dataFolder.exists()) { + dataFolder.mkdirs() + } + + // Create default config if it doesn't exist + if (!configFile.exists()) { + saveResource("config.yml", false) + } + + // Load the configuration + val config = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(configFile) + PROXYIP = config.getString("proxy_ip", "1.1.1.1") + } + + @EventHandler + fun onPlayerLogin(event: PlayerLoginEvent) { + val ip = event.realAddress.toString().replace("/", "") + + // Check if player's IP matches the configured proxy IP + if (ip != PROXYIP) { + event.disallow( + PlayerLoginEvent.Result.KICK_OTHER, + "Подключение с этого айпи запрещено: ${ip}. Если это ошибка - напишите по контактам voidproject.del.pw" + ) + } + } +} \ No newline at end of file diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 0000000..1924e4f --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1,2 @@ +# VpSecure Configuration +proxy_ip: "127.0.0.1" \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..cc8749d --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,6 @@ +name: vpSecure +version: '1.0' +main: main.vpSecure.VpSecure +load: STARTUP +authors: [ _SAN5_SkeLet0n_ ] +website: voidproject.del.pw diff --git a/vpSecure.iml b/vpSecure.iml new file mode 100644 index 0000000..a589521 --- /dev/null +++ b/vpSecure.iml @@ -0,0 +1,13 @@ + + + + + + + SPIGOT + + 1 + + + + \ No newline at end of file