Vincent Bragg

A Scythe that gives strength speed and invis and uses the model of the netherite hoe and works like a mace

Kodari AI
KodariSep 7 at 8:58 pm 1
ScytheOfShadows
Creates a custom Scythe weapon using the netherite hoe model that functions like a mace. When wielded, it grants the player Strength, Speed, and Invisibility effects. The plugin registers a custom item with unique behavior, applies passive buffs while held, and implements mace-style smash attacks with fall damage mechanics. Includes crafting recipe, item metadata, and effect management systems.

Created the Scythe plugin from scratch.

  • Uses a Netherite Hoe model.

  • Grants Strength, Speed, and Invisibility while held.

  • Performs mace-style smash attacks when striking while falling.

  • Adds custom name, lore, Unbreaking, and durability protection.

  • Includes /scythe command with permission scythe.use.

  • Configured for Paper 1.21.4 and Kotlin.

Vincent Bragg

instead of the command make it crafatable

Kodari AI
KodariSep 7 at 8:59 pm 1
  1. Replace the /scythe delivery command with a registered crafting recipe and remove the command permission/registration.

Replaced the /scythe command with a crafting recipe.

Recipe:

Plain Text
N N
 S N
   S
  • N = Netherite Ingot

  • S = Stick

The command and scythe.use permission were removed from plugin.yml.

Vincent Bragg

make it do as much damage as a netherite sword

Kodari AI
KodariSep 7 at 9:10 pm 1
  1. Add a main-hand attack-damage modifier so the scythe’s base damage matches a netherite sword’s 8 damage, while preserving its mace-style smash bonus.

Updated the Scythe to match a netherite sword’s base damage:

  • Netherite hoe base damage: 1

  • Added attack damage: 7

  • Total damage: 8

  • Mace-style falling attack bonus remains unchanged.

Vincent Bragg

make it so theres a dash ability

Kodari AI
KodariSep 7 at 11:11 pm 1
  1. Add a right-click dash ability for the Scythe.

  2. Prevent the normal item interaction and apply a forward velocity with a short cooldown.

Added a right-click dash ability to the Scythe.

  • Right-click in air or on a block to dash forward.

  • 2-second cooldown.

  • Uses the player’s viewing direction.

  • Includes cloud particles and a sweep sound.

  • Cancels the normal item interaction while using the Scythe.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle.kts
manifest.kod
settings.gradle.kts
Code
5 223
src/main/kotlin/com/kodari/scythe/ScythePlugin.kt
package com.kodari.scythe

import net.kyori.adventure.text.Component
import net.kyori.adventure.text.format.NamedTextColor
import net.kyori.adventure.text.format.TextDecoration
import org.bukkit.Material
import org.bukkit.NamespacedKey
import org.bukkit.Particle
import org.bukkit.SoundCategory
import org.bukkit.attribute.Attribute
import org.bukkit.attribute.AttributeModifier
import org.bukkit.enchantments.Enchantment
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import org.bukkit.event.block.Action
import org.bukkit.event.entity.EntityDamageByEntityEvent
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
import org.bukkit.inventory.ShapedRecipe
import org.bukkit.persistence.PersistentDataType
import org.bukkit.potion.PotionEffect
import org.bukkit.potion.PotionEffectType
import org.bukkit.scheduler.BukkitTask
import org.bukkit.util.Vector
import org.bukkit.plugin.java.JavaPlugin
import kotlin.math.max

class ScythePlugin : JavaPlugin(), Listener {
    private lateinit var scytheKey: NamespacedKey
    private lateinit var recipeKey: NamespacedKey
    private val managedEffects = mutableMapOf<java.util.UUID, MutableSet<PotionEffectType>>()
    private val dashCooldowns = mutableMapOf<java.util.UUID, Long>()
    private var effectsTask: BukkitTask? = null

    override fun onEnable() {
        scytheKey = NamespacedKey(this, "scythe")
        recipeKey = NamespacedKey(this, "scythe_recipe")
        server.pluginManager.registerEvents(this, this)
        registerScytheRecipe()
        effectsTask = server.scheduler.runTaskTimer(this, Runnable(::updateEffects), 0L, 10L)
    }

    override fun onDisable() {
        effectsTask?.cancel()
        managedEffects.keys.toList().forEach { uuid ->
            server.getPlayer(uuid)?.let(::removeManagedEffects)
        }
        managedEffects.clear()
        dashCooldowns.clear()
    }

