gova_bibom

Зделай плагин для событий на бокспвп, а также несколько в 1 плагине все в 1 плагине, а также чтобы при событии было видно, когда и какой будет с попаданием в сундук или шелк, а также чтобы было ранги старинной или мифической, так что делал дела Зделай сундук каторый спавн на моих кордах

С Лутом от 8 до 64 незерн блоков от 5 до 50 маяков и нажмите на золотые яблоки, силки скорки по деям расходникам

Без кастомных предметов

Кординаты 13 -56 36. Тоже самое, но незеритовые блоки должны быть с засорением починки все незеритовые блоки на всех событиях

Kodari AI
KodariMay 12 at 2:52 am 11,079 (v2)

I’ll create a BoxPvP events plugin with chest spawning, event announcements, and loot systems.

BoxPvPEvents
A BoxPvP events plugin featuring multiple event types with scheduled announcements showing upcoming event time and type. Spawns a loot chest at coordinates (13, -56, 36) containing 8-64 Netherite Blocks (with Mending enchant), 5-50 Beacons, Golden Apples, and consumables like Speed/Strength potions. Events have Ancient and Mythic rank tiers. Chest spawn is announced with sidebar/title display countdowns.

Now I’ll plan the full structure and create all files:

  • BoxPvPEventsPlugin — main plugin class

  • EventManager — manages event scheduling, types, countdowns

  • ChestManager — spawns/removes loot chest at fixed coords

  • EventType — enum for event types (Ancient, Mythic)

  • EventListener — listens for chest interactions

  • EventCommand — admin commands

  • ScoreboardManager — shows event countdown on sidebar

BoxPvPEvents
A BoxPvP events plugin featuring multiple event types with scheduled announcements showing upcoming event time and type. Spawns a loot chest at coordinates (13, -56, 36) containing 8-64 Netherite Blocks (with Mending enchant), 5-50 Beacons, Golden Apples, and consumables like Speed/Strength potions. Events have Ancient and Mythic rank tiers. Chest spawn is announced with sidebar/title display countdowns.

The plugin is fully created with:

  • 4 event types — Ancient Chest, Mythic Chest, Ancient Silk, Mythic Silk (Старинный / Мифический tiers)

  • Chest spawns at 13, -56, 36 with randomized loot: 8–64 Netherite Blocks (all with Mending enchant), 5–50 Beacons, 5–20 Golden Apples, 1–5 Enchanted Golden Apples, Speed/Strength/Fire Resistance potions

  • Mythic events give bonus Netherite Ingots + extra Enchanted Golden Apples

  • Countdown announcements broadcast at 30m, 15m, 10m, 5m, 2m, 1m, 30s, 10s before event with title+chat

  • Sidebar scoreboard shows current/next event name, tier (rank), and time remaining — updates every second

  • Commands: /boxevent start [type], stop, info, chest, reload | /eventinfo for players

  • On join — player sees current event status or next event countdown

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle.kts
Code
12 814
src/main/kotlin/com/boxpvp/managers/ChestManager.kt
package com.boxpvp.managers

import com.boxpvp.BoxPvPEventsPlugin
import com.boxpvp.model.EventType
import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.block.Chest
import org.bukkit.enchantments.Enchantment
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
import kotlin.random.Random

class ChestManager(private val plugin: BoxPvPEventsPlugin) {

    private var chestLocation: Location? = null

    fun spawnChest(eventType: EventType) {
        val world = plugin.server.getWorld(plugin.config.getString("event-world", "world")!!)
            ?: run {
                plugin.logger.warning("World not found!")
                return
            }

        val x = plugin.config.getInt("chest.x", 13)
        val y = plugin.config.getInt("chest.y", -56)
        val z = plugin.config.getInt("chest.z", 36)

        val location = Location(world, x.toDouble(), y.toDouble(), z.toDouble())

        removeChest()

        location.block.type = Material.CHEST
        val blockState = location.block.state as? Chest ?: return
        val inventory = blockState.inventory

        inventory.clear()
        fillLoot(inventory, eventType)
        blockState.update()

        chestLocation = location
        plugin.logger.info("Event chest spawned at $x, $y, $z for event: ${eventType.displayName}")
    }

