MCBackpack

MCBackpack is a robust, database-driven backpack plugin for Minecraft servers (Spigot/Paper). It features secure password protection, support for both MySQL and SQLite, and a unique "Creation Item" workflow that allows administrators to distribute backpack tokens that players initialize themselves.

🌟 Key Features


🚀 Installation

  1. Download the plugin .jar file.
  2. Place it in your server's plugins folder.
  3. Restart the server to generate the configuration file.
  4. (Optional) Edit config.yml to switch from SQLite to MySQL.

Configuration (config.yml)

config.yml YAML
db:
  # Connection type: 'sqlite' (local file) or 'mysql' (external database)
  type: sqlite

  # Settings for local SQLite database
  sqlite:
    # The name of the database file inside the plugin folder
    path: mcbackpack.db
    
  # Settings for external MySQL/MariaDB database
  mysql:
    host: localhost
    port: "3306"
    database: mcbackpack
    user: root
    password: mcbackpack
    ssl: "false"

🛠️ Usage Guide

1. Creating a Backpack

Unlike standard plugins where a command opens a virtual inventory immediately, MCBackpack gives you a physical item.

  1. Get a Creation Item: Run the command to get a "Backpack Creation" head. You can specify the size (multiples of 9) and an optional custom texture.
    • /backpack create 27
    • /backpack create 27 <"head texture base64">
  2. Initialize: Right-click the "Backpack Creation" item while holding it.
    • The item will be registered in the database with a unique UUID.
    • The item name changes to "Backpack (Size: 27)".
    • It is now ready for storage.

2. Protecting Your Backpack

You can lock your backpack so others cannot open it even if they steal the item.

  1. Set a Password: Hold the initialized backpack and run:
    • /backpack setpwd <your_password>
  2. Unlocking: When you (or anyone else) tries to open a locked backpack:
    • The inventory will not open.
    • You will receive a chat prompt: "Please type the password in chat to unlock."
    • Type the password in chat. Your message will not be seen by other players.
    • If correct, the backpack opens.

Commands & Permissions

Command Arguments Permission Description
/bp create <size> [texture] mcbackpack.create Gives you a Backpack Creation item. Size must be 9, 18, 27, 36, 45, or 54.
/bp setpwd <password> mcbackpack.setpwd Sets a password for the backpack currently held in your main hand.
/bp changepwd <old> <new> mcbackpack.changepwd Changes the password. Requires knowing the old password.
/bp deletepwd <password> mcbackpack.deletepwd Removes the password protection from the held backpack.
/bp help None None Displays the help menu.

Note: /bp is an alias for /backpack.

🔒 Security Details

🚫 Restrictions

Recursive Storage: You cannot place a backpack inside another backpack.

The plugin listens to InventoryClickEvent and InventoryDragEvent to block these actions specifically within the backpack GUI.