KAVITA TIWARI

THUNDER PROTECT – ADVANCED SPAWN PROTECTION PLUGIN

Create a powerful, lightweight, optimized and fully working Minecraft region protection plugin.

  1. BASIC INFORMATION
  • Plugin Name: THUNDER PROTECT
  • Plugin Main Class: ThunderProtect
  • Plugin File: ThunderProtect.jar
  • Platform: Paper
  • Language: Java
  • Target Version: Paper 26.3 important version but all version suppot
  • Plugin Type: Spawn / Region Protection
  • Low CPU and RAM usage.
  • Use minimum AI credits and generate code efficiently.
  • No unnecessary features or files.
  • Must compile successfully and work without errors.
  1. PREFIX

Use this prefix in every plugin message:

&8[&bTHUNDER PROTECT&8] &7

Support Minecraft & color codes.

  1. OPERATOR-ONLY COMMANDS

Only OP players can execute plugin management commands.

A. /tdp create [NAME]

  • Create a new protection region.
  • Save the region name.
  • Prepare the region for selection.
  • Example: /tdp create Spawn

B. /tdp wand

  • Give OP a special Diamond Axe.
  • Name: &bThunder Protection Wand
  • Only this special wand can select positions.
  • Left-click a block = Position 1.
  • Right-click a block = Position 2.
  • Display selected coordinates in chat.
  • Save both positions.
  • Selection must be stored per player.

C. /tdp protect

  • Protect the currently selected area.
  • Use Position 1 and Position 2.
  • Protect every block inside the cuboid region.
  • Prevent normal players from:

- Breaking blocks. - Placing blocks. - Interacting with protected blocks. - Modifying the region.

  • Prevent natural mob spawning inside protected regions.
  • Support multiple independent protected regions.
  • Save regions permanently after restart.

D. /tdp op protect [NAME]

  • Enable OP protection for the specified region.
  • Even OP players cannot break or place blocks inside that region.
  • Only OP players can manage or remove protection.
  • No bypass for OP players while OP protection is enabled.
  1. REGION PROTECTION SYSTEM

Use a proper 3D cuboid region system.

Calculate:

  • Minimum X and Maximum X.
  • Minimum Y and Maximum Y.
  • Minimum Z and Maximum Z.

Protect the complete area between both selected positions.

Important:

  • Do not protect only the center.
  • Do not use an approximate radius.
  • Do not miss corner blocks.
  • Support different worlds.
  • Multiple regions must work simultaneously.
  1. MOB SPAWN PROTECTION

Prevent natural spawning of hostile and passive mobs inside protected regions.

Handle relevant Bukkit/Paper spawn events.

Do not affect mobs outside protected regions.

  1. DATA STORAGE
  • Save region names.
  • Save world names.
  • Save both positions.
  • Save OP protection status.
  • Use YAML configuration.
  • Automatically load saved regions on server startup.
  • Data must never disappear after restart.
  1. SECURITY
  • Only OP can use /tdp commands.
  • Normal players cannot obtain or use the selection wand to modify regions.
  • Normal players cannot bypass protection.
  • Cancel unauthorized block-break and block-place events.
  • Check region boundaries correctly.
  • Prevent wand abuse.
  1. COMMAND PERMISSIONS

/tdp create [NAME] - OP ONLY /tdp wand - OP ONLY /tdp protect - OP ONLY /tdp op protect [NAME] - OP ONLY

Normal players:

  • Can enter protected areas.
  • Cannot break protected blocks.
  • Cannot place blocks in protected areas.
  • Cannot modify protected areas.
  1. ERROR-FREE DEVELOPMENT
  • Use proper Paper API.
  • Register all listeners correctly.
  • Register commands in plugin.yml.
  • Check null values.
  • Handle invalid arguments.
  • Handle missing selections.
  • Handle duplicate region names.
  • Handle invalid worlds.
  • Avoid memory leaks.
  • Avoid unnecessary repeating tasks.
  • Make the plugin compatible with Paper 1.21.11.
  1. FINAL OUTPUT

Generate:

  1. Complete Java source code.
  2. plugin.yml.
  3. config.yml if required.
  4. Maven pom.xml.
  5. Build instructions.
  6. Final compiled ThunderProtect.jar.

IMPORTANT:

  • Do not provide fake or incomplete code.
  • Do not leave TODO sections.
  • Do not claim the plugin is tested unless it has actually been tested.
  • Prioritize a fully functional plugin over unnecessary features.
  • Keep code compact to minimize AI credits.
  • Deliver a working, compilable plugin.
