PvPToggle - A simple command to toggle PvP per individual player

This is a discussion topic for the Ore project, PvPToggle. View the full project on Ore for downloads and more information.


PvPToggle

PvPToggle is a simple plugin that adds only one functionality: the ability for players to toggle their own PvP status. That means that any player with their own PvP status disabled cannot be attacked or participate in PvP with other players. To control this, one simple command and permission node is added:

/pvp - pvptoggle.toggle - Toggles the PvP status of the player.

To toggle other players’ PvP status, this command can also be run from the server console, a command block, or any server admin that has the associated permission node:

/pvp [<player>] - pvptoggle.others - Toggles the PvP status of the indicated player.

Downloads can be found on Ore.

This is my first plugin, so I am not very familiar with the SpongeAPI, and it’s been a while since I’ve worked with actual Java code. Please feel free to provide any feedback, report issues, suggest changes in the code, as well as recommend new features.

Current Features (On Latest Release)

  • Adds a /pvp command and permission node to toggle PvP status.
  • Allows for other players’ PvP status to be toggled.
  • Notifies players if PvP is disabled or if a player cannot be attacked.
  • Listens for movement to prevent players from toggling PvP in a combat situation.
  • Supports translations!

Translations

The code for PvPToggle now uses the ResourceBundle system, allowing for the implementation of translations. Translators are requested for this project, and would be greatly appreciated. If you are interested in translating the plugin to another language, the file with all translatable messages can be found here. From there, open an issue on my GitHub and I’ll get around to looking at it.

All ore downloads seem to be broken, so I can’t test the plugin :(. (Firefox gives a blank page/nothingness. Internet explorer gives an empty file with no extension named PvPToggle)

There is one important thing to remember, when enabling and disabling pvp. A player should not be able to change its pvp status in combat.
If two players meet, will they only be able to fight if both have pvp on? If not, the battle would be unfair.
Have you added a configuration for default per-player pvp? If a new player joins, will its pvp status be on or off?
If other plugins try to control pvp status, which one will decide the player’s pvp status?

Good luck; improving your plugin into perfection.

Downloads are broken? I’ve been hosting them on Sponge Ore which is pretty unstable, so it figures downloads are broken. If those don’t work, then you can access the downloads here: https://github.com/TehTotalPwnage/PvPToggle/releases

I’ve already taken most of what you’ve suggested into consideration when developing my plugin. To answer your questions:

  • A player has to stand still for a set amount of time to allow PvP to toggle. They cannot toggle status in combat as a result.
  • Both must have PvP on for PvP to be allowed. Otherwise, PvP gets cancelled.
  • I haven’t set default per-player PvP as of right now, but I’ll get working on that right away. The default right now is to have PvP disabled on first server login.
  • Integration with other plugins is a little bit weird. Other plugins’ regions will prevent PvP and override the player’s PvP status, but if a region allows PvP, PvP will still be negated. I will also be working on that in the coming weeks.

Let me know if you have any more questions, and enjoy the download link!