๐
pasted-code-1791090708774.txt
txt
2036 lines
โถ
============================================================
FXGIVEAWAYS โ COMPLETE PLUGIN DEVELOPMENT SPECIFICATION
============================================================
PLUGIN NAME:
FxGiveaways
AUTHOR:
SparkOP
PLUGIN TYPE:
Minecraft/Paper Giveaway Plugin
TARGET:
Modern Paper Minecraft servers
SUPPORTED MINECRAFT/PAPER VERSIONS:
- 1.21.11
- 26.1
- 26.2
JAVA REQUIREMENT:
- Java 25+
- Compile target: Java 25
- Minimum runtime Java version: 25
IMPORTANT:
This is a production-quality plugin specification.
Do NOT create a simplified demo.
Do NOT create placeholder functionality.
Do NOT leave TODOs for core features.
Do NOT fake compatibility.
Do NOT implement only the GUI while leaving the backend incomplete.
Build the entire plugin from scratch.
============================================================
1. PROJECT OBJECTIVE
============================================================
Create a complete, polished, highly configurable Minecraft giveaway
plugin called FxGiveaways.
The plugin should allow players to:
- Create giveaways
- Add physical Minecraft items as prizes
- Configure giveaway duration
- Preview prizes
- Start giveaways
- Browse public giveaways
- Join giveaways
- View giveaway prizes
- View remaining time
- View entry count
- Randomly select winners
- Receive rewards
- Collect pending rewards
- Cancel giveaways when permitted
- View giveaway information/history
The plugin must have a polished inventory GUI system inspired by the
uploaded screenshot references.
The screenshots are VISUAL/UI REFERENCES.
Do not copy source code from any existing plugin.
Do not decompile or reproduce proprietary implementation.
The goal is to reproduce the same type of user experience and visual
concept while implementing an original codebase and architecture.
============================================================
2. VISUAL REFERENCE โ VERY IMPORTANT
============================================================
The uploaded screenshots show the desired GUI style.
Before implementing the GUI, carefully inspect the provided screenshots.
Reproduce the overall design language, including:
- Inventory dimensions
- Slot positioning
- Decorative filler areas
- Border layout
- Item placement
- Button positions
- Icon choices where appropriate
- GUI titles
- Item names
- Lore hierarchy
- Tooltip structure
- Color hierarchy
- Hover information
- Click instructions
- Pagination controls
- Preview layout
- Create-giveaway workflow
- Confirmation/start workflow
- Overall spacing and visual balance
Do NOT blindly copy exact assets or proprietary code.
Instead, reproduce the visual concept as an original implementation.
The final GUI should feel like a polished modern giveaway plugin
with the same visual style shown in the screenshots.
============================================================
3. MAIN GUI
============================================================
Main GUI title:
Public Giveaways
Default inventory:
54 slots
Use a chest-style inventory.
The GUI must display active/public giveaways using clickable giveaway
items/cards.
Example giveaway card:
------------------------------------------------------------
Physicz_Gamerz's GIVEAWAY
[GIVEAWAYS]
Description:
Click on me to enter
Physicz_Gamerz's ongoing giveaway!
Giveaway List:
1x Diamond Pickaxe
1x Diamond Axe
61x Cooked Beef
Entries: 1
Ends In: 23h 59m
LEFT-CLICK to Enter
RIGHT-CLICK to View Items
------------------------------------------------------------
This is an example.
Everything must be configurable.
Do not hardcode the player's name, item names, duration,
colors, or text.
============================================================
4. MAIN GUI CONTROLS
============================================================
The main GUI should support buttons similar to:
YOUR ITEMS
CREATE GIVEAWAYS
NEXT PAGE
PREVIOUS PAGE
REFRESH
COLLECT ALL
GO BACK
All buttons must be configurable.
Each GUI item should support configurable:
- Material
- Amount
- Display name
- Lore
- Slot
- Enchant/glow
- CustomModelData where applicable
- Hide flags
- Click action
- Permission requirement
- Sound
- Message
- Enabled/disabled state
============================================================
5. GIVEAWAY CREATION GUI
============================================================
Create a dedicated GUI for creating giveaways.
The workflow should be:
/giveaway create
Open Create Giveaway GUI.
Player can:
1. Add items
2. Configure duration
3. Configure winners
4. Preview giveaway
5. Confirm/start giveaway
6. Cancel creation
Example controls:
START GIVEAWAY
PREVIEW
DURATION
WINNERS
ITEMS
CANCEL
GO BACK
Example:
Duration:
1d
Items:
3 item(s)
Winners:
1
The GUI should clearly communicate whether the giveaway is ready
to start.
Do not allow a giveaway to start with zero items.
============================================================
6. ITEM INSERTION
============================================================
Players must be able to add actual Minecraft ItemStacks to the
giveaway.
Items must preserve:
- Material
- Amount
- ItemMeta
- Display name
- Lore
- Enchantments
- Attribute modifiers
- CustomModelData
- Item flags
- Potion data
- Book data
- Fireworks data
- Armor properties
- Other supported ItemMeta information
Do not convert prizes into simple material names.
The actual ItemStack must be stored safely.
============================================================
7. ITEM PREVIEW
============================================================
Players must be able to preview all giveaway prizes before starting.
Example:
Giveaway Items
[Diamond Pickaxe]
[Diamond Axe]
[Cooked Beef x61]
Preview should be read-only.
Players must not be able to steal, modify, duplicate, or move preview
items.
============================================================
8. GIVEAWAY JOINING
============================================================
Players can enter an active giveaway.
Example:
LEFT-CLICK:
Enter giveaway
RIGHT-CLICK:
View prizes
Joining must:
- Validate giveaway exists
- Validate giveaway is active
- Validate player is not the owner
- Validate player has permission
- Validate player is not already entered
- Validate all configured requirements
- Add player to participant list
- Update entry count
- Send configurable confirmation message
- Play configurable sound
- Refresh affected GUI(s)
============================================================
9. PLAYER CANNOT ENTER OWN GIVEAWAY
============================================================
If the creator attempts to enter their own giveaway:
Example message:
You cannot enter your own giveaway!
Make this configurable.
============================================================
10. ENTRY SYSTEM
============================================================
Default:
One player = one entry.
However, architect the system so future support for:
- Multiple entries
- Paid entries
- Permission-based bonus entries
- Weighted entries
- Maximum entries
can be added later.
Do not unnecessarily implement paid entries unless configured.
============================================================
11. GIVEAWAY WINNERS
============================================================
When a giveaway expires:
1. Stop accepting entries.
2. Select winner(s) randomly.
3. Announce winner(s).
4. Deliver prizes.
5. Save giveaway result/history.
6. Remove giveaway from active listings.
7. Update GUIs.
8. Play configured effects/sounds.
9. Send configurable messages.
Support multiple winners.
Example:
Winner #1
Winner #2
Winner #3
Prize distribution must be deterministic and safe.
============================================================
12. OFFLINE WINNERS
============================================================
A winner may be offline when the giveaway ends.
Do NOT lose the reward.
Create a pending reward system.
When the player returns:
- Detect pending rewards
- Notify player
- Allow collection
- Prevent duplicate collection
Example:
You have unclaimed giveaway rewards!
============================================================
13. COLLECT ALL
============================================================
The main GUI should have:
COLLECT ALL
This should allow players to collect all pending giveaway rewards
that can safely fit in their inventory.
If the inventory does not have enough space:
- Give only what fits
- Keep remaining rewards pending
- Never delete items
- Never duplicate items
- Inform the player
============================================================
14. NO-PARTICIPANT GIVEAWAYS
============================================================
If a giveaway expires with zero participants:
Do not randomly select a fake winner.
Support configurable behavior:
Option A:
Return prizes to creator
Option B:
Store prizes as creator pending rewards
Option C:
Cancel giveaway without consuming prizes
The behavior must be configurable.
============================================================
15. GIVEAWAY CANCELLATION
============================================================
Creators/admins may cancel giveaways according to permissions/config.
Cancellation must safely handle:
- Active participants
- Stored items
- Pending rewards
- Database state
- GUI state
Never lose giveaway items during cancellation.
============================================================
16. COMMAND SYSTEM
============================================================
Primary command:
/giveaway
Aliases:
/gw
/giveaways
/gws
Recommended commands:
/giveaway
/giveaway help
/giveaway create
/giveaway list
/giveaway join
/giveaway info
/giveaway cancel
/giveaway reload
Admin commands may include:
/giveaway admin list
/giveaway admin force-end
/giveaway admin cancel
/giveaway admin reload
/giveaway admin inspect
/giveaway admin restore
Commands and subcommands must have:
- Tab completion
- Permission checks
- Helpful error messages
- Console safety
- Player-only checks where necessary
============================================================
17. CHAT MESSAGES
============================================================
Support messages such as:
GIVEAWAYS > Physicz_Gamerz started a giveaway with 3 item(s)!
GIVEAWAYS > Type /gwh to enter. (ends in 1d)
You cannot enter your own giveaway!
You have no unclaimed giveaway items.
You must add at least 1 item to start a giveaway!
All messages must be configurable.
============================================================
18. MESSAGE CONFIGURATION
============================================================
Create:
messages.yml
Support configurable:
- Prefix
- Success messages
- Error messages
- Giveaway announcements
- Winner announcements
- Join messages
- Reward messages
- Admin messages
- Permission errors
- GUI-related messages
- Reload messages
Support:
- Legacy color codes
- Hex colors
- MiniMessage where appropriate
- Placeholder replacement
Example:
prefix: "[FxGiveaways]"
============================================================
19. GUI CONFIGURATION
============================================================
Create:
gui.yml
Every important GUI component must be configurable.
Configuration should support:
- GUI title
- Size
- Slots
- Materials
- Names
- Lore
- Colors
- Sounds
- Actions
- Pagination
- Filler items
- Borders
- Empty slots
- Disabled buttons
- Hover text
Do NOT hardcode the GUI layout inside Java wherever avoidable.
============================================================
20. CONFIGURATION FILES
============================================================
Create at minimum:
config.yml
messages.yml
gui.yml
giveaways.yml
sounds.yml
permissions.yml
Optional:
database.yml
placeholders.yml
Configuration should be documented with comments.
============================================================
21. GUI ACTION SYSTEM
============================================================
Create a clean GUI action abstraction.
Examples:
OPEN_GUI
CLOSE
CREATE_GIVEAWAY
START_GIVEAWAY
JOIN_GIVEAWAY
VIEW_ITEMS
NEXT_PAGE
PREVIOUS_PAGE
REFRESH
COLLECT_ALL
BACK
CANCEL
PLAY_SOUND
RUN_COMMAND
RUN_CONSOLE_COMMAND
Avoid hardcoding every GUI click inside one giant listener.
============================================================
22. PAGINATION
============================================================
The Public Giveaways GUI must support pagination.
Example:
Page 1/4
NEXT PAGE
PREVIOUS PAGE
Pagination must:
- Never throw errors on empty pages
- Correctly disable unavailable navigation
- Preserve filters/state where applicable
- Refresh correctly
- Handle giveaway creation/removal while GUI is open
============================================================
23. GIVEAWAY IDENTIFIERS
============================================================
Every giveaway must have a unique ID.
Example:
GW-7F2A91
GW-2026-00042
The ID must remain stable in storage.
Do not use display names as primary identifiers.
============================================================
24. DATABASE / PERSISTENCE
============================================================
Use persistent storage.
Default:
SQLite
Optional:
MySQL/MariaDB
The database must store at least:
- Giveaway ID
- Creator UUID
- Creator name
- Creation timestamp
- Start timestamp
- End timestamp
- Status
- Number of winners
- Prize data
- Participant UUIDs
- Winner UUIDs
- Reward status
- Cancellation status
- Completion timestamp
Use safe serialization for ItemStacks.
============================================================
25. CRASH / RESTART SAFETY
============================================================
This is extremely important.
If the server:
- Crashes
- Restarts
- Reloads
- Shuts down unexpectedly
giveaway data must survive.
On startup:
- Load active giveaways
- Recalculate remaining duration
- Restore participants
- Restore pending rewards
- Restore giveaway state
Never reset an active giveaway because the server restarted.
============================================================
26. ITEM DUPLICATION PREVENTION
============================================================
Implement strong anti-duplication protection.
Protect against:
- Shift-click
- Number-key swapping
- Double-click collection
- Dragging
- Inventory move events
- Drop events
- Hopper interaction
- Container interaction
- Closing/reopening GUI
- Rapid clicking
- Concurrent reward collection
- Server restart
- Crash during reward delivery
A player must never receive the same reward twice.
============================================================
27. GUI SECURITY
============================================================
Every custom GUI must have protection against:
- Item stealing
- Shift-click
- Dragging
- Hotbar swapping
- Double-click collection
- Creative inventory exploits
- Inventory manipulation
- Invalid slot interaction
Validate GUI state server-side.
Never trust client-side GUI state.
============================================================
28. PERMISSIONS
============================================================
Create permissions such as:
fxgiveaways.use
fxgiveaways.create
fxgiveaways.join
fxgiveaways.cancel
fxgiveaways.admin
fxgiveaways.reload
fxgiveaways.bypass
fxgiveaways.unlimited
fxgiveaways.view
fxgiveaways.collect
All permissions must be configurable/documented.
============================================================
29. LIMITS
============================================================
Support configurable limits:
- Maximum active giveaways per player
- Maximum giveaway duration
- Minimum giveaway duration
- Maximum number of prizes
- Maximum winners
- Maximum entries
- Cooldown between giveaways
- Permission-based limits
Example:
limits:
max-active-giveaways: 3
max-duration: 7d
max-winners: 10
max-items: 54
============================================================
30. PLACEHOLDERAPI
============================================================
If PlaceholderAPI is available, optionally support placeholders.
Examples:
%fxgiveaways_active%
%fxgiveaways_total%
%fxgiveaways_player_giveaways%
%fxgiveaways_pending_rewards%
Do not make PlaceholderAPI a mandatory dependency unless necessary.
============================================================
31. VAULT
============================================================
Architect optional Vault integration.
This allows future support for:
- Paid giveaways
- Entry fees
- Economy rewards
- Permission-based economy features
Vault should remain optional unless a configured feature requires it.
============================================================
32. SOUNDS
============================================================
Create:
sounds.yml
Support configurable sounds for:
- GUI open
- GUI click
- Giveaway created
- Giveaway started
- Player joined
- Winner selected
- Reward collected
- Error
- Page change
- Preview
- Cancel
Allow:
- Sound
- Volume
- Pitch
- Enabled/disabled
============================================================
33. PARTICLE / EFFECT SUPPORT
============================================================
Optionally support configurable effects for:
- Giveaway start
- Giveaway end
- Winner announcement
- Reward collection
Do not make visual effects mandatory.
============================================================
34. TIME FORMATTING
============================================================
Support human-readable durations.
Examples:
23h 59m
1d
2d 4h
15m
30s
Use configurable formatting.
Do not display negative time.
When the timer reaches zero, the giveaway must transition safely
to the ending/completed state.
============================================================
35. TIME ZONE
============================================================
Store timestamps in a reliable server-independent format.
Prefer UTC internally.
Display times/durations according to configured formatting.
Do not rely on the machine's local timezone for correctness.
============================================================
36. ADMIN FEATURES
============================================================
Admins should be able to:
- View active giveaways
- Inspect giveaway details
- Force-end giveaway
- Cancel giveaway
- Restore giveaway where safely possible
- View participants
- View winners
- Reload configuration
- Inspect pending rewards
- Repair/recover safe giveaway states
All dangerous operations require permissions.
============================================================
37. HISTORY
============================================================
Maintain giveaway history.
Store:
- Giveaway ID
- Creator
- Items
- Start/end time
- Participants
- Winners
- Status
Support future GUI/history expansion.
============================================================
38. RELOAD
============================================================
Support:
/giveaway reload
Reload:
- messages
- GUI
- sounds
- limits
- permissions/configuration
Do NOT blindly reload runtime state that could corrupt active giveaways.
Database state must remain safe.
Avoid Bukkit/Paper full plugin reload behavior.
============================================================
39. PERFORMANCE
============================================================
The plugin must be lightweight.
Do NOT:
- Run database queries every tick
- Rebuild all GUI inventories every tick
- Create unnecessary async tasks
- Spam the main thread
- Store unnecessary duplicate ItemStacks
- Leak listeners/tasks
- Create uncontrolled timers
Use efficient scheduled tasks.
Only update GUI/timers when required.
============================================================
40. THREAD SAFETY
============================================================
Paper/Bukkit API access must occur on the correct thread.
Database operations may be asynchronous where safe.
Never access Bukkit API unsafely from async threads.
Use proper synchronization/locking for:
- Giveaway state
- Participant changes
- Reward claiming
- Giveaway completion
- Database writes
A giveaway must never be completed twice due to race conditions.
============================================================
41. JAVA 25+
============================================================
The project MUST target:
Java 25
Minimum supported runtime:
Java 25
Do not target Java 21 as the plugin runtime requirement.
Use Java 25 language/API features only where appropriate.
Do not use preview features.
The final plugin must run on:
Java 25
newer supported Java versions
README must clearly state:
"FxGiveaways requires Java 25 or newer."
============================================================
42. MINECRAFT/PAPER COMPATIBILITY
============================================================
Target:
Paper 1.21.11
Paper 26.1
Paper 26.2
The plugin must be architected so that the core giveaway system is
version-independent.
Preferred architecture:
CORE
โ
SERVICES
โ
COMPATIBILITY LAYER
โ
PAPER/Bukkit API
Create a package such as:
com.sparkop.fxgiveaways.compat
Possible classes:
CompatManager
VersionCompat
ItemCompat
InventoryCompat
ComponentCompat
MaterialCompat
SoundCompat
Only place genuinely version-specific behavior inside this layer.
Do NOT scatter version checks throughout the codebase.
============================================================
43. IMPORTANT CROSS-VERSION RULE
============================================================
The goal is ONE plugin JAR that works across:
1.21.11
26.1
26.2
where technically supported by the Paper API.
Do not create separate forks of the entire plugin.
Do not use unnecessary NMS.
Prefer:
- Paper API
- Bukkit API
- Adventure API
over:
- CraftBukkit internals
- NMS
- reflection
- version-specific server internals
If a version-specific API difference is unavoidable, isolate it
behind the compatibility layer.
============================================================
44. API-VERSION / PLUGIN.YML
============================================================
Do NOT blindly set:
api-version: 26.2
if that would prevent the plugin from loading on older supported
versions.
The plugin.yml must use the correct Paper API-version declaration
compatible with the complete supported range.
Verify the actual API-version rules for the chosen Paper API before
finalizing plugin.yml.
The final plugin.yml should contain:
name: FxGiveaways
main:
version: ${version}
author: SparkOP
plus:
- commands
- permissions
- appropriate API version
- optional dependencies
- soft dependencies
Do not invent unsupported plugin.yml fields.
============================================================
45. PAPER API DEPENDENCY
============================================================
Use the appropriate modern Paper API dependency.
The project must compile with Java 25.
Use a build system such as:
Gradle
or:
Maven
Prefer Gradle if no existing project constraint exists.
Use dependency versions that are actually compatible with the target
Paper API.
Do not mix incompatible API versions.
============================================================
46. CROSS-VERSION TESTING
============================================================
The developer must ACTUALLY test, where the environment permits:
1. Paper 1.21.11 + Java 25
2. Paper 26.1 + Java 25
3. Paper 26.2 + Java 25
Test at minimum:
- Server startup
- Plugin startup
- /giveaway
- /giveaways
- GUI opening
- GUI closing
- GUI clicking
- Create giveaway
- Add item
- Remove item
- Preview
- Start giveaway
- Join giveaway
- Duplicate join prevention
- Giveaway expiration
- Winner selection
- Multiple winners
- Offline winner
- Pending rewards
- Collect all
- Inventory-full reward handling
- Cancellation
- Pagination
- Reload
- Database save
- Database load
- Server restart recovery
- Shift-click protection
- Drag-click protection
- Number-key protection
- Double-click protection
- Creative-mode protection
- Concurrent clicking
- Multiple players interacting simultaneously
============================================================
47. FUTURE VERSION SAFETY
============================================================
The architecture must make future Minecraft/Paper updates easy.
Adding a future version should ideally require changing only:
compatibility classes
and/or
build configuration.
Do not make the core giveaway engine depend on Minecraft version
numbers.
============================================================
48. CONFIG FILE STRUCTURE
============================================================
Suggested structure:
src/main/resources/
plugin.yml
config.yml
messages.yml
gui.yml
giveaways.yml
sounds.yml
permissions.yml
database.yml
Use clean YAML.
Document important options.
Provide sensible defaults.
============================================================
49. PROJECT STRUCTURE
============================================================
Use clean architecture similar to:
com.sparkop.fxgiveaways
FxGiveaways.java
command/
GiveawayCommand.java
GiveawayTabCompleter.java
giveaway/
Giveaway.java
GiveawayManager.java
GiveawayService.java
GiveawayState.java
GiveawayResult.java
GiveawayScheduler.java
WinnerSelector.java
gui/
GuiManager.java
GuiHolder.java
GuiAction.java
GuiButton.java
PublicGiveawaysGui.java
CreateGiveawayGui.java
PreviewGui.java
RewardGui.java
item/
ItemSerializer.java
ItemStorage.java
ItemPreviewService.java
reward/
RewardManager.java
PendingReward.java
RewardService.java
database/
DatabaseManager.java
SQLiteDatabase.java
MySQLDatabase.java
GiveawayRepository.java
config/
ConfigManager.java
MessageManager.java
GuiConfig.java
SoundConfig.java
listener/
InventoryListener.java
PlayerListener.java
GiveawayListener.java
placeholder/
PlaceholderHook.java
economy/
EconomyHook.java
compat/
CompatManager.java
VersionCompat.java
ItemCompat.java
InventoryCompat.java
ComponentCompat.java
util/
TimeUtil.java
ItemUtil.java
TextUtil.java
UUIDUtil.java
Keep responsibilities separated.
Avoid giant classes.
============================================================
50. ADVENTURE / TEXT
============================================================
Use modern Adventure Components where appropriate.
Support:
- Legacy colors
- Hex colors
- MiniMessage
- Click events where useful
- Hover events where useful
Do not concatenate unsafe raw strings everywhere.
============================================================
51. GUI VISUAL STYLE
============================================================
The default GUI should visually resemble the uploaded references.
Recommended visual language:
- Dark inventory background
- Gray/white filler items
- Purple/blue accent colors
- Green success actions
- Red destructive actions
- Yellow/orange information
- Clear headings
- Compact lore
- Consistent spacing
- Decorative borders
- Obvious click instructions
Example semantic colors:
SUCCESS:
Green
ERROR:
Red
INFO:
Aqua/Blue
WARNING:
Yellow/Orange
ACCENT:
Purple
These must remain configurable.
============================================================
52. DEFAULT GUI TEXT
============================================================
Use the screenshot-inspired structure.
Examples:
Public Giveaways
YOUR ITEMS
CREATE GIVEAWAYS
NEXT PAGE
PREVIOUS PAGE
REFRESH
COLLECT ALL
GO BACK
START GIVEAWAY
PREVIEW
Giveaway List:
Entries:
Ends In:
LEFT-CLICK to Enter
RIGHT-CLICK to View Items
All of these must be configurable.
============================================================
53. GIVEAWAY CARD DESIGN
============================================================
Each active giveaway should show:
Creator
Description
Prize summary
Entry count
Remaining time
Interaction instructions
Example lore:
[GIVEAWAYS]
Description:
Click on me to enter
PlayerName's ongoing giveaway!
Giveaway List:
1x Diamond Pickaxe
1x Diamond Axe
61x Cooked Beef
Entries: 12
Ends In: 4h 23m
LEFT-CLICK to Enter
RIGHT-CLICK to View Items
Long prize lists should be intelligently shortened.
Example:
1x Diamond Sword
1x Diamond Pickaxe
1x Golden Apple
+ 7 more...
The full list remains available in Preview/View Items.
============================================================
54. GIVEAWAY CREATION VALIDATION
============================================================
Before starting:
Check:
- Player has permission
- Player has not exceeded limit
- Giveaway contains at least one item
- Items are valid
- Duration is valid
- Winner count is valid
- Player is allowed to create giveaway
- Server state is valid
Example error:
You must add at least 1 item to start a giveaway!
============================================================
55. GIVEAWAY STATE MACHINE
============================================================
Use explicit giveaway states.
Example:
DRAFT
ACTIVE
ENDING
COMPLETED
CANCELLED
REFUNDED
Never rely solely on nullable fields to determine state.
State transitions must be validated.
============================================================
56. WINNER SELECTION
============================================================
Winner selection must use a secure and fair random selection mechanism.
Requirements:
- No duplicate winners
- Only valid participants
- Creator excluded
- Correct number of winners
- Safe behavior when participant count < winner count
- Persist winners immediately
If there are fewer participants than configured winners,
select only available unique participants.
============================================================
57. REWARD DELIVERY
============================================================
Rewards must be delivered safely.
If the inventory has room:
Give immediately.
If inventory is full:
Store as pending.
If player is offline:
Store as pending.
Never delete a reward because delivery failed.
============================================================
58. DATABASE TRANSACTION SAFETY
============================================================
Important state changes should be transactional where practical.
Especially:
- Giveaway completion
- Winner assignment
- Reward assignment
- Reward claiming
- Cancellation/refunds
The plugin should be recoverable after an interrupted operation.
============================================================
59. BACKUP / RECOVERY
============================================================
Implement reasonable backup/recovery support.
At minimum:
- Safe database writes
- No destructive migration without backup
- Recovery-safe reward state
- Optional database backup configuration
Do not delete historical giveaway data unexpectedly.
============================================================
60. DATABASE MIGRATIONS
============================================================
If database schema changes in future versions:
Use schema versioning.
Do not simply delete and recreate tables.
Migrations must preserve existing giveaways/rewards.
============================================================
61. LOGGING
============================================================
Use clean logging.
Examples:
[FxGiveaways] Plugin enabled.
[FxGiveaways] Loaded 12 active giveaways.
[FxGiveaways] SQLite database initialized.
[FxGiveaways] Giveaway GW-XXXX completed.
Errors should contain useful diagnostic information.
Do not spam the console every tick.
============================================================
62. ERROR HANDLING
============================================================
Never allow one malformed giveaway to crash the entire plugin.
If corrupted data is encountered:
- Log the problem
- Safely isolate affected data
- Preserve recoverable rewards
- Continue loading other giveaways
Do not silently delete corrupted reward data.
============================================================
63. SECURITY / EXPLOIT PREVENTION
============================================================
Protect against:
- Item duplication
- Reward duplication
- Giveaway duplication
- Double completion
- Race conditions
- Invalid inventory actions
- Malicious packet/input behavior where relevant
- Unauthorized commands
- Permission bypasses
- GUI spoofing
- Invalid giveaway IDs
Validate all important actions server-side.
============================================================
64. GUI STATE VALIDATION
============================================================
Every inventory GUI must have a recognizable holder/state.
Do not identify custom GUIs only by title.
A player could potentially open an inventory with the same title.
Use custom InventoryHolder implementations or equivalent robust state
identification.
============================================================
65. TESTING
============================================================
Create automated/unit tests where practical.
Test:
- Giveaway state transitions
- Winner selection
- Participant management
- Time calculations
- Item serialization
- Reward claiming
- Duplicate protection
- Pagination
- Configuration parsing
Manual test checklist must also be included.
============================================================
66. BUILD
============================================================
The project must build successfully.
Expected command:
./gradlew clean build
or equivalent Maven command.
Output:
build/libs/FxGiveaways-.jar
No compilation errors.
No unresolved dependencies.
No missing resources.
============================================================
67. README
============================================================
Create a professional README.md.
Include:
- Plugin description
- Features
- Requirements
- Installation
- Java requirement
- Supported Minecraft/Paper versions
- Commands
- Permissions
- Configuration
- PlaceholderAPI
- Vault
- Database
- GUI customization
- Troubleshooting
- Developer API
- Compatibility notes
- Example configuration
Clearly state:
FxGiveaways requires Java 25 or newer.
Supported target versions:
Paper 1.21.11
Paper 26.1
Paper 26.2
============================================================
68. DEVELOPER API
============================================================
Expose a clean API for other plugins.
Potential API:
GiveawayManager
GiveawayService
Giveaway
GiveawayEvent
Events:
GiveawayCreateEvent
GiveawayStartEvent
GiveawayJoinEvent
GiveawayEndEvent
GiveawayWinnerEvent
GiveawayRewardClaimEvent
GiveawayCancelEvent
Use Bukkit/Paper event conventions.
============================================================
69. EVENT CANCELLATION
============================================================
Where appropriate, Bukkit/Paper events should support cancellation.
Example:
GiveawayJoinEvent
A third-party plugin should be able to prevent a player from joining.
============================================================
70. OPTIONAL INTEGRATIONS
============================================================
Support optional integrations without making them mandatory:
PlaceholderAPI
Vault
Use soft dependencies where appropriate.
The plugin must still function without them.
============================================================
71. CONFIGURATION EXAMPLE
============================================================
Provide sensible defaults.
Example:
giveaways:
max-active-per-player: 3
max-duration: 7d
min-duration: 5m
max-winners: 10
max-items: 54
allow-multiple-entries: false
rewards:
offline-delivery: true
pending-rewards: true
database:
type: sqlite
gui:
public:
title: "Public Giveaways"
size: 54
============================================================
72. BRANDING
============================================================
Everywhere appropriate use:
FxGiveaways
Author:
SparkOP
Do not use:
LxGiveaways
as the plugin name.
Do not use another author's branding.
The LxGiveaways reference is only a conceptual/product-reference
point for understanding the requested feature category and UI style.
============================================================
73. ORIGINAL IMPLEMENTATION
============================================================
This project must be independently implemented.
Do not:
- Copy proprietary source code
- Decompile another plugin
- Reproduce internal classes
- Copy copyrighted implementation
- Pretend another plugin's code is original
Only reproduce the requested functionality and general UI concept.
============================================================
74. FINAL QUALITY BAR
============================================================
The final plugin must feel like a commercial-quality Minecraft plugin.
It should be:
- Stable
- Fast
- Secure
- Maintainable
- Highly configurable
- Visually polished
- Cross-version aware
- Crash resistant
- Restart safe
- Exploit resistant
- Easy to configure
- Easy to extend
Do not sacrifice correctness just to finish faster.
============================================================
75. FINAL IMPLEMENTATION CHECKLIST
============================================================
Before declaring the project complete, verify:
[ ] FxGiveaways branding
[ ] SparkOP author
[ ] Java 25 compilation
[ ] Java 25 runtime
[ ] Paper 1.21.11 compatibility
[ ] Paper 26.1 compatibility
[ ] Paper 26.2 compatibility
[ ] Main GUI
[ ] Public Giveaways GUI
[ ] Create Giveaway GUI
[ ] Preview GUI
[ ] Reward GUI
[ ] Pagination
[ ] Giveaway creation
[ ] Item insertion
[ ] Item serialization
[ ] Giveaway joining
[ ] Duplicate entry prevention
[ ] Winner selection
[ ] Multiple winners
[ ] Offline winners
[ ] Pending rewards
[ ] Collect All
[ ] Inventory-full protection
[ ] Giveaway cancellation
[ ] No-participant handling
[ ] SQLite
[ ] Optional MySQL/MariaDB
[ ] Database persistence
[ ] Restart recovery
[ ] Crash-safe state
[ ] Permissions
[ ] Commands
[ ] Tab completion
[ ] Config files
[ ] Messages
[ ] Sounds
[ ] PlaceholderAPI integration
[ ] Optional Vault integration
[ ] Admin features
[ ] History
[ ] Reload
[ ] Anti-duplication
[ ] GUI exploit protection
[ ] Thread safety
[ ] Performance optimization
[ ] Error handling
[ ] Logging
[ ] API/events
[ ] README
[ ] Unit tests where practical
[ ] Manual testing checklist
[ ] Successful clean build
============================================================
76. MOST IMPORTANT VISUAL REQUIREMENT
============================================================
The uploaded screenshots are the primary visual reference.
Before finalizing the GUI, compare the implementation against them.
Pay particular attention to:
1. Inventory size
2. GUI title
3. Border/filler arrangement
4. Giveaway card position
5. Button locations
6. Icon selection
7. Item names
8. Lore hierarchy
9. Color hierarchy
10. Spacing
11. Preview layout
12. Create-giveaway layout
13. Pagination
14. Hover tooltips
15. Click instructions
16. Overall visual density
17. Readability
18. Consistency between all GUIs
The result should look intentionally designed rather than like a
generic Bukkit inventory menu.
============================================================
77. DO NOT TAKE SHORTCUTS
============================================================
Do NOT:
- Hardcode everything into Java
- Use one giant listener class
- Store giveaways only in memory
- Ignore restart recovery
- Ignore offline players
- Ignore inventory-full situations
- Ignore race conditions
- Ignore item metadata
- Ignore GUI exploits
- Ignore version compatibility
- Use unnecessary NMS
- Claim compatibility without testing
- Leave core TODOs
- Use fake/mock implementations in the final build
============================================================
78. FINAL RESPONSE FROM THE CODING AGENT
============================================================
After implementation, report:
1. Project structure
2. Minecraft/Paper versions tested
3. Java version tested
4. Build command used
5. Final JAR path
6. Commands
7. Permissions
8. Configuration files
9. Database implementation
10. Optional integrations
11. Compatibility limitations, if any
12. Tests performed
13. Any known issues
Do not claim a version was tested if it was not actually tested.
============================================================
79. FINAL OBJECTIVE
============================================================
Deliver a complete, production-ready:
FxGiveaways
Minecraft giveaway plugin by:
SparkOP
Target environment:
Paper
Minecraft 1.21.11 โ 26.2
Java 25+
with a highly customizable GUI inspired by the provided screenshots,
while maintaining an original implementation, strong persistence,
security, performance, cross-version architecture, and professional
code quality.
START IMPLEMENTATION NOW.
============================================================
Build the Java 25 Paper plugin foundation and SQLite-backed giveaway/reward services.
Add secure creation, browsing, preview, joining, cancellation, expiry, and collection flows.
Add configurable commands, GUIs, messages, permissions, sounds, and setup documentation.
Created FxGiveaways with a Java 25 Gradle setup, SQLite persistence, public and creation GUIs, prize previews, giveaway joining and cancellation, expiry and winner selection, pending rewards, commands, configuration files, and a README.
The build is configured to produce build/libs/FxGiveaways-1.0.0.jar. I did not run a build or test on a Paper server, so compilation and compatibility with Paper 1.21.11, 26.1, and 26.2 remain unverified.
This is not yet the full production specification: MySQL, PlaceholderAPI and Vault integrations, draft persistence across a crash, the broader admin/API features, and automated tests are not implemented. Reward delivery also has a narrow crash window between giving items and updating the stored pending reward.
package com.sparkop.fxgiveaways;
import com.sparkop.fxgiveaways.command.GiveawayCommand;
import com.sparkop.fxgiveaways.compat.CompatManager;
import com.sparkop.fxgiveaways.database.SQLiteDatabase;
import com.sparkop.fxgiveaways.giveaway.GiveawayService;
import com.sparkop.fxgiveaways.gui.GuiManager;
import com.sparkop.fxgiveaways.reward.RewardService;
import com.sparkop.fxgiveaways.util.TextUtil;
import com.sparkop.fxgiveaways.util.TimeUtil;
import com.cryptomorin.xseries.XSound;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.sql.SQLException;
import java.util.Map;
public final class FxGiveaways extends JavaPlugin {
private FileConfiguration messages;
private FileConfiguration guiConfig;
private FileConfiguration sounds;
private FileConfiguration permissions;
private SQLiteDatabase database;
private GiveawayService giveawayService;
private RewardService rewardService;
private GuiManager guiManager;
private CompatManager compatManager;
@Override
public void onEnable() {
saveDefaultConfig();
saveResourceIfMissing("messages.yml");
saveResourceIfMissing("gui.yml");
saveResourceIfMissing("giveaways.yml");
saveResourceIfMissing("sounds.yml");
saveResourceIfMissing("permissions.yml");
reloadPluginFiles();
compatManager = new CompatManager();
try {
File databaseFile = new File(getDataFolder(), getConfig().getString("database.file", "giveaways.db"));
database = new SQLiteDatabase(databaseFile);
} catch (SQLException exception) {
getLogger().severe("Could not initialize SQLite storage: " + exception.getMessage());
getServer().getPluginManager().disablePlugin(this);
return;
}
rewardService = new RewardService(this, database);
giveawayService = new GiveawayService(this, database, rewardService);
guiManager = new GuiManager(this);
getServer().getPluginManager().registerEvents(guiManager, this);
getServer().getPluginManager().registerEvents(new com.sparkop.fxgiveaways.listener.PlayerListener(this), this);
GiveawayCommand command = new GiveawayCommand(this);
getCommand("giveaway").setExecutor(command);
getCommand("giveaway").setTabCompleter(command);
getServer().getScheduler().runTaskTimer(this, giveawayService::tick, 20L, 20L);
getLogger().info("FxGiveaways enabled; loaded " + giveawayService.activeGiveaways().size() + " active giveaway(s).");
}
@Override
public void onDisable() {
if (database != null) {
database.close();
}
}
public void reloadPluginFiles() {
reloadConfig();
messages = loadYaml("messages.yml");
guiConfig = loadYaml("gui.yml");
sounds = loadYaml("sounds.yml");
permissions = loadYaml("permissions.yml");
}
private void saveResourceIfMissing(String name) {
if (!new File(getDataFolder(), name).exists()) {
saveResource(name, false);
}
}
private FileConfiguration loadYaml(String name) {
return YamlConfiguration.loadConfiguration(new File(getDataFolder(), name));
}
public void send(Player player, String key) {
send(player, key, Map.of());
}
public void send(Player player, String key, Map<String, String> placeholders) {
String prefix = messages.getString("prefix", "");
String message = messages.getString("messages." + key, "&cMissing message: " + key);
message = TextUtil.replace(message, placeholders);
player.sendMessage(TextUtil.colorize(prefix + message));
}
public void broadcast(String key, Map<String, String> placeholders) {
String prefix = messages.getString("prefix", "");
String message = TextUtil.replace(messages.getString("messages." + key, ""), placeholders);
Bukkit.broadcastMessage(TextUtil.colorize(prefix + message));
}
public String formattedMessage(String key, Map<String, String> placeholders) {
return TextUtil.colorize(messages.getString("prefix", "")
+ TextUtil.replace(messages.getString("messages." + key, key), placeholders));
}
public boolean hasPermission(Player player, String key) {
String node = permissions.getString("permissions." + key, "fxgiveaways." + key);
return player.hasPermission(node);
}
public void playSound(Player player, String key) {
String path = "sounds." + key;
if (!sounds.getBoolean(path + ".enabled", false)) {
return;
}
String soundName = sounds.getString(path + ".sound", "");
XSound.matchXSound(soundName).ifPresent(sound ->
player.playSound(player.getLocation(), sound.get(),
(float) sounds.getDouble(path + ".volume", 1.0),
(float) sounds.getDouble(path + ".pitch", 1.0)));
}
public FileConfiguration guiConfig() { return guiConfig; }
public SQLiteDatabase database() { return database; }
public GiveawayService giveawayService() { return giveawayService; }
public RewardService rewardService() { return rewardService; }
public GuiManager guiManager() { return guiManager; }
public CompatManager compatManager() { return compatManager; }
public static String formatTime(long millis) { return TimeUtil.format(millis); }
}