Siddharth Sharma

for 1.20.4

📎 1 file 6,965 chars
📄
pasted-code-1794846808469.txt
txt 276 lines
▶
# MASTER DEVELOPMENT PROMPT — CHESTLOCK
### A Lightweight Minecraft Chest Protection Plugin

Develop a fully functional, production-ready Minecraft server plugin named **ChestLock**, developed by **Siddharth**.

The plugin should provide a simple, reliable chest-locking system that allows players to protect their storage from unauthorized access.

The goal is to create a lightweight, polished plugin that is suitable for public Minecraft servers and can be distributed commercially.

---

## 1. PLUGIN IDENTITY & BRANDING

- Plugin Name: ChestLock
- Developer: Siddharth
- Version: 1.0.0
- Description: A simple and reliable chest protection plugin.
- Main package: `com.siddharth.chestlock`

**Mandatory branding:**

Display the following credit clearly:

`ChestLock`
`Made by Siddharth`

The developer credit MUST appear in:

1. `/chestlock` main help screen.
2. Server console startup message.
3. Plugin information and metadata.
4. Source code documentation.

Use `Siddharth` as the developer name in `plugin.yml`.

Do not replace or omit the developer credit.

---

## 2. CORE FEATURES

### Automatic Chest Protection
- Automatically lock chests when a player places them.
- The player who places the chest becomes its owner.
- Only the owner and explicitly trusted players can access it.
- Players must not be able to steal, break, or modify another player's protected chest.

### Supported Containers
- Normal Chests
- Trapped Chests
- Double Chests

Double chests must work as a single protected storage unit. Both halves must share the same owner and trusted-player permissions.

### Manual Locking
Players should also be able to lock existing chests using commands.

---

## 3. COMMANDS

Implement the following commands:

| Command | Function |
|---|---|
| `/chestlock` | Display help and plugin information |
| `/chestlock lock` | Lock the targeted chest |
| `/chestlock unlock` | Unlock the targeted chest |
| `/chestlock trust ` | Give a player access |
| `/chestlock untrust ` | Remove a trusted player |
| `/chestlock info` | Show owner and trusted players |

Additional requirements:
- Provide tab completion.
- Validate all command arguments.
- Display useful error messages.
- Prevent players from modifying chests they do not own.
- Console users should not be able to execute player-only commands.

---

## 4. SECURITY & PROTECTION

Unauthorized players must not be able to:
- Open locked chests.
- Break protected chests.
- Steal items through inventory interactions.
- Access protected inventories through hopper mechanics.
- Bypass protection using double-chest interactions.
- Exploit pistons or other block movement mechanics to compromise protection.

Administrators with the appropriate permission should be able to bypass protection.

Trusted players should have access without becoming owners.

---

## 5. PERMISSIONS

Implement:

- `chestlock.use` — Access basic plugin commands.
- `chestlock.admin` — Administrative access and protection bypass.

Set sensible default permission values.

---

## 6. STORAGE & DATA MANAGEMENT

Use SQLite or YAML for persistent storage.

Store:
- Chest location (world, X, Y, Z).
- Owner UUID.
- Owner username.
- Trusted player UUIDs.
- Container type.

Requirements:
- Data must persist after server restarts.
- UUIDs must be used instead of usernames for identity.
- Handle renamed players correctly.
- Avoid unnecessary database queries.
- Ensure data consistency when chests are broken or moved.
- Handle missing or unloaded worlds safely.

---

## 7. CONFIGURATION

Generate a customizable `config.yml`.

Include:
- Automatic chest locking toggle.
- Protection settings.
- Hopper protection toggle.
- Piston protection toggle.
- Customizable messages.
- Plugin language settings.

Default messages:

`&aChest successfully locked!`

`&cThis chest belongs to another player!`

`&aChest unlocked successfully!`

`&eYou have been added as a trusted player!`

`&cYou are not authorized to access this chest!`

`&7ChestLock &8| &fMade by Siddharth`

All messages should support Minecraft color codes.

---

## 8. USER INTERFACE & EXPERIENCE

Keep the plugin simple and professional.

The `/chestlock` command should display a clean help interface:

- Plugin name and version.
- Available commands.
- Short command descriptions.
- Developer credit: Made by Siddharth.

