NicePvP
Description
NicePvP is an opt-in PvP mod. It uses a flagging system similar to that found in MMOs; players can flag themselves, attacking a flagged player will also flag the attacker. You can run custom commands on flag/unflag actions to integrate with other mods your server might be running.
Features
- Flagged opt-in PvP system
- Custom commands on player flag/unflag
- Customizable cooldown
- PvP mode forcing for admins
- Configuration/database reload
- Help 3 support.
Commands and Permissions
| Command | Description | Permission |
|---|---|---|
| /pvp | Flag yourself for PvP | nicepvp.pvp |
| /pvp off | Unflag yourself | nicepvp.pvp |
| /pvp force <player> | Flag a player | nicepvp.force |
| /pvp force <player> off | Unflag a player | nicepvp.force |
| /pvp reload | Reload configuration and database | nicepvp.reload |
The "nicepvp.*" permission will grant all of the above.
Using Custom Commands
The config.yml file contains two settings which are relevant to custom commands: onflag: and onunflag:.
The value you put in is a command you want to run (which will be run as a console command, not as a player):
onflag: weather storm onunflag: weather sunny
The player's name is available to the command as $player:
onflag: give $player sword onunflag: shock $player
You can sequence multiple commands by separating them with the ; character:
onflag: broadcast $player is on the prowl!; thunder onunflag: broadcast $player is a coward.; slay $player
Example Setup
The setup I run on a server, is that we have Creative and Survival users, and we don't want Creative users to be in Creative mode when entering PvP. Additionally, people shouldn't be able to use teleport commands while in PvP, and they should receive a suffix to show that they're in PvP mode when they chat.
The server runs the excellent PermissionsEx mod, and this is what I use to control access to the extra commands.
First, my NicePvP setup:
onflag: gamemode $player 0; pex user $player group add Pvp onunflag: pex user $player group remove Pvp
You can see that when a player gets flagged, it forces their gamemode to 0, which is survival. Then, it adds them to the Pvp group, which I'll explain next. On unflag we simply remove them from the Pvp group.
The PermissionsEx part of this setup is the tricky part. Essentially the Pvp group takes away permissions. First of all, it's important that the Pvp group have a low weight assigned to it, so that PermissionsEx will look at it before any other group.
You can either take away specific permissions using -your.permission, or you can take away all of them with -*, and then grant exceptions. Note that if you use -* then it will need to be the last permission of the Pvp group, otherwise the exceptions won't work.
Here's how this might look (in PermissionEx's permissions.yml):
Pvp: permissions: - modifyworld.* - commandbook.say.me - commandbook.msg - nicepvp.pvp - -* options: weight: '-1' suffix: '[PvP]'
Of course, your set of permissions will look different depending on which plugins you are running. Note that it's important to keep nicepvp.pvp, or they won't be able to exit PvP mode!
If you want to test this out for yourself without installing anything, the server that's running all this is: sausagefest.stuzzhosting.com
License Terms
This project is licensed under the AGPLv3.
What this means in practice, is that you can modify this plugin as much as you want, but you must make available the source code of your modified version to any users of your server.
Source Code
Full source code is up at bitbucket.org/Ycros/nicepvp/.
The version control system used is Mercurial.
Feedback, Bugs and Features
Please use the forum for feedback and discussion, and file bugs or feature requests in the tickets section.