Kodari AI
KodariNov 12 at 11:32 am 3
ThunderProtect
A lightweight Paper plugin providing advanced spawn and region protection. Features a cuboid region system with per-player wand selection, OP-only commands for creating and managing protected zones, and comprehensive block protection preventing unauthorized breaking, placing, and interaction. Includes natural mob spawn prevention within protected areas, persistent YAML storage for regions across restarts, and an optional OP protection mode that restricts even operator modifications. Commands include /tdp create, /tdp wand, /tdp protect, and /tdp op protect.

Created Thunder Protect with persistent cuboid regions, per-player wand selections, OP protection, and natural mob spawn blocking.

The project targets Paper 1.21.11. Compatibility with Paper 26.3 or older versions has not been verified.

To get ThunderProtect.jar:

  1. Click Compile in the top bar, or on mobile tap ⋮ → Compile Project.

  2. Click Compile, then Download when the build succeeds.

The plugin has not been tested or compiled in this response.

KAVITA TIWARI

Fix bug and give bug is I select area but I use /TDP create spawn not work sew select the area

Kodari AI
KodariNov 12 at 11:51 am 1
  • Keep your selected positions when you name the region.

  • Show the next step based on whether both positions are selected.

Fixed /tdp create spawn clearing your selected positions. Select both corners, run /tdp create spawn, then run /tdp protect to save the region.

KAVITA TIWARI

Give plugin for download

Kodari AI
KodariNov 12 at 11:52 am 1

To download ThunderProtect.jar:

  1. Click Compile in the top bar. On mobile, tap ⋮ → Compile Project.

  2. Click Compile in the window that opens.

  3. Once it succeeds, click Download on the build.

KAVITA TIWARI

Old file ha kya

Kodari AI
KodariNov 12 at 11:52 am 1

Agar pehle wali JAR download ki thi, woh old file hai. Fix wali JAR ke liye project dobara Compile karke nayi build se Download karein.

KAVITA TIWARI

Fix all bug and new file

Kodari AI
KodariNov 12 at 11:55 am 1
  1. Protection bug aur region loading ko fix karunga.

  2. Nayi JAR download karne ke steps dunga.

Selection wand, OP hanging-entity protection aur region loading ke bugs fix kiye hain. Sab bugs fix hone ya plugin test hone ki guarantee nahi de sakta.

Nayi JAR download karne ke liye:

  1. Compile par click karein. Mobile par ⋮ → Compile Project kholein.

  2. Window mein Compile dabayein.

  3. Build successful hone par Download karein.

KAVITA TIWARI

Plugin folder name

Kodari AI
KodariNov 12 at 12:03 pm 1

Plugin folder ka naam ThunderProtect hai. Server par yeh plugins/ThunderProtect/ mein milega.

KAVITA TIWARI

Develop ProtectWorlder, a lightweight and fully functional Minecraft Paper region protection plugin.

Replace every "/tdp" command with "/protect". Keep all existing features and protection mechanics unchanged.

Most Important: Fix the region selection bug. Players must be able to select both positions using "/protect wand" before or after "/protect create [NAME]". Store selections independently using player UUIDs. Never lose selected positions when creating a region.

Implement proper 3D cuboid protection, multiple regions, persistent YAML storage, mob spawn protection, OP protection, and strict operator-only management commands.

Use clean Java code, proper event handling, null checks, and compatible Paper APIs.

Generate the complete Maven project, Java source, plugin.yml, configuration files, build instructions, and compiled "ProtectWorlder.jar".

Do not leave TODOs, incomplete methods, or fake implementations. Do not claim successful testing without actually testing the plugin.

Kodari AI
KodariNov 12 at 12:10 pm 2
  • /protect commands aur JAR ka naam update karunga.

  • UUID-based selections ko /protect create par preserve rakhunga, aur purane saved regions migrate karunga.

  • Existing protection mechanics unchanged rakhunga.

ProtectWorlder ke commands ab /protect se shuru hote hain. Wand se dono positions /protect create <name> ke pehle ya baad select kar sakte hain; create command selection clear nahi karta.

Purane ThunderProtect regions first startup par migrate honge. Server par purani ThunderProtect JAR hata kar nayi JAR lagayein.

ProtectWorlder.jar download karne ke liye: Compile click karein (mobile: ⋮ → Compile Project), window mein Compile dabayein, phir successful build par Download karein.

Plugin ko is response mein compile ya test nahi kiya gaya hai.

