stxrzfrr

add a froglight with the name Compressed Killtoken in bold and the name should be shading from icy blue to purple /Compressed Killtoken can be used every 3 days to get it people with OP can do /compressed killtoken infinite

Kodari AI
KodariAug 19 at 4:44 pm 1
CompressedKilltoken
A Minecraft Kotlin plugin that adds a custom froglight item named "Compressed Killtoken" with a bold, gradient-shaded name transitioning from icy blue to purple. Players can obtain the item via the /Compressed Killtoken command, which has a 3-day cooldown per player. Server operators can bypass the cooldown using /compressed killtoken infinite, granting unlimited usage. The plugin handles item creation with custom display names, cooldown tracking with persistent storage, and permission-based command access.

I’ll create the Kotlin Paper plugin with persistent three-day cooldowns, the gradient froglight item, and the OP-only infinite subcommand.

Created the Kotlin Paper plugin with:

  • Froglight named Compressed Killtoken

  • Bold icy-blue-to-purple gradient name

  • /compressed killtoken claim command

  • Persistent 3-day cooldown

  • /compressed killtoken infinite for OP players

  • Automatic item drop at the player’s location if inventory is full

  • Gradle Kotlin project configuration and plugin metadata

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle.kts
manifest.kod
settings.gradle.kts
Code
9 270
src/main/kotlin/com/kodari/compressedkilltoken/CompressedCommand.kt
package com.kodari.compressedkilltoken

import net.kyori.adventure.text.Component
import net.kyori.adventure.text.format.NamedTextColor
import org.bukkit.command.Command
import org.bukkit.command.CommandExecutor
import org.bukkit.command.CommandSender
import org.bukkit.command.TabCompleter
import org.bukkit.entity.Player
import java.time.Duration

class CompressedCommand(
    private val plugin: CompressedKilltokenPlugin,
    private val tokenService: KilltokenService
) : CommandExecutor, TabCompleter {
    override fun onCommand(
        sender: CommandSender,
        command: Command,
        label: String,
        args: Array<out String>
    ): Boolean {
        if (args.size !in 2..3 || !args[0].equals("killtoken", ignoreCase = true)) {
            sender.sendMessage(Component.text("Usage: /$label killtoken [infinite]", NamedTextColor.RED))
            return true
        }

        val infinite = args.size == 3 && args[2].equals("infinite", ignoreCase = true)
        if (args.size == 3 && !infinite) {
            sender.sendMessage(Component.text("Usage: /$label killtoken [infinite]", NamedTextColor.RED))
            return true
        }
        if (infinite && !sender.isOp) {
            sender.sendMessage(Component.text("Only operators can use the infinite option.", NamedTextColor.RED))
            return true
        }

        val player = sender as? Player
        if (player == null) {
            sender.sendMessage(Component.text("Only players can receive a Compressed Killtoken.", NamedTextColor.RED))
            return true
        }

        if (!infinite) {
            val remaining = tokenService.cooldownRemaining(player.uniqueId)
            if (remaining != null) {
                player.sendMessage(
                    Component.text(
                        "You can claim another Compressed Killtoken in ${formatDuration(remaining)}.",
                        NamedTextColor.YELLOW
                    )
                )
                return true
            }
        }

        tokenService.giveToken(player, infinite)
        val message = if (infinite) {
            "You received a Compressed Killtoken without a cooldown."
        } else {
            "You received a Compressed Killtoken. You can claim another one in 3 days."
        }
        player.sendMessage(Component.text(message, NamedTextColor.GREEN))
        return true
    }

    override fun onTabComplete(
        sender: CommandSender,
        command: Command,
        alias: String,
        args: Array<out String>
    ): List<String> = when (args.size) {
        1 -> listOf("killtoken").filter { it.startsWith(args[0], ignoreCase = true) }
        2 -> if (args[0].equals("killtoken", ignoreCase = true) && sender.isOp) {
            listOf("infinite").filter { it.startsWith(args[1], ignoreCase = true) }
        } else {
            emptyList()
        }
        else -> emptyList()
    }

    private fun formatDuration(milliseconds: Long): String {
        val duration = Duration.ofMillis(milliseconds)
        val days = duration.toDays()
        val hours = duration.minusDays(days).toHours()
        val minutes = duration.minusDays(days).minusHours(hours).toMinutes()

        return when {
            days > 0 -> "$days day${if (days == 1L) "" else "s"} ${hours}h"
            hours > 0 -> "$hours hour${if (hours == 1L) "" else "s"} ${minutes}m"
            else -> "$minutes minute${if (minutes == 1L) "" else "s"}"
        }
    }
}