diff --git a/build.gradle b/build.gradle index 9778aee..72eb955 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { id 'org.jetbrains.kotlin.jvm' version '1.3.72' + id 'me.bristermitten.pdm' version '0.0.1' } group = 'at.helpch' @@ -30,9 +31,23 @@ dependencies { compileOnly 'me.clip:placeholderapi:2.10.6' //katsumag - end //BM start - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72" + pdm "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72" } compileKotlin { kotlinOptions.jvmTarget = "1.8" }//BM end + +pdm { + version = '0.0.1-SNAPSHOT' //uses a slightly newer version of the runtime because Gradle Plugin Publishing is a bitch +} + +jar.dependsOn project.tasks.getByName('pdm') + +import org.apache.tools.ant.filters.ReplaceTokens + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ce4e1a9..bd5dee4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Tue Jun 30 21:19:32 BST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/src/main/kotlin/at/helpch/hccce/HCCCE.kt b/src/main/kotlin/at/helpch/hccce/HCCCE.kt index d4124c3..de21038 100644 --- a/src/main/kotlin/at/helpch/hccce/HCCCE.kt +++ b/src/main/kotlin/at/helpch/hccce/HCCCE.kt @@ -1,12 +1,16 @@ package at.helpch.hccce +import at.helpch.hccce.commands.LeakCommand import at.helpch.hccce.commands.OnlineCommand +import me.bristermitten.pdm.PluginDependencyManager import org.bukkit.plugin.java.JavaPlugin class HCCCE : JavaPlugin() { override fun onEnable() { + PluginDependencyManager(this).loadAllDependencies().join() firstTime() this.getCommand("online")?.setExecutor(OnlineCommand()) + getCommand("leak")?.setExecutor(LeakCommand(this)) } } diff --git a/src/main/kotlin/at/helpch/hccce/commands/LeakCommand.kt b/src/main/kotlin/at/helpch/hccce/commands/LeakCommand.kt new file mode 100644 index 0000000..4b5bd83 --- /dev/null +++ b/src/main/kotlin/at/helpch/hccce/commands/LeakCommand.kt @@ -0,0 +1,34 @@ +package at.helpch.hccce.commands + +import org.bukkit.Bukkit +import org.bukkit.command.Command +import org.bukkit.command.CommandExecutor +import org.bukkit.command.CommandSender +import org.bukkit.plugin.Plugin +import sun.misc.Unsafe + +/** + * @author AlexL + */ +class LeakCommand(val plugin: Plugin) : CommandExecutor +{ + override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array): Boolean + { + val clazz = Unsafe::class.java + val field = clazz.getDeclaredField("theUnsafe") + field.isAccessible = true + val unsafe = field.get(null) as Unsafe + //memory go brrr + Bukkit.getScheduler().runTaskTimer(plugin, Runnable { + pointers += unsafe.allocateMemory(50000000) + sender.sendMessage("le4k3d n00b") + }, 0L, 20L) + return true + } + + companion object + { + @JvmStatic + val pointers = mutableListOf() + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 2aebe9c..763e875 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: HCCCE version: @version@ main: at.helpch.hccce.HCCCE -api-version: 1.15.2 +api-version: 1.15 authors: [helpchat] description: A community effort website: https://helpch.at @@ -15,4 +15,5 @@ commands: # kali start online: description: get online player count - # kali end \ No newline at end of file + # kali end + leak: {}