# AutoLock
**AutoLock** is a quality-of-life plugin that automates base security. It automatically deploys and authorizes Code Locks onto doors and storage boxes the moment you place them.
It features a non-intrusive GUI for quick toggling and code management, plus "smart inheritance" support for **StackableChests**, allowing vertical storage to share the same code automatically.
## Key Features
- **Instant Security:** Automatically places a Code Lock on deployed Doors and Storage Containers.
- **Auto-Authorization:** The placer is automatically whitelisted on the lock.
- **On-Screen GUI:** A simple overlay allows players to toggle the plugin ON/OFF and set their 4-digit code.
- **Smart Inheritance:** If using **StackableChests**, placing a box on top of another will inherit the code from the box below, ignoring your default setting.
---
## Dependencies
- [Optional] **StackableChests** - If installed, AutoLock detects it to enable vertical code inheritance logic.
---
## Commands
### Chat Commands
- `/showui` - Re-opens the AutoLock GUI if it was closed or hidden.
### Console Commands
- `autolock.toggle` - Toggles the auto-locking feature on/off.
- `autolock.setcode <code_string>` - Sets the 4-digit code used for locking.
---
## Usage Guide
### The Interface
Upon joining the server, a small UI appears on the screen:
1. **Toggle Button:**
- **Green (ON):** AutoLock is active. Any door/box you place will be locked.
- **Red (OFF):** AutoLock is disabled. Items place normally.
2. **Code Input:**
- Type your desired **4-digit code** in the box below the button.
- Press **ENTER** to save the code.
- *Default Code:* `5683` (LOVE)
### Smart Locking Logic
1. **Standard Placement:** When you place a Door or Box, the plugin checks your UI code and applies a lock with that code.
2. **StackableChests Placement:** If you stack a chest on top of another:
- The plugin checks the box *underneath*.
- If the bottom box has a code, the new top box copies that code automatically.
- If the bottom box has no code, the new box uses your UI code.