KAVITA TIWARI

Give me

Kodari AI
KodariNov 12 at 12:12 pm 1

ProtectWorlder.jar download karne ke liye:

  1. Compile click karein. Mobile par ⋮ → Compile Project.

  2. Window mein Compile dabayein.

  3. Build successful hone par Download click karein.

KAVITA TIWARI

How work.

Kodari AI
KodariNov 12 at 12:12 pm 1

ProtectWorlder kaise use karein:

  1. Server ke plugins folder mein ProtectWorlder.jar daalein aur server restart karein.

  2. OP player ke account se /protect wand likhein.

  3. Wand se pehle corner par left-click aur doosre corner par right-click karein.

  4. /protect create spawn likhein, phir /protect protect likhein.

Aap region create karne se pehle ya baad mein dono positions select kar sakte hain. Region ke andar OP ko bhi blocks break ya place karne se rokne ke liye /protect op protect spawn use karein.

KAVITA TIWARI

Click nahi ho raha vahan per

Kodari AI
KodariNov 12 at 12:12 pm 1

Kahan click nahi ho raha: Compile/Download button par, ya game mein wand se block par?

Agar wand ki baat hai, batayein left-click, right-click ya dono kaam nahi kar rahe.

KAVITA TIWARI

Are CD Tum De do

Kodari AI
KodariNov 12 at 12:12 pm 1

Main yahan se compiled JAR seedha attach nahi kar sakta. ⋮ → Compile Project → Compile dabaiye; build hone ke baad chat mein Download ProtectWorlder.jar button aayega.

KAVITA TIWARI

Here 2 which download

Kodari AI
KodariNov 12 at 12:13 pm 1

ProtectWorlder.jar naam wali file download karein. Agar dono ka naam same hai, latest build wali download karein.

Agar samajh nahi aa raha, dono options ka screenshot bhej dein.

KAVITA TIWARI

Not here

Kodari AI
KodariNov 12 at 12:13 pm 1

Agar download button nahi dikh raha, pehle Compile chalana hoga:

  • Mobile: ⋮ → Compile Project → Compile

  • Desktop: top bar mein Compile → Compile

Build successful hone par Download ProtectWorlder.jar dikhega. Agar phir bhi nahi dikhta, us screen ka screenshot bhej dein.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
3 391
src/main/java/com/thunderprotect/ThunderProtect.java
package com.thunderprotect;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.configuration.file.YamlConfiguration;
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.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;

public final class ThunderProtect extends JavaPlugin implements Listener, TabExecutor {
    private static final String PREFIX = "&8[&bTHUNDER PROTECT&8] &7";
    private final Map<String, Region> regions = new LinkedHashMap<>();
    private final Map<UUID, Selection> selections = new HashMap<>();
    private NamespacedKey wandKey;
    private File dataFile;

    private static final class Selection {
        private String name;
        private Location first;
        private Location second;
    }

    private static final class Region {
        private final String name;
        private final String world;
        private final int x1, y1, z1, x2, y2, z2;
        private boolean opProtection;

        private Region(String name, String world, int x1, int y1, int z1, int x2, int y2, int z2, boolean opProtection) {
            this.name = name;
            this.world = world;
            this.x1 = x1; this.y1 = y1; this.z1 = z1;
            this.x2 = x2; this.y2 = y2; this.z2 = z2;
            this.opProtection = opProtection;
        }

        private boolean contains(Location location) {
            return location.getWorld() != null && world.equals(location.getWorld().getName())
                    && location.getBlockX() >= Math.min(x1, x2) && location.getBlockX() <= Math.max(x1, x2)
                    && location.getBlockY() >= Math.min(y1, y2) && location.getBlockY() <= Math.max(y1, y2)
                    && location.getBlockZ() >= Math.min(z1, z2) && location.getBlockZ() <= Math.max(z1, z2);
        }
    }

