Inventory-based potions
About
Have you ever wanted to give players on your server potion effects based on their inventory? For example, using war, have you ever wanted to set up different classes with special abilities? If so, this plugin is for you!
Functionality
What this plugin does, is based on the state of a player inventory, it gives them potion effects. For example, you could configure this plugin to give all players wearing full diamond armor that have a stone sword in their hand regeneration 2. For the above example, the configuration might look like this (you can change the 'diamondregen' to whatever you want):
diamondregen: handitem: STONE_SWORD armor: helmet: DIAMOND_HELMET chestplate: DIAMOND_CHESTPLATE leggings: DIAMOND_LEGGINGS boots: DIAMOND_BOOTS effects: - REGENERATION::2
Commands
- /matchinv: Match a player's inventory to a specific potion effect requirement. Usage:
/matchinv <name of potion in config file> [player name]
- /invpotions: Administration of the plugin. Usage can be found by running:
/invpotions help
Permissions
- invpotions.bypass: Bypass getting potion effects from your inventory state (default: nobody)
- invpotions.commands: Same thing as invpotions.administer and invpotions.matchinv (combined command permission)
- invpotions.matchinv: Access to /matchinv (default: op)
- invpotions.administer: Access to /invpotions (default: op)
- invpotions.potion.*: You can get all potions (default: true)
- invpotions.potion.<POTION NAME>: You can get <POTION NAME>
Installation and usage
- Download the latest plugin version (should be a JAR file)
- Put it in your plugins folder, and then reload or restart your server (a reload command in console or stop and start your server)
- A config file should be generated. Edit this config file to suit your needs. Supports item names from here and potion effects from here. For items, it goes:
NAME:DAMAGE
- Reload/restart your server again. Now, if any player's inventory contains all of the items in the config for any given potion, they should receive that potion effect.
Bug Reporting
Found a bug? Please tell me so I can fix it! I appreciate constructive, helpful bug reports on the ticket tracker (please not in the comments). Make sure you post your server log and config so I can look for error messages (and errors).
Download
You can download the latest version with the download link at the top of the page. These downloads are preferred over the CI builds (below).
Development Builds
Builds directly from source changes can be obtained here. Please note that they are untested builds. Development builds of this project can be acquired at the provided continuous integration server. These builds have not been approved by the BukkitDev staff. Use them at your own risk. inventory-based potions CI Server
Source code
Now hosted on github. Stay tuned!
@Jokeless98
That is a good idea, thanks for something other than compatibility fixes that I should code :D
@CommodoreAlpha
I would love to fix it, but I THINK it is a bug in the bukkit API.
Can I give a potion effect to a player if they have a custom named item in their inventory? For example, a diamond chest plate is in a player's inventory and nothing happens unless it is named "Effectgiver" or something.
is there a way to use colered armor
@glen3b
Whoops, sorry. I should learn to read more thoroughly. :|
Will there be a fix for that in the future though?
@CommodoreAlpha
Yeah, known bug :(
Known caveats: Damage valued stuff in 'criteria' does not work properly
@CXA26483
I totally agree with CXA26483, it would make very customizable pvp armor and other fun stuff, like a parkour stick or something.
Apparently, this plugin cannot read damage values. When I specify something like "GHAST_TEAR:2" (for a ghast tear with the damage value of "two") to give out a potion effect like level 1 strength, everyone will get this potion effect no matter what their inventory is.
@frontAw
In 1.6, I have implemented your immediate change idea through a configuration option called forcefulPotionEffect (if true, and inventory not match, remove all effects, and if it does match, add the effects). I have also implemented custom duration (in ticks) for effects (however this number can only be set for the entire potion configuration) through tickDuration.
Add the option to read an item's lore data.
Suddenly, instant set items.
@glen3b
That is good. But I think you need to implement another solution to stop the action effects should check armor in the slot. In this case the effect can be made to infinite, it immediately ends if you remove the armor from slot. Something like that I saw in the plugin Armor Abilities. However, the configuration file must be flexible and give the opportunity to change any of the parameters, as in your case. What do you think?
@frontAw
Yeah, that's because the night vision blinks when it is almost out. I could try making night vision longer to avoid that.
Effect NIGHT_VISION blinking screen, because the time run out.
@CommodoreAlpha
Added all those in the (yet to be approved) 1.4. Thanks for the suggestions!
@Faldonboy
That's a good (and easy to implement) idea. I have added it so that if you match the inventory requirement AND have the permission (or the invpotions.potion.* permission), you get the potion effect.
I agree with everything Commodore said, also; consider adding custom permissions that we can set up it could work using the name of the inventory "group" so using your example above the permission would be like ibp.diamondregen or something along those lines. Would really be helpful for class perks, donation perks, support for plugins like Mob Arena, etc.
Finally! A plugin that lets me make certain items "radioactive" to carry around! :D
By the way, does this support damage values? If you add damage value support, you should make it so that mentioning an item without specifying a damage value will make the plugin accept any damage value, and mentioning a specific damage value will make the plugin accept only that damage value.
For example, say you put in "stick" and "stone_sword"; the plugin will take any type of stick (for servers that abuse damage values like mine), and any time of stone sword. However, if you do "stone_sword:0", the plugin will only take clean stone swords, nothing else.
There should also be an option for what you're currently carrying in your hand. (For example, you can make it so that carrying a gold sword regenerates you, but simply having it in your inventory doesn't.)
By the way, nice plugin. :)
@glen3b
As soon as BukkitDev approves it, you can update to v1.3 and your issue is fixed (tested on your config file).
@TheFifthRider
Thank you for pointing this out, it is a bug (I was checking the user against the default configuration). I will release a new version soon.
@TheFifthRider
Weird. It sounds like a bug on my end, so I will have to test it. I will get back to you.