FoodHealz
[1.3.2-R2.0] FoodHealz v5.0
Going to discontinue this and give the source to any good dev who wants it. The source is messy due to all the requests, but you can get the basic idea. I get to delete this plugin soon! Thank you Bukkit for finally adding a PlayerItemConsumeEvent, took your time though. I've seen many plugins try to achieve this, but none did it how I wanted it to be done.
Features:
- Once a player has eaten the food, the regain instant health.
- Sets the hunger bar to be stuck at the level set in the config. (Used if "Keep Hunger" is false, see below)
- Config for using the hunger bar, whilst still directly healing the health.
- Config for a multiplier on hunger and health.
- Config to stop health regeneration from saturation (full hunger bar).
- Config to allow spout users to graphically have their hunger bar disabled and the armour bar put in it's place.
- Config for a repeated Checkup with a configurable delay to stop other plugins breaking this one.
- Drag and drop (With reload).
Permissions:
- foodhealz.heal - If a player has this they will heal from eating.
Change Log:
v5.0
- Removed the need to update the clients hunger bar, as it is now implemented in 1.3.2R-0.2.
v4.0:
- Added a permission that allows people to heal.
v3.0:
- Changed the format of the config.yml!!!! Please check yours is correct!
- Added a repeated Checkup to make sure no other plugins mess this one up.
- Added a config for Checkup, with time in ticks for the delay between repeats.
- Added a Regeneration and Hunger multiplier.
v2.0:
- Added a config.yml
- Added a config for using the hunger bar, whilst still directly healing the health.
- Added a config to stop health regeneration from saturation (full hunger bar).
- Added a config to allow spout users to graphically have their hunger bar disabled and the armour bar put in it's place.
- Added a config to set the default hunger level (Used if "Keep Hunger" is false). Do not set higher than 7!
v1.0:
- Once a player has eaten the food, the regain instant health.
- Disables the hunger bar (Constant set to 7). (As a result players have a constant sprint)
- Drag and drop (With reload).
Todo:
- Any suggestions?
Known bugs:
- The max a player can heal from food is only ever less than or equal to how much hunger they are off a full bar times you heal multiplier. (Guess how the code works yet other devs?)
- Full hunger bared player can not eat. (Client side, nothing I can do)
- If you find any please report them (Include all the usual information).
Disclaimer:
I have not used any ideas or code off other plugins, all the code is made by me and all feature thought up of by me. Please do not copy/steal ideas or code off of me. I can not be held responsible for this plugin causing errors or breaking anything, you are responsible for the safe use of this plugin. Plugin provided for non profitable use only, please contact me if you wish to use this plugin for commercial use. Any questions, please contact me.
Donations:
If you like the plugin, please consider donating to my community (The Derplin Network): [email protected] On PayPal. In the message please say rrama plugins or something indicating that you are donating because of me. This will inspire me to make more plugins.
@clonecommando101
That's all the output it's meant to give. If you mean that you think that when you right click you instantly eat the food, then get another plugin that does that, there are plenty out there. My plugin keeps the whole of the eating animation. The hunger bar is fully disabled and doesn't change, unless in the config you changed it to keep the huger bar as well as heal the players health (This 'keep hunger bar as well' feature of the plugin contains the bugs, which I have listed above). Hope this helped.
Why is it that when I right click I dont eat the food? ;o
EDIT: I found out that the plugin does not work at all on my server, it just says...
18:28:00 [INFO] [FoodHealz] Loading FoodHealz v5.0
Then a bit later...
18:28:03 [INFO] [FoodHealz] Enabling FoodHealz v5.0
But some bits work like the hunger is gone but when I eat it just does not refil my hunger, help :(
Can you make it pvp logged? Like have an option in the config to prevent people from healing in pvp until after 10 seconds or whatever you would have it configured as?
@warboy1982
I have something that sort of does the whole adding a poison potion effect, however the food poisoning is done after the eating event, so the player was still able to gain health. Then I decided to add a delay, but that then caused problems. So I have kinda given up with it all and have been left with messy code. I wouldn't mind giving the source to someone to carry on if they want.
just an idea, but maybe a psuedo solution: how about adding a poison effect with strength relative to the hunger effect one recieves from eating bad food? (assuming there's a hook for "player effect added" or something)
@minepro97
Totally missed the beta build BTW it's 1.3.2-R0.2, I've looked at the change log and see nothing that should break this. Is there a stack trace error from using the plugin.
EDIT: The only thing I see is that they added what me and a couple of other people suggested about updating the client's hunger bar. The plugin does this as well, so in theory it should be updated twice, but that shouldn't cause errors. At least I can remove that peice of code now.
This is THE plugin I have been looking for! Unfortunately it does not work with my server, please update to 1.3.2-R2.0 D:
@warboy1982
Will add that with a config. EDIT: Hunger effect is added after the event, will have to do some more work.
there also seems to be a small bug i've noticed... if you eat rotten flesh or raw chicken (any food that poisons you), you gain health instead of losing it when you get poisoned... any way around this? i'd settle for just flat out NOT adding health from "unhealthy" food.
explanation: on my server, i want health from food to be a perk, hence the desire for a permission, but otherwise i want the food/health system to remain intact. i'm working towards legitimate survival, and being able to spam-eat poison food to recover full health kind of breaks it.
@Darkllama23
Sure. Just going to do it for 'foodhealz.heal' for now. Any other perms just ask.
This is shaping up to be quite the useful plugin, nice work :D I'd also like to request implementation of a permission check.
permissions?? so like... only people with "foolhealz.heal: true" can heal with food.... Great for VIPs
I run a kit pvp server, needed a food control plugin! Works like a charm <3
@xBlueXFoxx
Valid points I shall add it to the public version with a config. Also, I just noticed that I forgot to change one of the hard coded default food values to look at the config, herp derp :p sorry about that. Fix coming soon. Edit: Done.
Why not add them to the public version, common checks would be a great idea and would eliminate any incompatibilities with multiinv, and any other plugins that possibly conflict in the same nature it does. [Edit] Actually just noticed, it appears the hunger level does not save to a users .dat file, it seems to load it then run the hunger external, rather than running typical saves, basically every time I join my server I have 9 hunger remaining, once I eat, for example a cookie it goes back to it's intended level (19 in my case). [Edit 2] Essentials /heal makes the hunger maxed, again another good reason to run common checks to make sure the hunger is accurate.
@xBlueXFoxx
I will not be adding this to the plugin, however I will add this for a customized version specifically for you. How often should the plugin do a check might I ask? Also I shall be adding the incompatibility with multiinv to the bugs, however it will never be fixed. (But timer will fix in your version).
It seems people have a client side issue where when they rejoin their food is below the locked amount, I believe this may be caused by multiinv, a plugin I'm using, but a check every few seconds for all players to ensure the food is at the correct amount nice and a better practice, and most likely not too CPU demanding.
As for the zombie flresh/spider eyes, how would I go about disabling this? I already have a plugin that prevents you from eating them, but this was just a suggested feature, it's always convenient to have less plugins.
Totally forgot about the suggested feature sorry, just started a new school.
@xBlueXFoxx Disable them from healing or being eaten, if disable them from being eaten then find another plugin (or I'll make you one). But if for healing then I'm afraid I can not.
Thanks you for adding my feature request. This plugin will be what makes my server so unique. Whenever i get some more money, i will be sure to donate. Thanks again for the update to 1.3 and hopefully this plugin will stick around for a while. :D
Also, I am in support of adding configurable healing values for eating food. So long as it doesnt make the food instant-eat.
It would be nice to be able to disable zombie flesh/spider eyes.