parent_63715

Write a plugin for an event that spawns at random coordinates within a server world specified in the config. It should spawn a WorldEdit schematic (also defined in the config) containing specific blocks—specifically obsidian, plus any others I choose to add via the config. Breaking the obsidian within the schematic destroys it, while other blocks remain intact. The schematic area must be protected (e.g., using WorldGuard); when the obsidian is broken, it is removed and drops a random item from a list I define. Create a INVENTORY GUI accessible only to admins where they can set the potential drop items and configure their drop rates.

Kodari AI
KodariJul 4 at 3:15 pm 3

I’ll build a Paper plugin that spawns WorldEdit schematics at random coordinates with configurable destructible blocks, drops, and an admin GUI.

SchematicEvent
A Minecraft Paper plugin that periodically spawns WorldEdit schematics at random coordinates in a configurable world. The schematic contains obsidian (configurable) blocks that, when broken, destroy the entire schematic and drop random items from a weighted list. Uses WorldGuard for area protection. Includes an admin inventory GUI for managing drops and their rates.

Let me create all the project files:

SchematicEvent
A Paper plugin that spawns WorldEdit schematics at random coordinates in a configurable world. Obsidian (or configurable blocks) within the schematic can be broken to destroy the entire structure and drop weighted random items. WorldGuard protects the schematic area. Includes an admin inventory GUI to manage drops and their drop rates.</project_description<project_name>SchematicEvent</project_name>
A Paper plugin that spawns WorldEdit schematics at random coordinates in a configurable world. Breaking a configurable block type (obsidian) within the schematic destroys the entire structure and drops a random weighted item from a configurable list. Non-breakable blocks in the schematic are protected. Uses WorldGuard for region protection on the schematic area. Includes an admin inventory GUI for managing drop items and their drop rates.
parent_63715

так это gradle проект, а ты pom.xml сделал под maven. Короче я не могу скомпилить так как файлов градл не хватает

Kodari AI
KodariJul 4 at 3:20 pm 2

Извиняюсь! Давайте исправлю — удалю pom.xml и создам Gradle-файлы. Прочитаю сначала существующий код, чтобы убедиться, что всё на месте

Все файлы на месте, только вместо Gradle стоит Maven. Создам Gradle-файлы:

Also нужно обновить plugin.yml, чтобы version не использовал Maven-style ${project.version}, так как у нас теперь Gradle:

Готово. Теперь структура проекта:

Plain Text
SchematicEvent/
├── build.gradle
├── settings.gradle
├── gradle.properties
└── src/
    ├── main/
    │   ├── java/com/schematicevent/
    │   │   ├── SchematicEventPlugin.java
    │   │   ├── command/SchematicEventCommand.java
    │   │   ├── config/ConfigManager.java
    │   │   ├── drop/DropEntry.java
    │   │   ├── drop/DropManager.java
    │   │   ├── gui/DropAdminGUI.java
    │   │   ├── listener/SchematicProtectionListener.java
    │   │   ├── spawner/ActiveSchematic.java
    │   │   ├── spawner/SchematicSpawner.java
    │   │   └── spawner/SpawnTask.java
    │   └── resources/
    │       ├── config.yml
    │       └── plugin.yml

Собирается командой ./gradlew build — получится jar в build/libs/.

Как работает плагин:

  1. Спавн схемы — каждые N секунд (из config.yml: spawn-interval) в случайных координатах в пределах радиуса размещается WorldEdit-схема. Область оборачивается в WorldGuard-регион (ProtectedCuboidRegion).

  2. Блоки-триггеры — breakable-blocks в конфиге (по умолчанию OBSIDIAN). Ломать их можно, другие блоки схемы защищены (cancel).

  3. При разрушении триггерного блока: схема очищается до воздуха, WorldGuard-регион удаляется, выпадает случайный предмет из списка drops (weighted random).

  4. GUI для админов — /schematicevent drops открывает инвентарь 6×9, где можно добавлять/удалять дропы и менять их вес. Сохраняется в config.yml.

  5. Команды:

    • /schematicevent spawn — принудительный спавн

    • /schematicevent drops — GUI

    • /schematicevent reload — перезагрузка конфига

parent_63715

пишет Compilation Error Missing required files for Fabric mod

Kodari AI
KodariJul 4 at 3:23 pm 1

You’re right — this is a Fabric mod, not a Paper plugin. Let me rewrite everything properly for Fabric 1.21.4 with the correct project structure.

Теперь я переделаю всё под Fabric 1.21.4. Глобально:

  • Fabric mod, не Paper plugin

  • WorldEdit schematic (Sponge v3 .schem) — читается через NBT, не требуется WorldEdit как зависимость

  • Защита региона — своя, т.к. WorldGuard для Fabric не существует

  • GUI для дропов — Custom Screen + packet-based communication

[Generation stopped]

Kodari can make mistakes. Review important code before using.
Files
SchematicEvent
Code
15 892
SchematicEvent/src/main/java/com/schematicevent/SchematicEventPlugin.java
package com.schematicevent;

import com.schematicevent.command.SchematicEventCommand;
import com.schematicevent.config.ConfigManager;
import com.schematicevent.drop.DropManager;
import com.schematicevent.listener.SchematicProtectionListener;
import com.schematicevent.spawner.ActiveSchematic;
import com.schematicevent.spawner.SchematicSpawner;
import com.schematicevent.spawner.SpawnTask;
import org.bukkit.plugin.java.JavaPlugin;

public class SchematicEventPlugin extends JavaPlugin {

    private ConfigManager configManager;
    private DropManager dropManager;
    private SchematicSpawner schematicSpawner;
    private ActiveSchematic activeSchematic;
    private SpawnTask spawnTask;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        configManager = new ConfigManager(this);
        dropManager = new DropManager();
        schematicSpawner = new SchematicSpawner(this);

        configManager.reload();

        getServer().getPluginManager().registerEvents(
                new SchematicProtectionListener(this), this);

        getCommand("schematicevent").setExecutor(
                new SchematicEventCommand(this));

        startSpawnTask();

        getLogger().info("SchematicEvent enabled!");
    }

    @Override
    public void onDisable() {
        if (spawnTask != null) {
            spawnTask.cancel();
        }
        if (activeSchematic != null) {
            schematicSpawner.destroySchematic(activeSchematic);
            activeSchematic = null;
        }
        getLogger().info("SchematicEvent disabled!");
    }

    public void startSpawnTask() {
        if (spawnTask != null) {
            spawnTask.cancel();
        }
        spawnTask = new SpawnTask(this);
        spawnTask.runTaskTimer(this, 100L,
                configManager.getSpawnInterval() * 20L);
    }

    public ConfigManager getConfigManager() { return configManager; }
    public DropManager getDropManager() { return dropManager; }
    public SchematicSpawner getSchematicSpawner() { return schematicSpawner; }
    public ActiveSchematic getActiveSchematic() { return activeSchematic; }
    public void setActiveSchematic(ActiveSchematic active) { this.activeSchematic = active; }
}