📄
pasted-code-1788620284782.txt
txt
123 lines
▶
I want you to develop a complete Minecraft claim plugin called **DipperClaim** with the following specifications and features.
### General Information
* **Plugin Name:** DipperClaim
* **Minecraft Versions:** 1.21.1, 1.21.4, and 1.21.8
* **Server Software:** Paper
* **Main Class:** `dipper.ir`
### 1. Claim Creation and Visualization
* Players should be able to create a claim using a **Golden Shovel**.
* The player should be able to select the two opposite corners of the area they want to claim by clicking with the Golden Shovel.
* The claim boundaries should be visible when the player uses a **Stick**, allowing them to easily see the borders of their claim.
### 2. Claim Management Commands
The plugin should have claim-related commands such as:
* `/claim`
* `/claim ban`
* `/claim unban`
* `/claim kill`
* `/claim unkill`
* And other necessary claim-management commands.
For example, if a player is **banned from a claim**, they should not be able to enter that claim until they are unbanned.
### 3. Contextual Command Suggestions
* When a player **enters their own claim**, relevant `/claim` commands should automatically be suggested/completed for them.
* When the player is **outside their claim**, there should be no `/claim` command suggestions or completions.
* The command suggestions should be context-sensitive and only appear when they are actually relevant.
### 4. Claim Owner / Claim Management Panel
There should be a GUI panel that can be opened using commands such as:
* `/claim owner`
* `/claim panel`
The panel should allow the claim owner to:
* Give specific players **trust permissions**.
* Manage what trusted players are allowed to do inside the claim.
* View a list of all players who are banned from the claim.
* Unban players from the GUI.
* View the current claim size, including how many blocks the claim contains.
* Manage all claim-related permissions and settings through the GUI.
### 5. Admin Claim Inspection Panel
Server administrators should have a command such as:
`/claim check `
This command should open an administrative GUI containing detailed information about the player's claim, including:
* Claim owner.
* Claim ID / Player ID.
* All trusted players and their permissions.
* Claim size.
* The amount of blocks contained within the claim.
* All blocks currently placed inside the claim.
* Other useful claim information required for administration and moderation.
The admin panel should provide administrators with a complete overview of the claim.
### 6. Claim Block Economy System
Players should **not need to purchase claim blocks separately**.
Instead:
* Every claim block should have a configurable price.
* When a player creates or expands a claim, the plugin should automatically check whether the player has enough money.
* The required amount should be deducted directly from the player's balance.
* The price per claim block should be configurable.
* The plugin should prevent players from creating or expanding a claim if they do not have enough money.
* The system should correctly calculate the total cost based on the number of claim blocks being claimed.
### 7. Lockable Chests with Passwords
Players should be able to lock chests inside their claims.
The system should work as follows:
* A player **Shift + Left Clicks** on a chest.
* A GUI/panel should open.
* The player should be able to set a password for that chest through the GUI.
* Only the **claim owner or players who have been granted the appropriate permission by the claim owner** should be able to lock or manage chests.
* Locked chests should require the correct password to access.
* The claim owner should be able to open the claim management panel and:
* View all locked chests inside the claim.
* See which chests are locked.
* Manage/unlock locked chests.
* Manage the password/security settings of those chests.
### Additional Requirements
The plugin should be designed to be **stable, optimized, secure, and production-ready** for Paper servers.
All major settings, including claim block prices, permissions, messages, GUI settings, and other configurable values, should be placed in configuration files.
The plugin should also properly handle:
* Claim boundaries.
* Player permissions.
* Claim ownership.
* Trusted players.
* Banned players.
* Claim expansion.
* Claim deletion.
* Claim overlap prevention.
* Economy transactions.
* GUI interactions.
* Chest protection.
* Admin management.
* Data persistence after server restarts.
The code should be clean, well-structured, and optimized for Minecraft 1.21.x Paper servers.
Create the Paper/Vault project foundation and configurable defaults.
Implement persistent claims, selections, pricing, permissions, bans, and chest locks.
Add
/claimmanagement plus context-sensitive suggestions.Add owner, trust, bans, locked-chest, password, and admin inspection GUIs.
Implemented DipperClaim from scratch with:
Paper 1.21.x Gradle project and Vault economy integration.
Golden Shovel claim selection, configurable per-block pricing, overlap prevention, expansion, deletion, and YAML persistence.
Stick-based particle claim-border visualization.
Claim trust, bans, PvP (
kill/unkill), container/build protection, and ban-entry prevention.Context-sensitive
/claimtab completions and command visibility.Owner management GUI for trusted players, bans, claim details, and locked chests.
Admin
/claim check <player>inspection GUI.Shift-left-click chest password locking, hashed password storage, temporary password access, and lock management panels.
Configurable messages, claim limits/prices, chest security, and GUI titles.
📄
pasted-code-1788623605720.txt
txt
643 lines
▶
I want you to update and fully review the **DipperClaim** Minecraft claim plugin according to the following requirements.
## General Information
* **Plugin Name:** DipperClaim
* **Minecraft Versions:** 1.21.1, 1.21.4, and 1.21.8
* **Server Software:** Paper
* **Main Class:** `dipper.ir`
* **Database:** SQLite
* **Database File:** `Dipper.db`
---
# 1. Claim Creation with Golden Shovel
The claim creation system must work immediately after selecting the two corners.
### Required behavior:
1. The player uses a **Golden Shovel**.
2. They select the first corner.
3. They select the second corner.
4. As soon as the second corner is selected, the claim must be **created automatically**.
5. The player must **NOT** need to run another command to confirm or create the claim.
The plugin should:
* Display the claim boundaries while selecting.
* Prevent invalid claims.
* Prevent overlapping claims.
* Check the player's available money before creating the claim.
* Automatically deduct the required amount from the player's balance.
* Show a configurable success/error message.
---
# 2. Claim Visualization with Stick
When a player holds or uses a **Stick**, they should be able to see the boundaries of their claim.
The visualization system should be configurable, including:
* Particle type.
* Particle color.
* Particle amount.
* Display duration.
* Display distance.
* Whether the visualization is enabled.
* Messages.
* Cooldowns.
---
# 3. Claim PvP Command
Replace the previous PvP-related system with a simple claim command:
* `/claim pvp on`
* `/claim pvp off`
The claim owner should be able to enable or disable PvP inside their claim.
The system must:
* Respect claim ownership.
* Respect trust permissions.
* Prevent unauthorized players from changing PvP settings.
* Display configurable messages.
* Save the PvP state in SQLite.
PvP settings must also be manageable through the claim management GUI.
---
# 4. Unified Claim Management GUI
The previous commands:
* `/claim panel`
* `/claim owner`
should be removed/replaced with **one unified command**.
Use:
`/claim panel`
This command should open **one complete claim management GUI** containing all functionality that was previously planned for both `/claim panel` and `/claim owner`.
There should be no need for two separate panels.
The unified Claim Panel should include:
### Claim Information
* Claim owner.
* Claim ID.
* Claim size.
* Claim coordinates.
* Number of blocks.
* Claim creation date.
* PvP status.
* Number of trusted players.
* Number of banned players.
* Number of locked chests.
### Trust Management
The owner should be able to:
* Add trusted players.
* Remove trusted players.
* View trusted players.
* Select individual permissions for each trusted player.
Permissions should include configurable options such as:
* Build.
* Break.
* Open containers.
* Use doors.
* Use buttons.
* Use levers.
* Use crafting tables.
* Use furnaces.
* Use anvils.
* Use enchanting tables.
* Use redstone.
* Interact with entities.
* Lock/unlock chests.
* Manage claim settings.
* PvP management.
Every permission should be independently configurable.
---
# 5. Claim Ban / Unban
The claim owner should be able to:
* Ban a player from their claim.
* Unban a player.
* View all banned players.
* Remove players from the ban list.
Commands:
`/claim ban `
`/claim unban `
If a player is banned:
* They cannot enter the claim.
* If they are already inside when banned, they should be safely removed/teleported outside the claim.
* The owner should be able to unban them.
* All data must be stored in SQLite.
The ban system must be integrated into the Claim Panel.
---
# 6. Claim Kill / Unkill
Keep the claim kill functionality:
`/claim kill`
`/claim unkill`
This setting should control whether players can be killed inside the claim.
The functionality must also be available through the Claim Panel.
All messages and settings must be configurable.
---
# 7. Claim Command Suggestions
The command suggestion system must be fixed and improved.
When a player is inside a claim where they have permission to manage the claim:
`/claim`
should provide relevant command suggestions.
Examples:
* `panel`
* `pvp`
* `ban`
* `unban`
* `kill`
* `unkill`
* Other available claim commands.
When the player is outside a claim, claim-management commands should not be suggested unless they are globally available to that player.
Command suggestions must also respect permissions.
---
# 8. Claim Economy System
There must be **no separate claim-block item system**.
Players pay directly with their economy balance.
Example:
If:
* Claim block price = `$10`
* New claim size = `1000 blocks`
Then:
`1000 × $10 = $10,000`
The plugin must automatically deduct `$10,000`.
The price must be fully configurable.
The system must also support:
* Claim creation price.
* Claim expansion price.
* Optional minimum claim size.
* Optional maximum claim size.
* Optional minimum balance.
* Refund percentage when deleting a claim.
* Different prices if required.
* Economy provider configuration.
If the player does not have enough money:
* The claim must not be created.
* No money should be deducted.
* A configurable error message should be displayed.
---
# 9. Complete Claim Check System
The command:
`/claim check `
must be available to administrators.
When an administrator runs the command, a GUI should open showing the player's claims.
The admin should be able to:
1. See the player.
2. See all claims belonging to that player.
3. Select a specific claim.
4. Click on the desired claim.
5. Open a **new Claim Administration Panel** for that specific claim.
The new administration panel should allow the administrator to fully manage the selected claim.
---
# 10. Admin Claim Management Panel
After an admin selects a specific claim from `/claim check `, open a dedicated management GUI.
The admin panel should show:
### Claim Information
* Claim owner.
* Claim ID.
* Claim size.
* Coordinates.
* Creation date.
* PvP status.
* Kill/unkill status.
* Number of trusted players.
* Number of banned players.
* Number of locked chests.
* Other relevant information.
### Trust Management
Admins should be able to:
* View trusted players.
* Add/remove trust.
* Modify permissions.
### Ban Management
Admins should be able to:
* View banned players.
* Ban players.
* Unban players.
### Claim Management
Admins should be able to:
* Modify claim settings.
* Enable/disable PvP.
* Enable/disable kill settings.
* Remove/delete the claim.
* Resize the claim if appropriate.
* Teleport to the claim.
* View claim boundaries.
The admin should have full control regardless of normal owner permissions.
---
# 11. Locked Chest System
The chest locking system should work as follows:
A player with the required permission:
**Shift + Left Click on a chest**
Then a GUI opens.
The GUI allows the player to:
* Lock the chest.
* Set a password.
* Change the password.
* Remove the password.
* Cancel the operation.
Only:
* The claim owner
* Or trusted players with the appropriate permission
can manage chest locks.
### Locked Chest Access
When another player attempts to open a locked chest:
* A password GUI should open.
* The player must enter the correct password.
* Incorrect passwords should be rejected.
* The number of attempts can optionally be limited/configured.
* Messages must be configurable.
### Claim Panel Integration
The Claim Panel must contain a section for locked chests.
The owner should be able to:
* View all locked chests.
* See their coordinates.
* See their status.
* Unlock a chest.
* Manage the chest.
Administrators should have the same functionality through the Admin Claim Management Panel.
Passwords must **never be stored as plain text** if they can be avoided. Store them securely/hashed where practical.
---
# 12. Full Configuration System — Everything Must Be Configurable
This is extremely important.
I want **as close to 100% of the plugin's behavior as technically practical to be configurable**.
Do not hard-code important settings.
The configuration should allow me to change:
### General
* Plugin settings.
* Debug mode.
* Language.
* Prefix.
* Date/time format.
* Database settings.
* Performance settings.
### Commands
* Command names.
* Subcommands.
* Command permissions.
* Command suggestions.
* Messages.
* Cooldowns.
### Claims
* Minimum size.
* Maximum size.
* Maximum number of claims.
* Claim creation rules.
* Claim expansion rules.
* Claim overlap rules.
* Claim deletion rules.
* Claim visualization.
* Claim expiration if implemented.
* Claim PvP.
* Claim kill settings.
### Economy
* Claim block price.
* Expansion price.
* Refund percentage.
* Currency formatting.
* Economy messages.
### Trust System
Every trust permission should be configurable.
### Ban System
* Ban behavior.
* Teleport behavior.
* Messages.
* Permissions.
### Chest Lock System
* Enable/disable.
* Shift + click behavior.
* Password length.
* Password format.
* Maximum attempts.
* Lock messages.
* Unlock messages.
* GUI settings.
### GUI
Every GUI should be configurable:
* Title.
* Size.
* Slots.
* Item materials.
* Item names.
* Item lore.
* Custom model data.
* Sounds.
* Click actions.
* Messages.
* Navigation buttons.
* Back buttons.
* Close buttons.
* Pagination.
### Particles
* Particle type.
* Color where supported.
* Amount.
* Speed.
* Duration.
* Frequency.
* Visibility distance.
### Messages
All plugin messages must be configurable.
Do not hard-code messages inside Java classes unless absolutely necessary.
---
# 13. SQLite Database
Replace any previous database system with **SQLite**.
Database file:
`Dipper.db`
The database must automatically be created if it does not exist.
Store all necessary persistent data, including:
* Claims.
* Claim owners.
* Claim coordinates.
* Claim sizes.
* Claim settings.
* PvP state.
* Kill state.
* Trusted players.
* Trust permissions.
* Banned players.
* Locked chests.
* Chest passwords/security data.
* Other persistent plugin data.
The database system must:
* Handle server restarts correctly.
* Prevent data loss.
* Use proper connections/prepared statements.
* Avoid SQL injection.
* Handle database errors safely.
* Avoid blocking the main server thread with unnecessary database operations.
* Correctly save and load all claim data.
---
# 14. Complete Bug Audit and Fix
This is a **mandatory requirement**.
Before considering the plugin finished, perform a complete review of the entire plugin.
Do not only implement the features listed above.
Check the entire codebase for:
* Compilation errors.
* Runtime errors.
* NullPointerExceptions.
* Incorrect event handling.
* Permission bypasses.
* Claim overlap bugs.
* Claim boundary bugs.
* Economy calculation errors.
* Double charging.
* Data duplication.
* Database corruption risks.
* GUI bugs.
* Inventory click bugs.
* Shift-click exploits.
* Item duplication exploits.
* Chest-lock bypasses.
* Password bypasses.
* Trust permission bypasses.
* Ban bypasses.
* PvP bypasses.
* Claim deletion issues.
* Claim expansion issues.
* Server restart issues.
* World change issues.
* Player teleport issues.
* Chunk-loading issues.
* Performance problems.
* Memory leaks.
* Async/sync thread problems.
* Race conditions.
* Command completion problems.
* Incorrect permissions.
* Exploit possibilities.
* Version compatibility issues between Paper 1.21.1, 1.21.4, and 1.21.8.
Perform a full code review and fix **every bug you find**, including bugs that are not explicitly mentioned in this specification.
---
# 15. Security and Exploit Prevention
The plugin must be designed to prevent players from bypassing the claim system.
Test and protect against:
* Unauthorized block breaking.
* Unauthorized block placement.
* Unauthorized container access.
* Unauthorized chest access.
* Trust permission bypasses.
* Claim ban bypasses.
* PvP bypasses.
* Claim creation exploits.
* Claim overlap exploits.
* Economy duplication/refund exploits.
* GUI manipulation.
* Inventory manipulation.
* Shift-click exploits.
* Double-click exploits.
* Disconnect/reconnect exploits.
* World-change exploits.
* Teleport exploits.
---
# 16. Performance
The plugin should be optimized for production Paper servers.
Avoid:
* Unnecessary repeating tasks.
* Expensive operations every tick.
* Excessive database queries.
* Blocking the main server thread.
* Scanning huge claim areas unnecessarily.
Use efficient claim lookup and caching where appropriate.
The plugin should remain performant even with a large number of claims and players.
---
# 17. Final Requirement
After implementing everything above, perform a **complete final audit of the plugin from 0 to 100**.
Verify that:
* Every command works.
* Every GUI works.
* Every permission works.
* Every claim rule works.
* Economy transactions work correctly.
* SQLite persistence works.
* Claims survive server restarts.
* Trust permissions work.
* Ban/unban works.
* PvP on/off works.
* Kill/unkill works.
* Chest locking works.
* Admin tools work.
* Command suggestions work.
* Golden Shovel claiming works instantly after selecting the second corner.
* Claim visualization works.
* Configuration options work correctly.
* No important setting is hard-coded.
* No known bugs remain.
* No obvious exploits remain.
* The plugin works correctly on **Paper 1.21.1, 1.21.4, and 1.21.8**.
The final result should be a **complete, stable, secure, optimized, production-ready DipperClaim plugin**, not just a prototype or partial implementation.
Replace the persistence layer with SQLite and make golden-shovel claims create immediately after the second selection.
Update claim rules, economy, PvP/kill, bans, visualization, and permission-safe event handling.
Consolidate owner management into
/claim paneland complete the trust, ban, chest-lock, and admin GUIs.Finalize context-aware completions, configuration coverage, and a targeted security/compatibility audit.
Use
Dipper.dbwith transactional, prepared-statement persistence for claims, trusted permissions, and bans, including one-time legacy claim migration.Keep the in-memory claim index for fast protection lookups while writing only on state changes.
Create claims automatically when the shovel’s second corner is chosen; expansion is explicitly armed with
/claim expandbefore selecting.Validate bounds and overlap before Vault withdrawal, then clear selections only after a successful write.
Done — claims now persist in
Dipper.db, and a valid second Golden Shovel corner creates and charges for a claim immediately.
Added independent trust capabilities for building, breaking, containers, interactions, chest locks, and claim/PvP management.
Enforced bans consistently for movement, teleports, locked containers, and immediate online-player ejection.
Separated
/claim pvp on|offfrom/claim killand/claim unkill, including persistent claim state.Bounded border particles by configured cooldown, duration, distance, and maximum points to prevent large-claim spikes.
Done — PvP and lethal-damage controls are now independent, bans eject online targets and block movement/teleports, and border rendering is rate-limited and bounded.
Consolidated the claim owner controls in
/claim panel, with direct PvP, kill, deletion, trust, ban, and lock management access.Added per-player, per-permission trust editing rather than only Build/Container toggles.
Secured every GUI mutation with fresh owner-or-admin authorization, including chat-based trust additions.
Made
/claim check <player>open an administrator context rather than inheriting owner-only behavior.
Done —
/claim panelis now the unified management surface with secured owner/admin controls, granular trust editing, and administrator claim-context access.- Make SQLite failure-safe with rollback handling and runtime driver inclusion through the project manifest.
Apply configured shovel identity and password feedback rather than hard-coded behavior.
Prevent stale lock records from being managed outside their active claim and revoke temporary access on bans.
Align command metadata and remove obsolete manual-creation code paths.
Final review patches completed:
SQLite claims now use
Dipper.dbwith prepared statements, transactions, rollback on write failure, and a bundled SQLite runtime declaration.Golden Shovel selections create claims immediately on the second corner after area, overlap, and economy checks.
/claim pvp on|offis separate from/claim killand/claim unkill; both states persist in SQLite and are manageable through the panel.Bans now revoke chest sessions, eject online targets, and block movement, teleport, and world-change entry.
Trust permissions are granular and editable through a dedicated permission GUI.
Owner/admin GUI actions revalidate authority before mutating claims.
Border rendering has configurable enablement, cooldown, duration, frequency, distance, and point limits.
Password feedback, command metadata, and claim messages were moved into configuration where applicable.
Password hash checks now use constant-time comparison.
One operational note: the configured Golden Shovel display name is now enforced when non-empty. Rename the intended shovel to the configured claim.golden-shovel-name, or set that config value to an empty string to allow all Golden Shovels.
package dipper;
import dipper.claim.ClaimManager;
import dipper.command.ClaimCommand;
import dipper.data.ClaimStorage;
import dipper.data.LockStorage;
import dipper.economy.EconomyHook;
import dipper.gui.GuiListener;
import dipper.listener.ClaimListener;
import dipper.listener.ContextSuggestionListener;
import dipper.listener.SelectionListener;
import dipper.lock.LockManager;
import dipper.selection.SelectionManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class ir extends JavaPlugin {
@Getter private ClaimManager claimManager;
@Getter private LockManager lockManager;
@Getter private SelectionManager selectionManager;
@Getter private EconomyHook economyHook;
@Override
public void onEnable() {
saveDefaultConfig();
this.economyHook = new EconomyHook(this);
if (!economyHook.setup()) {
getLogger().severe("Vault with an economy provider is required.");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
this.claimManager = new ClaimManager(this, new ClaimStorage(this));
this.lockManager = new LockManager(this, new LockStorage(this));
this.selectionManager = new SelectionManager();
ClaimCommand command = new ClaimCommand(this);
getCommand("claim").setExecutor(command);
getCommand("claim").setTabCompleter(command);
Bukkit.getPluginManager().registerEvents(new SelectionListener(this), this);
Bukkit.getPluginManager().registerEvents(new ClaimListener(this), this);
Bukkit.getPluginManager().registerEvents(new ContextSuggestionListener(this), this);
Bukkit.getPluginManager().registerEvents(new GuiListener(this), this);
}
@Override
public void onDisable() {
if (claimManager != null) claimManager.save();
if (lockManager != null) lockManager.save();
}
}