PvP Toggle Plugin (Paper/Spigot 1.21+) - Full Development Prompt
Create a Minecraft Paper/Spigot plugin for version 1.21+ called EpicPvP.
Overview
The plugin is designed for Survival SMP servers where some players prefer peaceful gameplay while others enjoy PvP combat.
Each player should be able to control their own PvP status independently.
---
Main Features
Personal PvP Toggle System
Every player has their own PvP state.
Commands
/pvp on
- Enables PvP for the player.
- The player can attack other PvP-enabled players.
- Other PvP-enabled players can attack them.
/pvp off
- Disables PvP for the player.
- The player cannot attack other players.
- Other players cannot attack them.
/pvp status
- Displays the player's current PvP status.
- Example:
- PvP Status: Enabled - PvP Status: Disabled
---
PvP Rules
Attack Validation
Before damage is applied:
If Attacker PvP = OFF
- Cancel the attack.
- Send action bar message:
"You must enable PvP first."
If Victim PvP = OFF
- Cancel the attack.
- Send action bar message:
"This player has PvP disabled."
If Both Players PvP = ON
---
Title Notifications
Whenever a player changes their PvP state:
PvP Enabled
Title:
PvP Enabled
Subtitle:
You can now fight other players.
PvP Disabled
Title:
PvP Disabled
Subtitle:
You are now protected from PvP.
Only the player executing the command should see these titles.
---
Action Bar Messages
Configurable action bar messages:
Victim Protected
"This player has PvP disabled."
Attacker Protected
"You must enable PvP first."
PvP Enabled
"Your PvP has been enabled."
PvP Disabled
"Your PvP has been disabled."
---
Data Storage
Store player PvP status permanently.
Requirements:
- Save automatically when a player leaves.
- Load automatically when a player joins.
- Status must persist after server restarts.
- Use UUID-based storage.
Supported storage:
- YAML by default.
- Expandable for future database support.
---
Permissions
epicpvp.use
- Allows use of /pvp commands.
epicpvp.admin
epicpvp.reload
- Allows plugin reload command.
---
Admin Commands
/pvp reload
Reloads all plugin configuration files.
/pvp set <on/off>
Allows admins to force a player's PvP state.
Examples:
- /pvp set Steve on
- /pvp set Steve off
---
Configuration
Fully configurable config.yml.
Options:
- Titles
- Messages
- Action bars
- Sounds
- Permission messages
Example:
default-pvp: false
titles: enabled: title: "&aPvP Enabled" subtitle: "&7You can now fight players."
disabled: title: "&cPvP Disabled" subtitle: "&7You are now protected."
messages: victim-protected: "&cThis player has PvP disabled." attacker-protected: "&cYou must enable PvP first."
---
Sounds
Optional sounds when toggling PvP.
Example:
sounds: enabled: ENTITY_PLAYER_LEVELUP disabled: BLOCK_NOTE_BLOCK_BASS
---
Performance
Requirements:
- Lightweight.
- Async file saving where possible.
- No memory leaks.
- Suitable for large SMP servers.
- Compatible with Paper
Without any error and bug