📄
pasted-code-1787763962461.txt
txt
1169 lines
▶
# CREATE A COMPLETE PROFESSIONAL MINECRAFT PAPER PLUGIN — POTATOZAMIN
You are an expert Minecraft Paper plugin developer.
Your task is to create a **complete, professional, production-ready Minecraft plugin** named **PotatoZamin Plugin**.
Do NOT create a prototype, demo, partial implementation, simplified version, or unfinished project.
Every feature described in this prompt must be implemented with real, working Java code.
---
# 1. PROJECT INFORMATION
**Plugin Name:** PotatoZamin Plugin
**Plugin ID:** PotatoZamin
**Java Package:** `me.potatocraft.potatozamin`
## Compatibility
* Minecraft: **Paper 1.21.11**
* Java: **21**
* Build System: **Maven**
* Server Type: **Paper**
* The plugin must be suitable for a professional multiplayer RolePlay server.
---
# 2. FINAL OUTPUT REQUIREMENT
The final result MUST contain:
* Complete Maven project
* `pom.xml`
* `plugin.yml`
* All Java source files
* All required managers
* All listeners
* All commands
* All GUI classes
* All land classes
* All database/storage classes
* All configuration files
* All message files if needed
* Complete Sign system
* Complete item-based economy system
* Complete Member system
* Complete Trust system
* Complete ownership system
* Complete Return Land system
* Complete admin system
The project MUST successfully compile using:
```text
mvn clean package
```
The final output MUST include:
```text
PotatoZamin.jar
```
The JAR must be ready to place directly inside:
```text
plugins/
```
Do NOT only provide source code.
Do NOT leave unfinished classes.
Do NOT leave TODO implementations.
Do NOT provide fake or placeholder functionality.
---
# 3. VERY IMPORTANT — GLOBAL DEVELOPMENT PRIORITY
**DO NOT focus the entire development only on the Return Land feature.**
Return Land is only **ONE feature** of PotatoZamin.
You must give equal attention to the entire plugin.
The goal is to create a complete, professional Land RolePlay System.
The plugin must NOT be a polished Return Land system surrounded by unfinished features.
Every major system must be fully implemented, tested, and integrated with the rest of the plugin.
---
# 4. COMPLETE PLUGIN SYSTEM
The plugin must include and properly integrate:
1. Land Creation
2. Custom Land Names
3. 3D Land Regions
4. Land Configuration
5. Land Purchase
6. Item-Based Economy
7. Price Management
8. Land Status Management
9. Land Signs
10. Land Management GUI
11. Return Land System
12. Refund System
13. Member System
14. Trust System
15. Land Permissions
16. Land Information
17. Land List
18. Land Delete
19. Reload System
20. Admin Management
21. Player Management
22. Persistent Data Storage
23. Configuration
24. Messages
25. Error Handling
26. GUI Security
27. Sign Security
28. Anti-Exploit Protection
29. Performance Optimization
30. Command System
31. Tab Completion
32. Paper 1.21.11 Compatibility
33. Java 21 Compatibility
34. Maven Build
35. Compiled JAR
All of these systems must work together.
---
# 5. PLUGIN PURPOSE
PotatoZamin is a professional **RolePlay Land System**.
It is NOT a normal WorldGuard-style claim plugin.
Admins create predefined/custom 3D lands.
Players can purchase available lands using Minecraft items.
Players can then manage their purchased land according to their permissions.
The system should be suitable for a professional RolePlay server.
---
# 6. LAND SYSTEM
Each land must have:
* Unique internal ID
* Custom name
* World
* First coordinate
* Second coordinate
* 3D boundaries
* Owner
* Members
* Trusted players
* Price
* Sale status
* Purchase status
* Registered Sign location
A land must support at least two states:
```text
FOR SALE
SOLD
```
When a player returns a land, it MUST automatically become:
```text
FOR SALE
```
---
# 7. CUSTOM LAND NAMES
Land names MUST NOT be hardcoded.
Admins must be able to create completely custom names.
Examples:
```text
Mohammad_House
Villa-01
Shop_A
Downtown
Land_123
PremiumVilla
```
The plugin must accept custom land names without restricting them to predefined names.
---
# 8. 3D LAND REGIONS
The land system must support true 3D regions.
The region must consider:
* X
* Y
* Z
* World
Do NOT create a 2D-only system.
The plugin must correctly determine whether a player/location/block is inside a land.
---
# 9. LAND CREATION
Admins must be able to create lands.
The creation system should allow admins to define:
* First position
* Second position
* World
* Land ID
* Land name
* Price
* Sign location
Store all information permanently.
---
# 10. COMMAND SYSTEM
Create a complete command system using:
```text
/land
```
and optionally support the Persian alias:
```text
/زمین
```
The internal plugin command system should be written in English.
Support commands equivalent to:
```text
/land add
/land delete
/land list
/land info
/land member
/land trust
/land buy
/land sell
/land exit
/land reload
```
Commands must have proper permissions.
Recommended permissions:
```text
potatozamin.admin
potatozamin.use
potatozamin.buy
potatozamin.info
potatozamin.member
potatozamin.trust
potatozamin.return
```
Implement proper tab completion.
---
# 11. LAND PURCHASE
Players must be able to purchase a land that is currently FOR SALE.
Purchase process:
1. Verify that the land exists.
2. Verify that the land is FOR SALE.
3. Verify that the player is allowed to purchase it.
4. Check the player's inventory.
5. Check the required payment items.
6. Remove the required payment items.
7. Set the player as the owner.
8. Change land status to SOLD.
9. Save all data.
10. Update the Sign.
11. Send a success message.
The purchase operation must be protected against double purchases and race conditions.
---
# 12. ITEM-BASED ECONOMY
Do NOT require Vault.
The economy must use Minecraft items.
Examples:
```text
5 DIAMOND
32 EMERALD
10 GOLD_INGOT
64 IRON_INGOT
```
The price parser must correctly detect:
* Amount
* Material
It must validate invalid materials and provide a clear error.
The system should be designed so administrators can easily configure different prices for different lands.
---
# 13. LAND SIGN SYSTEM
Each land can have a registered Sign.
The plugin must store the exact Sign location:
* World
* X
* Y
* Z
The Sign should display useful land information.
Example FOR SALE:
```text
[PotatoZamin]
Villa 01
FOR SALE
32 EMERALD
```
Example SOLD:
```text
[PotatoZamin]
Villa 01
SOLD
Owner: Player
```
After returning the land, automatically update the Sign:
```text
[PotatoZamin]
Villa 01
FOR SALE
32 EMERALD
```
Do NOT display unnecessary plugin descriptions on the Sign.
---
# 14. SIGN SECURITY
Only Signs officially registered by PotatoZamin can activate the land system.
Players must NOT be able to create a fake Sign containing:
```text
[PotatoZamin]
```
and exploit the plugin.
The plugin must verify the exact registered Sign location.
---
# 15. SHIFT + RIGHT CLICK LAND MANAGEMENT
This is an important feature, but it is NOT the only important feature.
When the OWNER of a purchased land:
**holds Shift and right-clicks the registered land Sign**
the plugin must open the Land Management GUI.
The player must NOT need to type a command for this action.
The plugin must verify:
* The Sign belongs to a registered land.
* The land exists.
* The player is the owner.
---
# 16. LAND MANAGEMENT GUI
When the owner Shift + Right Clicks the Sign, open a professional GUI.
The GUI must contain land management options.
One required option is:
## RETURN LAND
Use:
**LAVA_BUCKET**
Display name:
**§cReturn Land**
Example lore:
```text
§7Return this land to the server.
§7The land will become available for sale again.
§eClick to continue.
```
The GUI must be expandable so additional management options can be added later.
---
# 17. RETURN LAND CONFIRMATION GUI
When the player clicks:
**LAVA_BUCKET — Return Land**
DO NOT immediately return the land.
Open a confirmation GUI.
Ask:
```text
Are you sure you want to return this land?
```
The confirmation GUI must contain two clearly separated options.
## YES
Use a GREEN block/item.
Display name:
```text
§aYES
```
## NO
Use a RED block/item.
Display name:
```text
§cNO
```
---
# 18. RETURN LAND — YES
When the player clicks GREEN / YES:
1. Verify the player is still the owner.
2. Verify the land still exists.
3. Remove ownership.
4. Clear appropriate ownership data.
5. Change the land status to FOR SALE.
6. Restore the original sale price.
7. Update the Sign.
8. Save all data.
9. Process the configured refund.
10. Safely give the refund to the player.
11. Send a success message.
The land must immediately become purchasable again.
Example:
Before:
```text
Land: Villa 01
Status: SOLD
Owner: Mohammad
Price: 32 EMERALD
```
After:
```text
Land: Villa 01
Status: FOR SALE
Owner: NONE
Price: 32 EMERALD
```
---
# 19. RETURN LAND — NO
If the player clicks RED / NO:
* Do not modify the land.
* Do not remove the owner.
* Do not refund anything.
* Close the GUI or return to the previous GUI.
---
# 20. REFUND SYSTEM
Refund must be configurable.
Example:
```yaml
refund:
enabled: true
percentage: 100
```
Support percentages such as:
```text
100
90
75
50
```
Example:
Original price:
```text
32 EMERALD
```
100% refund:
```text
32 EMERALD
```
50% refund:
```text
16 EMERALD
```
Handle inventory overflow safely.
If the player's inventory is full, do NOT delete the returned items.
Use a safe mechanism such as dropping the items at the player's location or another configurable fallback.
---
# 21. MEMBERS
The owner must be able to manage Members.
Support commands equivalent to:
```text
/land member add
/land member remove
```
Members must be stored persistently.
Member permissions must be configurable.
---
# 22. TRUST SYSTEM
Implement a Trust system.
Support:
```text
/land trust on
/land trust off
```
Trusted players must have configurable access.
Keep these concepts separate:
* Owner
* Member
* Trusted Player
Do not treat them as the same thing.
---
# 23. LAND INFORMATION
Provide detailed land information.
Example:
```text
Land:
ID:
Name:
Owner:
Status:
Price:
World:
Coordinates:
Members:
Trusted:
Sign:
```
---
# 24. LAND LIST
Provide a land list.
Display:
* ID
* Name
* Status
* Price
* Owner
Allow administrators and permitted players to view it.
---
# 25. LAND DELETE
Admins must be able to delete lands.
Deletion must:
1. Check admin permission.
2. Verify the land exists.
3. Require confirmation if necessary.
4. Remove land data.
5. Remove ownership.
6. Remove Member data.
7. Remove Trust data.
8. Remove Sign association.
9. Save changes.
Do not accidentally delete another land.
---
# 26. RELOAD
Implement:
```text
/land reload
```
Reload configuration and messages safely.
Reload must NOT wipe land data or ownership.
---
# 27. DATA STORAGE
All important information must survive server restarts.
Do NOT store ownership only in RAM.
Use reliable persistent storage.
SQLite is recommended.
YAML is acceptable if implemented safely.
Store at minimum:
* Land ID
* Name
* World
* Coordinates
* Price
* Status
* Owner UUID
* Members
* Trusted players
* Sign location
Use UUIDs internally instead of relying only on player names.
---
# 28. CONFIGURATION
Create a clean `config.yml`.
Allow administrators to configure:
* Messages
* Refund percentage
* GUI titles
* Sign text
* Price format
* Permissions
* Sounds
* Land settings
* GUI settings
* Member permissions
* Trust permissions
Do not hardcode everything.
---
# 29. MESSAGES
All default plugin messages must be in English.
Examples:
```text
Land purchased successfully.
This land is not for sale.
You do not have enough items to purchase this land.
You are not the owner of this land.
Land returned successfully.
Return cancelled.
Land deleted successfully.
Land does not exist.
You do not have permission to do this.
```
All messages must support Minecraft color formatting.
Messages should be configurable.
---
# 30. GUI SECURITY
Players must NOT be able to:
* Take GUI items.
* Move GUI items.
* Drag items.
* Place items into the GUI.
* Duplicate GUI items.
* Exploit confirmation menus.
Cancel unauthorized inventory actions.
Prevent all known GUI item duplication exploits.
---
# 31. PERFORMANCE
Optimize the plugin.
Do NOT constantly scan every block in every land.
Do NOT create unnecessary repeating tasks.
Prefer event-based systems.
Avoid memory leaks.
Avoid unnecessary database operations on the main server thread.
Use caching where appropriate.
---
# 32. ERROR HANDLING
Handle:
* Missing world
* Broken Sign
* Missing land
* Invalid material
* Invalid price
* Offline player
* Corrupted data
* Duplicate land IDs
* Invalid coordinates
* Missing configuration
* Server restart
* Database errors
The plugin must never crash the entire server because of bad land data.
Provide useful console error messages for administrators.
---
# 33. CODE STRUCTURE
Use clean, maintainable Java.
Do NOT put the entire plugin into one giant class.
Recommended structure:
```text
me.potatocraft.potatozamin
├── PotatoZamin.java
├── command
├── config
├── database
├── land
├── gui
├── listener
├── economy
├── sign
├── member
├── trust
├── util
└── model
```
Classes must have clear responsibilities.
---
# 34. SECURITY / ANTI-EXPLOIT
Protect against:
* Double purchase
* Double refund
* Item duplication
* GUI exploits
* Fake Signs
* Unauthorized land management
* Unauthorized ownership changes
* Race conditions
* Invalid UUIDs
* Invalid prices
* Manipulated GUI items
Purchase and Return operations must be handled safely and atomically where practical.
---
# 35. TAB COMPLETION
Implement proper tab completion.
Examples:
```text
/land
```
should show:
```text
add
delete
list
info
member
trust
buy
sell
exit
reload
```
For player-related commands:
```text
/land member add
```
should suggest online players where appropriate.
---
# 36. PAPER 1.21.11 / JAVA 21
Use APIs compatible with:
**Paper 1.21.11**
Compile for:
**Java 21**
Do not use incompatible APIs.
Avoid deprecated APIs when a modern Paper API alternative exists.
---
# 37. MAVEN BUILD
The project must build successfully using:
```text
mvn clean package
```
There must be:
* No compilation errors
* No missing imports
* No missing classes
* No fake methods
* No unfinished methods
* No TODO implementations
* No placeholder functionality
---
# 38. COMPLETE TESTING
Before delivery, test the ENTIRE plugin.
Do NOT only test Return Land.
## LAND
Test:
* Create
* Delete
* List
* Info
* Custom names
* 3D boundaries
* Land status
## ECONOMY
Test:
* Item prices
* Payment
* Invalid materials
* Insufficient items
* Refund
* Inventory overflow
## OWNERSHIP
Test:
* Purchase
* Owner assignment
* Return
* Re-sale
## SIGN
Test:
* Sign registration
* FOR SALE display
* SOLD display
* Owner display
* Shift + Right Click
* Sign update after purchase
* Sign update after return
* Fake Sign protection
## GUI
Test:
* Management GUI
* Lava Bucket
* Return Land button
* Confirmation GUI
* Green YES
* Red NO
* Item protection
* Drag protection
## MEMBERS
Test:
* Add
* Remove
* Permissions
## TRUST
Test:
* Enable
* Disable
* Permissions
## ADMIN
Test:
* Delete
* Reload
* Permissions
## PERSISTENCE
Restart the server and verify:
* Lands remain
* Ownership remains
* Members remain
* Trust data remains
* Prices remain
* Signs remain
* Status remains
---
# 39. COMPLETE RETURN LAND FLOW
The required Return Land flow is:
```text
OWNER
↓
SHIFT + RIGHT CLICK LAND SIGN
↓
LAND MANAGEMENT GUI
↓
LAVA_BUCKET
"Return Land"
↓
CONFIRMATION GUI
↓
GREEN = YES
RED = NO
↓
CLICK GREEN
↓
VERIFY OWNER
↓
REMOVE OWNER
↓
PROCESS REFUND
↓
LAND = FOR SALE
↓
UPDATE SIGN
↓
SAVE DATA
↓
LAND CAN BE PURCHASED AGAIN
```
This workflow MUST work correctly.
However:
**Return Land is only one part of the complete PotatoZamin system.**
---
# 40. GLOBAL DEVELOPMENT RULE
Develop PotatoZamin as a **complete integrated system**.
Do NOT spend most of the development effort on one feature.
Do NOT sacrifice:
* Land Creation
* Land Regions
* Purchase System
* Economy
* Ownership
* Members
* Trust
* Signs
* GUIs
* Commands
* Data Storage
* Security
* Performance
* Admin Tools
just to make Return Land work.
Every feature must be implemented properly.
Every feature must interact correctly with the other features.
---
# 41. FINAL DELIVERY REQUIREMENT
Deliver the complete project:
```text
PotatoZamin/
├── pom.xml
├── src/
├── plugin.yml
├── config.yml
└── ...
```
and the compiled:
```text
PotatoZamin.jar
```
The JAR must be ready to place into:
```text
server/plugins/PotatoZamin.jar
```
The final plugin must genuinely work on:
**Paper 1.21.11 + Java 21**
Do not claim the plugin is complete unless the implementation actually exists and the project successfully builds.
The final goal is:
**A complete, professional, stable PotatoZamin Land RolePlay Plugin — with Return Land included as one feature of the overall system.**
Plan:
Create the Maven/Paper project metadata and configurable resources.
Create the land model, YAML persistence, item economy, sign, and management services.
Create secure GUI classes, event listeners, command handling, and tab completion.
Wire every component through the main plugin class.
Created the complete PotatoZamin Maven/Paper project with:
Persistent YAML land storage
3D land regions and ownership
Item-based economy with configurable prices
Purchase, return, refund, and overflow handling
Registered sign system with fake-sign protection
Owner land-management GUI
Secure return confirmation GUI
Members and trusted players
Configurable land permissions
Admin commands, reload, delete, sign registration
Land list and detailed information
Command aliases and tab completion
Paper 1.21.11 / Java 21 Maven configuration
Build command:
mvn clean package
The resulting artifact is configured as:
target/PotatoZamin.jar
package me.potatocraft.potatozamin;
import me.potatocraft.potatozamin.command.LandCommand;
import me.potatocraft.potatozamin.config.MessageService;
import me.potatocraft.potatozamin.database.LandRepository;
import me.potatocraft.potatozamin.economy.ItemEconomy;
import me.potatocraft.potatozamin.gui.LandManagementGUI;
import me.potatocraft.potatozamin.gui.ReturnConfirmationGUI;
import me.potatocraft.potatozamin.land.LandManager;
import me.potatocraft.potatozamin.listener.LandListener;
import me.potatocraft.potatozamin.sign.SignManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class PotatoZamin extends JavaPlugin {
private MessageService messages;
private ItemEconomy economy;
private SignManager signManager;
private LandManager landManager;
private LandManagementGUI managementGUI;
private ReturnConfirmationGUI confirmationGUI;
@Override
public void onEnable() {
saveDefaultConfig();
messages = new MessageService(this);
economy = new ItemEconomy();
signManager = new SignManager(this);
landManager = new LandManager(this, new LandRepository(this), economy, signManager);
managementGUI = new LandManagementGUI(this);
confirmationGUI = new ReturnConfirmationGUI(this);
LandCommand command = new LandCommand(this);
getCommand("land").setExecutor(command);
getCommand("land").setTabCompleter(command);
Bukkit.getPluginManager().registerEvents(new LandListener(this), this);
getLogger().info("PotatoZamin enabled with " + landManager.all().size() + " loaded lands.");
}
@Override
public void onDisable() {
if (landManager != null) landManager.save();
}
public void reloadPlugin() {
reloadConfig();
for (var land : landManager.all()) signManager.update(land);
}
public MessageService getMessages() {
return messages;
}
public ItemEconomy getEconomy() {
return economy;
}
public LandManager getLandManager() {
return landManager;
}
public LandManagementGUI getManagementGUI() {
return managementGUI;
}
public ReturnConfirmationGUI getConfirmationGUI() {
return confirmationGUI;
}
}