Use consistent colors and readable formatting.

Do not introduce unnecessary GUI menus.

---

## 9. TECHNICAL REQUIREMENTS

- Platform: Paper API.
- Language: Java.
- Build system: Maven.
- Use a configurable Minecraft target version.
- Lightweight and optimized.
- No unnecessary external dependencies.
- Proper event handling.
- Clean object-oriented architecture.
- No memory leaks.
- No console errors or warnings caused by incorrect API usage.

Use modern, supported Paper API methods appropriate to the selected Minecraft version.

---

## 10. REQUIRED PROJECT STRUCTURE

Generate a properly organized project:

`src/main/java/com/siddharth/chestlock/`

Include separate classes wherever appropriate for:
- Main plugin class.
- Chest protection manager.
- Command handler.
- Event listener.
- Storage manager.
- Configuration manager.
- Message manager.

Resources:
- `plugin.yml`
- `config.yml`

Root:
- `pom.xml`
- `README.md`

---

## 11. TESTING & QUALITY ASSURANCE

Before declaring the plugin complete, verify:

1. Automatically placed chests get locked.
2. Unauthorized players cannot open protected chests.
3. Owners can access their own chests.
4. Trusted players can access shared chests.
5. Untrusted players lose access immediately.
6. Double chests work correctly.
7. Chest ownership survives server restarts.
8. Hopper-based item extraction is prevented.
9. Breaking protected chests is properly restricted.
10. Admin permissions work correctly.
11. Commands and tab completion work.
12. No duplicate or orphaned protection records are created.

Do not claim a feature has been tested unless it has actually been tested.

---

## 12. FINAL DELIVERABLES

Provide:

1. Complete Java source code.
2. Fully configured Maven project.
3. `plugin.yml`.
4. `config.yml`.
5. README installation guide.
6. Successfully compiled ChestLock.jar.
7. Brief explanation of commands and permissions.

The JAR must be ready to place inside a Minecraft server's `plugins` folder.

---

# FINAL DEVELOPMENT INSTRUCTION

Build ChestLock as a complete, functional Minecraft plugin.

Do not generate a prototype, incomplete code, pseudo-code, or placeholder methods.

Do not add unrelated features, economy systems, complicated GUIs, unnecessary animations, or bloated dependencies.

Prioritize stability, performance, compatibility, and security.

Keep the plugin minimal but make every advertised feature work correctly.

**Final branding requirement:**



**Made by Siddharth**



The developer credit must remain visible. Do not remove, hide, or replace it anywhere in the finished project.
Kodari AI
KodariMon at 4:35 pm 6
ChestLock
A lightweight Minecraft chest protection plugin that automatically locks chests when placed, preventing unauthorized access. Features manual locking commands, trusted player management, double chest support, hopper and piston protection, persistent SQLite storage, configurable messages, and admin bypass permissions. Includes tab completion, robust event handling, and clean object-oriented architecture for Paper 1.20.4 servers.

Created ChestLock 1.0.0 — Made by Siddharth for Paper 1.20.4, with chest protection, trust commands, YAML storage, and configurable messages.

  • /chestlock shows the commands and help.

  • chestlock.use defaults to everyone; chestlock.admin defaults to operators.

The plugin has not been compiled or tested here. To get the JAR, click Compile in Kodari’s top bar, click Compile in the window, then Download when it succeeds.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
11 511
src/main/java/com/siddharth/chestlock/ChestLockPlugin.java
package com.siddharth.chestlock;

import org.bukkit.plugin.java.JavaPlugin;

/** ChestLock, made by Siddharth. */
public final class ChestLockPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        saveDefaultConfig();
        ConfigurationManager configuration = new ConfigurationManager(this);
        MessageManager messages = new MessageManager(this);
        StorageManager storage = new StorageManager(this);
        ChestProtectionManager protection = new ChestProtectionManager(storage);
        ChestLockCommand command = new ChestLockCommand(protection, messages);
        getCommand("chestlock").setExecutor(command);
        getCommand("chestlock").setTabCompleter(command);
        getServer().getPluginManager().registerEvents(new ChestProtectionListener(protection, configuration, messages), this);
        getLogger().info("ChestLock 1.0.0 | Made by Siddharth");
    }
}