    @Override
    public void onEnable() {
        wandKey = new NamespacedKey("thunderprotect", "selection_wand");
        dataFile = new File(getDataFolder(), "regions.yml");
        File oldData = new File(new File(getDataFolder().getParentFile(), "ThunderProtect"), "regions.yml");
        if (!dataFile.exists() && oldData.isFile()) {
            try {
                java.nio.file.Files.createDirectories(getDataFolder().toPath());
                java.nio.file.Files.copy(oldData.toPath(), dataFile.toPath());
            } catch (IOException e) {
                getLogger().severe("Could not migrate ThunderProtect regions: " + e.getMessage());
                getServer().getPluginManager().disablePlugin(this);
                return;
            }
        }
        if (!loadRegions()) {
            getLogger().severe("Region data could not be loaded; disabling to avoid overwriting it.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        getServer().getPluginManager().registerEvents(this, this);
        getCommand("protect").setExecutor(this);
        getCommand("protect").setTabCompleter(this);
    }

    private boolean loadRegions() {
        if (!dataFile.exists()) return true;
        YamlConfiguration data = new YamlConfiguration();
        try {
            data.load(dataFile);
            if (!data.contains("regions")) return true;
            if (!data.isList("regions")) throw new IllegalArgumentException("regions must be a list");
            Map<String, Region> loaded = new LinkedHashMap<>();
            for (Object value : data.getList("regions")) {
                if (!(value instanceof Map)) throw new IllegalArgumentException("Invalid region entry");
                Map<?, ?> entry = (Map<?, ?>) value;
                Object name = entry.get("name"), world = entry.get("world");
                Object x1 = entry.get("x1"), y1 = entry.get("y1"), z1 = entry.get("z1");
                Object x2 = entry.get("x2"), y2 = entry.get("y2"), z2 = entry.get("z2");
                Object op = entry.get("op-protection");
                if (!(name instanceof String) || ((String) name).isEmpty() || !(world instanceof String) || ((String) world).isEmpty()
                        || !(x1 instanceof Number) || !(y1 instanceof Number) || !(z1 instanceof Number)
                        || !(x2 instanceof Number) || !(y2 instanceof Number) || !(z2 instanceof Number)
                        || !(op instanceof Boolean)) throw new IllegalArgumentException("Invalid region entry");
                Region region = new Region((String) name, (String) world, ((Number) x1).intValue(), ((Number) y1).intValue(),
                        ((Number) z1).intValue(), ((Number) x2).intValue(), ((Number) y2).intValue(), ((Number) z2).intValue(), (Boolean) op);
                if (loaded.putIfAbsent(key(region.name), region) != null) throw new IllegalArgumentException("Duplicate region name: " + region.name);
            }
            regions.clear();
            regions.putAll(loaded);
            return true;
        } catch (Exception e) {
            getLogger().severe("Failed to load regions.yml: " + e.getMessage());
            return false;
        }
    }

    private boolean saveRegions() {
        YamlConfiguration data = new YamlConfiguration();
        List<Map<String, Object>> entries = new ArrayList<>();
        for (Region r : regions.values()) {
            Map<String, Object> entry = new LinkedHashMap<>();
            entry.put("name", r.name); entry.put("world", r.world);
            entry.put("x1", r.x1); entry.put("y1", r.y1); entry.put("z1", r.z1);
            entry.put("x2", r.x2); entry.put("y2", r.y2); entry.put("z2", r.z2);
            entry.put("op-protection", r.opProtection);
            entries.add(entry);
        }
        data.set("regions", entries);
        try {
            if (!getDataFolder().isDirectory() && !getDataFolder().mkdirs()) throw new IOException("Cannot create data directory");
            File temp = new File(getDataFolder(), "regions.yml.tmp");
            data.save(temp);
            try {
                java.nio.file.Files.move(temp.toPath(), dataFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING, java.nio.file.StandardCopyOption.ATOMIC_MOVE);
            } catch (java.nio.file.AtomicMoveNotSupportedException e) {
                java.nio.file.Files.move(temp.toPath(), dataFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
            }
            return true;
        } catch (IOException e) {
            getLogger().severe("Failed to save regions.yml: " + e.getMessage());
            return false;
        }
    }

    private static String key(String name) { return name.toLowerCase(Locale.ROOT); }
    private void message(CommandSender sender, String text) { sender.sendMessage(ChatColor.translateAlternateColorCodes('&', PREFIX + text)); }

    private boolean protectedAt(Location location) {
        for (Region region : regions.values()) if (region.contains(location)) return true;
        return false;
    }

    private boolean denied(Player player, Location location) {
        for (Region region : regions.values()) {
            if (region.contains(location) && (!player.isOp() || region.opProtection)) return true;
        }
        return false;
    }

    private boolean isWand(ItemStack item) {
        if (item == null || !item.hasItemMeta()) return false;
        return item.getItemMeta().getPersistentDataContainer().has(wandKey, PersistentDataType.BYTE);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player) || !sender.isOp()) {
            message(sender, "&cOnly OP players can use this command.");
            return true;
        }