westingames

create me a bukkit plugin that regenerates specific ores within a specific selection (via worldedit wooden axe). make a basic config for how long it takes for ores to regenerate, and the block that replaces the ore for that duration while the ore regenerates. make it per-player, so each player has their own ores on the same block (so one person doesnt mine all of the ores, they only mine their ores) i forget the technical name, could be Instanced Blocks.

ask questions

Kodari AI
KodariAug 26 at 4:19 am 1
InstancedOreRegen
Bukkit plugin providing per-player instanced ore regeneration within WorldEdit selections. Players select regions with the wooden axe; each player has their own ore instances at the same coordinates, preventing shared depletion. Configurable regeneration delay and placeholder block per ore type. When a player mines an ore, it converts to the configured placeholder block for the set duration, then regenerates back to ore only for that player. Supports multiple ore types with individual timers and placeholder blocks. Uses WorldEdit API for region selection and per-player block state management.

Before I build it, I need these decisions:

  1. Server version/platform: Spigot or Paper? Which Minecraft version?

  2. WorldEdit: Should WorldEdit be a required dependency, and should selection be made with the wooden axe directly or through a command such as /oregen set?

  3. Selection behavior: Can each selection contain multiple ore types, or should each region be configured separately?

  4. Ore list: Which blocks should regenerate? For example: coal, iron, gold, redstone, lapis, diamond, emerald, ancient debris, and copper.

  5. Replacement block: One global replacement block for all ores, or a different replacement per ore?

  6. Regeneration timing: Should the timer begin immediately when mined, and should it be configurable per ore type?

  7. Player visibility: Should players see their own depleted/replaced blocks while other players still see the original ore?

  8. Mining rules: Should a player be able to mine each instanced ore once per regeneration cycle, using normal tool and drop rules?

  9. Persistence: Should player ore states survive server restarts, or reset on restart?

  10. Regions: Should selections be saved and remain active after restart? If so, what commands should admins use to create, delete, list, and reload them?

  11. Dependencies: Are ProtocolLib or packet libraries acceptable? True per-player blocks require client-side block updates; a normal Bukkit world block cannot have different types for different players.

  12. Permissions: Should there be permissions for administration and/or access to the instanced ore regions?

  13. Configuration format: Is YAML configuration sufficient, or do you want commands to configure timers and blocks in-game?

For the cleanest implementation, I recommend Paper + WorldEdit + ProtocolLib, with saved WorldEdit selections and YAML-configured ore regeneration rules.

westingames
  1. spigot, 1.21.11
  2. /oregen set.
  3. multiple, every ore that is in the region should regenerate as it's respective block.
  4. all ores
  5. cobblestone, one singular one.
  6. Immediately when mined

7.yes

  1. yes
  2. just reset
  3. yes, you pick commands
  4. packetevents
  5. everyone can mine ores, but only players with op can make regions.
  6. in-game

default for regen time should be 60 seconds.

Kodari AI
KodariAug 26 at 5:02 am 3

I’ll create the plugin with:

  1. PacketEvents interception for per-player ore mining and client-only block changes.

  2. WorldEdit wooden-axe selections saved as named regions.

  3. YAML-configured ore list, cobblestone replacement, and 60-second regeneration.

  4. Admin commands for saving, deleting, listing, and reloading regions.

Created InstancedOreRegen.

  • Uses WorldEdit’s wooden axe selection.

  • Save selections with:

    • /oregen set <name>

    • /oregen delete <name>

    • /oregen list

    • /oregen reload

  • Only operators can manage regions.

  • All configured ores regenerate independently per player.

  • Other players continue seeing and mining their own ore instances.

  • Default replacement block: COBBLESTONE

  • Default regeneration time: 60 seconds.

  • Player ore states reset when the server restarts.

  • Requires WorldEdit and PacketEvents.

  • Configuration is in src/main/resources/config.yml.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
12 689
src/main/java/com/kodari/instancedoreregen/InstancedOreRegenPlugin.java
package com.kodari.instancedoreregen;

import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.event.PacketListenerAbstract;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class InstancedOreRegenPlugin extends JavaPlugin {
    private RegionManager regionManager;
    private OreService oreService;
    private PacketListenerAbstract packetListener;

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

        if (Bukkit.getPluginManager().getPlugin("packetevents") == null) {
            getLogger().severe("PacketEvents is required. InstancedOreRegen has been disabled.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

        oreService = new OreService(this);
        regionManager = new RegionManager(this);
        regionManager.load(oreService.getOreNames());

        OreCommand command = new OreCommand(this);
        PluginCommand pluginCommand = getCommand("oregen");
        if (pluginCommand != null) {
            pluginCommand.setExecutor(command);
            pluginCommand.setTabCompleter(command);
        }

        Bukkit.getPluginManager().registerEvents(new PlayerStateListener(this), this);
        packetListener = new OrePacketListener(this);
        PacketEvents.getAPI().getEventManager().registerListener(packetListener);
    }

    @Override
    public void onDisable() {
        if (packetListener != null && Bukkit.getPluginManager().getPlugin("packetevents") != null) {
            PacketEvents.getAPI().getEventManager().unregisterListener(packetListener);
        }
    }

    public RegionManager getRegionManager() {
        return regionManager;
    }

    public OreService getOreService() {
        return oreService;
    }
}