TreasureCoffer - The Ultimate Lucky Draw Chest Plugin!
Hello Minecraft Adventurers and Server Owners!
Are you looking to add an exciting gacha-style lucky draw system to your server? Look no further! **TreasureCoffer** is a feature-rich Bukkit/Spigot 1.20.1 plugin that brings a complete treasure chest lottery experience to your players. From customizable rewards and GUI to in-world physical chests and even player-created personal lotteries, TreasureCoffer has it all!
Core Features at a Glance
TreasureCoffer is packed with functionalities designed to enhance player engagement and provide server administrators with powerful customization tools.
- Sophisticated Lottery System
- **Dual Prize Pools:** Configure both a "Normal Prize Pool" for regular draws and a "Pity Prize Pool" that guarantees a special reward after a certain number of attempts.
- **Flexible Costs:** Players can use in-game money (Vault), points (PlayerPoints), or specific "Key" items to open chests.
- **Single & Multi-Draw:** Allow players to open one chest at a time or perform a bulk "multi-draw" (e.g., 9 draws at once, customizable per chest).
- **Full NBT Support:** Items as rewards retain ALL their NBT data (enchantments, custom names, lores, mod-specific data).
- **Command Rewards:** Assign server commands as prizes (e.g., give a rank, broadcast a message). Use `%player%` for player name.
- Interactive GUI System
- **Customizable Layout:** Define the slot positions for draw buttons, next/previous page buttons, and even border items in `config.yml`.
- **Informative Draw Button:** Displays current draw count, pity progress, and the cost (money, points, keys).
- **Rich Item Display:** Rewards in the GUI are shown with their full details.
- **Pagination:** Easily browse through extensive prize lists.
- **Visual Feedback:** Clear messages for success, pity triggers, and insufficient funds/keys.
- In-World Physical Chests
- **Placeable Chest Blocks:** Spawn actual "chest" entities in your world that players can interact with.
- **Custom Appearance:** Use any block/item model for the chest's look.
- **Transformations:** Rotate, scale, and offset the chest model for unique designs.
- **Glow Effects:** Make your chests stand out with customizable glow colors.
- **Easy Interaction:** Left-click to open the draw GUI, Right-click to view pity rewards (if enabled). Admins can Shift+Right-click to remove.
- Player-Created Chests
- **Personal Lotteries:** Players can create their own treasure chests (number limited by permissions).
- **Stock Your Own Prizes:** Players add items from their inventory to their personal chest's prize pool.
- **Set Your Price:** Chest owners can set a Gold or Point fee for others to use their chest.
- **Earn from Others:** Fees paid by other players go directly to the chest owner, even if they're offline!
- **Privacy Controls:** Owners can decide if others can view the contents of their chest (drawing is always possible).
- Comprehensive Configuration & Management
- **Per-Chest Settings:** Customize name, display name, opening conditions (keys, currency), multi-draw count, pity trigger count, and whether pity rewards can be viewed.
- **Key Identification:** Keys can be recognized by their full NBT data or just their item name.
- **Player Data Tracking:** Automatically saves each player's draw count for every chest, managing pity progression.
- **Message Customization:** All plugin messages are configurable, with support for color codes. Includes `messages_en.yml` for English translations.
- **Broadcast Control:** Configure server-wide announcements for normal and pity prize wins, and toggle console logging for these.
- **Smart Inventory Handling:** Automatically adjusts multi-draw attempts if a player's inventory is nearly full, and provides clear warnings.
How to Use - Commands
Manage every aspect of TreasureCoffer with these intuitive commands.
(Default prefix: `/tc`)
Code (YAML):
# --- Admin Chest Management ---
/tc create <chest_name>
# Creates a new treasure chest.
/tc add <chest_name>
[probability
]
# Adds the item in your hand to the normal prize pool.
/tc addlucky <chest_name>
[probability
]
# Adds the item in your hand to the pity prize pool.
/tc addcmd <chest_name> <command>
[probability
]
# Adds a command reward to the normal prize pool.
# (Use %player% for player name, underscores for spaces in command)
/tc open <chest_name>
# View normal prizes (Admins can Right-Click to remove items).
/tc openlucky <chest_name>
# View pity prizes (Admins can Right-Click to remove items).
/tc money <chest_name> <price> <type>
# Set the currency type (e.g., VAULT, PLAYERPOINTS) and price.
/tc keyset <chest_name> <true/false>
# Enable/disable key requirement for this chest.
/tc keyadd <chest_name>
# Sets the item in your hand as the key for this chest.
/tc setmax <chest_name> <count>
# Sets the maximum number of draws to trigger pity.
# --- Physical Chest Block Management ---
/tc setbox <chest_name>
# Sets the appearance of the physical chest block (using item in hand).
/tc spawnbox <chest_name>
# Spawns a physical chest block at your location.
/tc setglow <chest_name> <true/false>
# Enable/disable glowing effect for the physical chest.
/tc setglowcolor <chest_name> <color>
# Set the glow color (e.g., RED, BLUE, GOLD).
/tc restoreboxes
# Attempts to restore all physical chest blocks (e.g., after a world issue).
# --- Player Data & Plugin Management ---
/tc set <player_name> <chest_name> <count>
# Sets a player's draw count for a specific chest.
/tc reload
# Reloads the plugin configuration and chest data.
# --- Player Usage ---
/tc lottery <chest_name>
# Opens the lottery GUI for the specified chest.
# --- Player Chest Management (Commands for Players) ---
/tc createplayer <chest_name>
# Creates a personal treasure chest.
/tc addplayer <chest_name> <probability>
# Adds the item in your hand to your personal chest.
/tc delplayer <chest_name>
# Deletes your personal chest and returns its items.
/tc openplayer <player_name> <chest_name>
# Opens another player's personal chest to draw.
/tc viewplayer <player_name> <chest_name>
# Views the contents of another player's personal chest.
/tc setplayermoney <chest_name> <amount>
# Sets the Gold cost for your personal chest.
/tc setplayerpoints <chest_name> <points>
# Sets the Points cost for your personal chest.
/tc setviewplayer <chest_name> <true/false>
# Sets if others can view your personal chest's contents.
Permissions
Fine-tune who can do what with these permission nodes.
Code (YAML):
# --- Admin Super Permission ---
treasurecoffer.admin.*
# Grants all admin permissions for the plugin.
# --- Specific Admin Permissions ---
treasurecoffer.admin.create
# Allow creating server chests.
treasurecoffer.admin.add
# Allow adding normal rewards to server chests.
treasurecoffer.admin.addlucky
# Allow adding pity rewards to server chests.
treasurecoffer.admin.addcmd
# Allow adding command rewards to server chests.
treasurecoffer.admin.open
# Allow viewing normal rewards in server chests.
treasurecoffer.admin.openlucky
# Allow viewing pity rewards in server chests.
treasurecoffer.admin.set
# Allow setting a player's draw count for a server chest.
treasurecoffer.admin.reload
# Allow reloading the plugin.
treasurecoffer.admin.money
# Allow setting currency type and price for server chests.
treasurecoffer.admin.keyset
# Allow toggling key requirement for server chests.
treasurecoffer.admin.keyadd
# Allow setting key items for server chests.
treasurecoffer.admin.setmax
# Allow setting pity trigger count for server chests.
treasurecoffer.admin.setbox
# Allow setting the appearance of physical server chests.
treasurecoffer.admin.spawnbox
# Allow spawning physical server chests.
treasurecoffer.admin.removebox
# Allow breaking physical server chests (Shift+Right-Click).
treasurecoffer.admin.restoreboxes
# Allow restoring all physical server chests.
treasurecoffer.admin.viewall
# Allow viewing contents of any player chest, even if set to private.
# --- General Player Permissions ---
treasurecoffer.lottery
# Allow players to open the lottery GUI for server chests.
# --- Player Chest Creation Permissions (Example Tiers) ---
# Give players one of these to limit how many personal chests they can create.
treasurecoffer.player.create.1
# Allow creating 1 personal chest.
treasurecoffer.player.create.3
# Allow creating 3 personal chests.
treasurecoffer.player.create.5
# Allow creating 5 personal chests.
treasurecoffer.player.create.10
# Allow creating 10 personal chests.
# --- Player Chest Interaction ---
treasurecoffer.player.openother
# Allow opening other players' personal chests for drawing.
# Note: Creating, adding to, deleting, and setting fees/privacy for *own* personal chests
# are typically granted by default or tied to the .create.<amount> permission.
⚙️ Configuration Highlights ⚙️
TreasureCoffer offers extensive customization through its configuration files:
- config.yml: Main configuration.
- GUI layout (draw button slot, page button slots, border items).
- Enable/disable debug mode.
- Default multi-draw count.
- Global broadcast settings.
- messages.yml / messages_en.yml: Customize all plugin messages, supporting color codes and variables.
- crates/ directory: Each treasure chest (server-defined) gets its own `.yml` file here. This is where you define:
- Display name.
- Opening conditions (cost, key item details).
- Prizes for normal pool (items, commands, probabilities).
- Prizes for pity pool (items, probabilities).
- Pity trigger count.
- Multi-draw count for this specific chest.
- Physical chest appearance, glow, etc.
- crates/player/ directory: Stores data for player-created chests.
- players/ directory: Stores individual player data (draw counts for each chest).
Dependencies
To use all features of TreasureCoffer, you'll need:
- **Bukkit/Spigot/Paper (or compatible fork) 1.20.1:** The plugin is built for this Minecraft version.
- **Vault API:** (Required for economy features using in-game money). The `Vault.jar` is included in the `libs` folder.
- **PlayerPoints API:** (Required for economy features using points). The `PlayerPoints.jar` is included in the `libs` folder.
- **PlaceholderAPI:** (Optional) For using TreasureCoffer placeholders in other plugins.
- `%treasurecoffer_count_<chest_name>%` - Player's draw count for the specified chest.
- `%treasurecoffer_max_<chest_name>%` - Pity trigger count for
❗ Important Notes ❗
- All message texts support Minecraft color codes (`&a`, `&l`, etc.).
- Physical chest blocks use ItemDisplay entities, requiring Minecraft 1.20.1+.
- The multi-draw feature intelligently checks player inventory space and will adjust the number of draws if space is limited, preventing item loss.
- Command rewards can use `%player%` as a placeholder for the player's name. Use underscores (`_`) instead of spaces if your command requires them (e.g., `/broadcast_Player_%player%_won!`).
- The player chest system allows for a dynamic player-driven economy around lotteries.
- Offline player support ensures chest owners receive their earnings even when not logged in.
- bStats integration helps the developer track plugin usage anonymously (can be disabled in bStats config).