    private fun fillLoot(inventory: org.bukkit.inventory.Inventory, eventType: EventType) {
        val lootItems = mutableListOf<ItemStack>()

        val netheriteMin = plugin.config.getInt("loot.netherite-blocks.min", 8)
        val netheriteMax = plugin.config.getInt("loot.netherite-blocks.max", 64)
        val netheriteCount = Random.nextInt(netheriteMin, netheriteMax + 1)
        val netheriteItem = ItemStack(Material.NETHERITE_BLOCK, netheriteCount)
        val netheriteMeta = netheriteItem.itemMeta
        netheriteMeta?.addEnchant(Enchantment.MENDING, 1, true)
        netheriteItem.itemMeta = netheriteMeta
        lootItems.add(netheriteItem)

        val beaconMin = plugin.config.getInt("loot.beacons.min", 5)
        val beaconMax = plugin.config.getInt("loot.beacons.max", 50)
        val beaconCount = Random.nextInt(beaconMin, beaconMax + 1)
        distributeItems(lootItems, Material.BEACON, beaconCount)

        val gaMin = plugin.config.getInt("loot.golden-apples.min", 5)
        val gaMax = plugin.config.getInt("loot.golden-apples.max", 20)
        val gaCount = Random.nextInt(gaMin, gaMax + 1)
        distributeItems(lootItems, Material.GOLDEN_APPLE, gaCount)

        val egaMin = plugin.config.getInt("loot.enchanted-golden-apples.min", 1)
        val egaMax = plugin.config.getInt("loot.enchanted-golden-apples.max", 5)
        val egaCount = Random.nextInt(egaMin, egaMax + 1)
        lootItems.add(ItemStack(Material.ENCHANTED_GOLDEN_APPLE, egaCount))

        val speedMin = plugin.config.getInt("loot.speed-potions.min", 3)
        val speedMax = plugin.config.getInt("loot.speed-potions.max", 10)
        val speedCount = Random.nextInt(speedMin, speedMax + 1)
        lootItems.add(createPotion(org.bukkit.potion.PotionType.SWIFTNESS, speedCount))

        val strengthMin = plugin.config.getInt("loot.strength-potions.min", 3)
        val strengthMax = plugin.config.getInt("loot.strength-potions.max", 10)
        val strengthCount = Random.nextInt(strengthMin, strengthMax + 1)
        lootItems.add(createPotion(org.bukkit.potion.PotionType.STRENGTH, strengthCount))

        val fireMin = plugin.config.getInt("loot.fire-resistance-potions.min", 2)
        val fireMax = plugin.config.getInt("loot.fire-resistance-potions.max", 8)
        val fireCount = Random.nextInt(fireMin, fireMax + 1)
        lootItems.add(createPotion(org.bukkit.potion.PotionType.FIRE_RESISTANCE, fireCount))

        if (eventType.isMythic()) {
            lootItems.add(ItemStack(Material.NETHERITE_INGOT, Random.nextInt(5, 20)))
            lootItems.add(ItemStack(Material.ENCHANTED_GOLDEN_APPLE, Random.nextInt(2, 8)))
        }

        val slots = (0 until inventory.size).toMutableList()
        slots.shuffle()
        var slotIndex = 0
        for (item in lootItems) {
            if (slotIndex >= slots.size) break
            inventory.setItem(slots[slotIndex++], item)
        }
    }

    private fun distributeItems(list: MutableList<ItemStack>, material: Material, total: Int) {
        var remaining = total
        while (remaining > 0) {
            val stackSize = minOf(remaining, material.maxStackSize)
            list.add(ItemStack(material, stackSize))
            remaining -= stackSize
        }
    }

    private fun createPotion(type: org.bukkit.potion.PotionType, amount: Int): ItemStack {
        val potion = ItemStack(Material.POTION, amount.coerceAtMost(64))
        val meta = potion.itemMeta as? org.bukkit.inventory.meta.PotionMeta ?: return potion
        meta.basePotionType = type
        potion.itemMeta = meta
        return potion
    }

    fun removeChest() {
        val loc = chestLocation ?: return
        if (loc.block.type == Material.CHEST) {
            loc.block.type = Material.AIR
        }
        chestLocation = null
    }

    fun getChestLocation(): Location? = chestLocation

    fun isChestLocation(location: Location): Boolean {
        val loc = chestLocation ?: return false
        return loc.world == location.world &&
                loc.blockX == location.blockX &&
                loc.blockY == location.blockY &&
                loc.blockZ == location.blockZ
    }
}