    @EventHandler(ignoreCancelled = true)
    fun onScytheUse(event: PlayerInteractEvent) {
        if (event.action != Action.RIGHT_CLICK_AIR && event.action != Action.RIGHT_CLICK_BLOCK) return
        if (!isScythe(event.item)) return

        event.isCancelled = true
        val player = event.player
        val now = System.currentTimeMillis()
        if (now < (dashCooldowns[player.uniqueId] ?: 0L)) return

        dashCooldowns[player.uniqueId] = now + 2000L
        val direction = player.location.direction.normalize()
        direction.y = direction.y.coerceIn(-0.2, 0.6)
        player.velocity = direction.multiply(1.8)
        player.world.spawnParticle(Particle.CLOUD, player.location, 12, 0.25, 0.15, 0.25, 0.02)
        player.world.playSound(player.location, "minecraft:entity.player.attack.sweep", SoundCategory.PLAYERS, 1f, 1.2f)
    }

    @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
    fun onScytheAttack(event: EntityDamageByEntityEvent) {
        val player = event.damager as? Player ?: return
        if (!isScythe(player.inventory.itemInMainHand)) return
        if (player.isFlying || player.isGliding || player.isInsideVehicle) return
        if (player.fallDistance <= 1.5f) return

        val fallDistance = player.fallDistance.toDouble()
        event.damage += max(0.0, fallDistance * 2.5).coerceAtMost(40.0)
        player.fallDistance = 0f
        event.entity.world.spawnParticle(
            Particle.CRIT,
            event.entity.location.add(Vector(0.0, 1.0, 0.0)),
            20,
            0.3,
            0.3,
            0.3,
            0.05
        )
        player.world.playSound(
            player.location,
            "minecraft:item.mace.smash_ground",
            SoundCategory.PLAYERS,
            1f,
            1f
        )
    }

    private fun updateEffects() {
        server.onlinePlayers.forEach { player ->
            if (isHoldingScythe(player)) {
                applyManagedEffects(player)
            } else {
                removeManagedEffects(player)
            }
        }
    }

    private fun applyManagedEffects(player: Player) {
        val effects = managedEffects.getOrPut(player.uniqueId) { mutableSetOf() }
        val desiredEffects = listOf(
            PotionEffectType.STRENGTH,
            PotionEffectType.SPEED,
            PotionEffectType.INVISIBILITY
        )

        desiredEffects.forEach { type ->
            val current = player.getPotionEffect(type)
            if (current == null || (type in effects && current.amplifier == 0 && current.duration < 20)) {
                player.addPotionEffect(PotionEffect(type, 30, 0, false, false, true), true)
                effects += type
            }
        }
    }

    private fun removeManagedEffects(player: Player) {
        managedEffects.remove(player.uniqueId)?.forEach(player::removePotionEffect)
    }

    private fun isHoldingScythe(player: Player): Boolean =
        isScythe(player.inventory.itemInMainHand) || isScythe(player.inventory.itemInOffHand)

    private fun isScythe(item: ItemStack?): Boolean =
        item != null && item.type == Material.NETHERITE_HOE &&
            item.itemMeta?.persistentDataContainer?.has(scytheKey, PersistentDataType.BYTE) == true

    private fun registerScytheRecipe() {
        val recipe = ShapedRecipe(recipeKey, createScythe())
        recipe.shape("NN ", " SN", "  S")
        recipe.setIngredient('N', Material.NETHERITE_INGOT)
        recipe.setIngredient('S', Material.STICK)
        server.addRecipe(recipe)
    }

    private fun createScythe(): ItemStack {
        val item = ItemStack(Material.NETHERITE_HOE)
        val meta: ItemMeta = item.itemMeta
        meta.displayName(
            Component.text("Scythe", NamedTextColor.DARK_PURPLE)
                .decoration(TextDecoration.ITALIC, false)
        )
        meta.lore(
            listOf(
                Component.text("A weapon for striking from above.", NamedTextColor.GRAY),
                Component.text("Strength, Speed, and Invisibility", NamedTextColor.LIGHT_PURPLE)
            )
        )
        meta.isUnbreakable = true
        meta.addEnchant(Enchantment.UNBREAKING, 3, true)
        meta.addAttributeModifier(
            Attribute.ATTACK_DAMAGE,
            AttributeModifier(
                NamespacedKey(this, "scythe_attack_damage"),
                7.0,
                AttributeModifier.Operation.ADD_NUMBER,
                org.bukkit.inventory.EquipmentSlotGroup.MAINHAND
            )
        )
        meta.persistentDataContainer.set(scytheKey, PersistentDataType.BYTE, 1)
        item.itemMeta = meta
        return item
    }
}