Описание
# HealthSync
 --(1.21.11)-green.svg)
## Version 0.3 - World Sync Control
* **Added World Restriction System**: Control which worlds health-sync is active in.
* **Added Sync Modes**: Choose between `PAUSE` and `KICK` when players enter restricted worlds.
* **Added Anti-Heal Logic**: Automatically forces player stats to match the group upon returning from a safe world.
* **Bug Fixes**: Improved listener reliability across multiple world environments.
**HealthSync** is a comprehensive Minecraft plugin that transforms cooperative gameplay by allowing players to link their vital stats—Health, Hunger, and Effects—into a unified "Group" system. Damage taken by one is shared by all. If one eats, everyone is fed. Survival becomes a true team effort.
## Key Features
### Dynamic Group Linking
* **Squad-Based System**: Players form groups with an Owner and Members.
* **Invitation Logic**: No more force-linking. Send invites via `/linkhealth ` which expire automatically after 60 seconds if ignored.
* **Group Management**: Use the interactive GUI (`/healthsync`) to manage members, kick players, or leave groups.
### Smart Synchronization
* **Shared Health**: All damage is synchronized instantly. If a member takes damage, everyone feels it.
* **Shared Hunger & Saturation**: Keep your squad fed! Food eaten by one player contributes to the hunger bars of all linked members.
* **Effect Sharing**: Potions, Golden Apples, and negative effects are shared across the link.
* **Expanded Command Suite**: The `/linkhealth` command has been overhauled with new subcommands:
* `/linkhealth create [name]`: Create a new group (optional name).
* `/linkhealth invite `: Send an invitation to a player.
* `/linkhealth accept`: Accept a pending invitation.
* `/linkhealth deny`: Deny a pending invitation.
* `/linkhealth leave`: Leave your current group.
* `/linkhealth delete`: Disband your group (Owner only).
* **Experience Sync**: (Optional) Share XP levels and progress for shared enchanting sessions.
### World Restriction Sync
* **Per-World Control**: Use `enabled-worlds` and `disabled-worlds` to white/blacklist sync areas.
* **PAUSE Mode**: Syncing is frozen for players in safe worlds. Upon returning to a survival world, their stats "snap" back to match the group immediately.
* **KICK Mode**: Players are automatically removed from their group if they enter a restricted world.
* **Anti-Heal Protection**: Prevents players from healing in safe worlds and bringing that health back into the group link.
### Anti-Exploit "Smart Respawn"
* **No Free Heals**: Mechanics prevent the "Death/Respawn Loop" exploit.
* If a linked player dies and respawns, they do **not** come back with full health if their team is injured.
* They respawn with the **exact health and hunger** of their surviving teammates, ensuring the pressure of the fight is maintained.
* Standard respawn logic applies only if the entire team wipes.
### Robust & Stable
* **Recursion Protection**: Advanced guarding prevents infinite damage loops or server crashes from rapid sync events.
* **Disconnect Handling**:
* If a group owner disconnects, ownership is automatically transferred to the next active member.
* If a group becomes empty, it automatically disbands to save resources.
## Installation
1. Download the `HealthSync.jar` file.
2. Place it in your server's `plugins` folder.
3. Restart your server.
4. Configure `config.yml` to your liking (optional).
## Configuration
The `config.yml` allows deep customization of the sync mechanics:
```yaml
settings:
# Enable or disable hunger synchronization
link-hunger: true
# Maximum players allowed in a single group
max-linked-players: 5
# Enable GUI for management
gui:
enabled: true
update-interval: 20
effect-sync:
# Enable sharing of potion effects
enabled: true
# NEW: World Restriction Settings
worlds:
# PAUSE - Freeze sync but stay in group. KICK - Remove from group on world change.
restriction-mode: "PAUSE"
enabled-worlds:
- world
- world_nether
- world_the_end
disabled-worlds:
- spawn_world
```
## Commands & Permissions
### Player Commands
| Command | Alias | Description | Permission |
| :--- | :--- | :--- | :--- |
| `/healthsync` | `/hs` | Opens the Link Management GUI. | `healthsync.gui` |
| `/linkhealth ` | | Send a group invite to a player. | `healthsync.link` |
| `/unlinkhealth [player]` | | Unlink yourself or kick a member (if owner). | `healthsync.unlink` |
| `/listlinked` | | View your current group members and stats. | `healthsync.list` |
### Admin Commands
| Command | Description | Permission |
| :--- | :--- | :--- |
| `/healthsync reload` | Reloads the configuration file. | `healthsync.admin.reload` |
| `/clearlinks` | Forcefully dissolves ALL groups on the server. | `healthsync.admin.clear` |
### Permissions Nodes
* `healthsync.*` - Grant all permissions (Default: OP)
* `healthsync.admin.bypass` - Prevents the player from being invited or linked.
## 🎮 Enhance Your Experience
Want to take the challenge to the next level? Pair **Health-Sync** with **[InventorySync](https://modrinth.com/plugin/inventory-syncs)**!
* ** Sync Inventory**: Share items, tools, and resources instantly in real-time.
* ** Sync Armor**: Equip one, equip all! Armor updates for everyone.
* ** Sync XP**: Level up together and share the experience progress.
**Combining both plugins creates the ultimate cooperative survival challenge!**
## Support
Found a bug or have a suggestion? Join our support community [Discord Server](https://discord.gg/krcaTEK5VD).