I've done plenty of searching and I couldn't find any plugin that did this, so... Here we go! Plugin category: FUN(?) Suggested name: HealthDonor What I want: This plugin allows players to donate/transfer (a portion of) their health to another player. It can be especially useful with the natural regen off! Ideas for variations: - Health Penalties (configurable): When Player A donates, let's say, 4 hearts to Player B, B will only recieve 2 hearts (50%). - Certain item required to donate health to someone else (configurable)? Ideas for commands: /hdonor <amount of hearts> <player to donate to> Example: /hdonor 4 Frostbreath This will substract 4 hearts from the player using the command and give it to Frostbreath. Ideas for permissions: hdonor.transfer or something to allow players to use the health transfer commands hdonor.noitem to allow players to transfer health without the item set in the config (if any item was set!) When I'd like it by: Doesn't really matter. Within a month would be awesome though!
Frostbreath What do you mean by: They have to have an item in their inventory to use the command? And when they use the command the item dissapears?
Yes. Let's say they need a Blaze Rod to transfer health or something. The item disappearing could also be an option.
Frostbreath Plugin: https://www.dropbox.com/s/ezctvjx8lvut8wb/HealthDonor.jar Commands: /hdonor OR /healthd Permissions: hdonor.transfer Usage: /hdonor <amount of hearts> <player> Note: In "amount of hearts" 1 is equal to half a heart. Sorry I couldn't do the other features, if you REALLY need them desperately I can try, but I'm not sure if I could do them
Wow... That's so awesome! The item-only-transfer feature is not a top priority, so if you ever get to finish it, it'd be awesome. I'll use it right now and spread the word!
Frostbreath No Problem I will try to add the Item feature Also, tell me if you find any problems, or want anything modified (E.g the messages)
It may actually be a conflict with the UltraHardcore plugin. When I have that plugin, HealthDonor doesn't work properly for some reason... EDIT: It's with dev 36 of the UltraHardcore plugin of Ghowden (Not version 2.4.1!) EDIT 2: Same for MoreHearts.
Sweatyyyy It's so strange... Sometimes it just doesn't give hearts, it just takes away from both donator and reciever. Is it my server? >_<
EDIT: It seems the plugin is not working properly yet. Sweaty and me have done a lot of testing and here's the issues: When donating health: - It substracts the amount of health from the donator and adds it to the reciever (this is what it should do) - It substracts the amount of health from the donator but also substracts the same amount from the reciever (not supposed to happen) - It substracts the amount of health from the donator and adds only a prt of it to the reciever (it shouldn't do so by default) - It substracts the amount of health from the donator and gives nothing to the reciever (wut, no D Anyone else can help us out? Sweaty sent me the code: http://pastebin.com/U270CgEQ Much appreciated!
I'll do this. It seems simple and the concept is fairly straightforward. I will use my own code to make this as well so it will be easier for me to correct any unplanned bugs.
I have spent all day coding this plugin, and I think I got exactly what you want, however I did not add in the penalty. It does support ITEM required and the option to remove the item after each use. I disabled donating to yourself due to a health glitch that allows you to infinitely gain health. It does not allow you to donate more than 19 hearts otherwise you die, also an option to enable the MAX number of hearts someone can donate and also the ability to not donate more than enough hearts to a player, example: target is on 18hearts and you donate 6half hearts, that would make them at 21 hearts, so it will STOP the donation and tell the donor that he is on 18/20 health. However I have not been able to test this thoroughly due to it only being me on the server so no one to donate to. So can you please test this for me . I think the part where it removes the item after each use, might fail. By the way if you have the item required set to true, the person MUST BE HOLDING the item. Download: https://dl.dropboxusercontent.com/u/66037398/HealthDonor.jar
I'm gonna test it right away! You're awesome, thanks so much! Will update this post when I'm done. Also a big thanks to everyone so willing to help this plugin become a reality! EDIT: I've etsted this plugin with a friend and we found the following things working fine: - Donating with the command works like a charm! - Donating over max health is indeed not possible! - You cannot give more than your own health! These were the issues: - Setting an item to be required to donate does not seem to work (unless reloading is the cause). - You cannot heal a player over 9.5 hearts for some reason. - It seems there are no permissions, or at least not to allow regular players to donate (hdonor.transfer or healthdonor.transfer won't work, healthdonor.* does work, but it also enables the suicide ). So far, only Operators can use the command.
GeekyCompz Hey, could you post your code please? I would like to see what I've done wrong and how you did it
GeekyCompz and Frostbreath The issue with not being able to heal a player over 9.5 hearts is because of this: Code:java if (targetHealth + health >= 20.0D) {sender.sendMessage("§4[§cHealthDonor§4] §7The player '" + targetplayer.getName() + "' cannot obtain that much health. §2(Health = " + targetHealth + "/20.0).");return false;} You made it so a person cannot be healed to 20 Hearts. At least that is what I think the issue is. I think it should be Code:java if (targetHealth + health > 20.0D) { }
Slokh I will change it so it so that it will be that. Frostbreath The required item works for me... If I am not HOLDING the item it will alert me to hold the ID, (reload must happen, if config changed whilst open). Also the permissions were different sorry. "healthdonor.donate" and "healthdonor.*", I spend some time from now adding the bypass permission for the item and also fixing the problem about getting someone to 20/20 health. Sweatyyyy I started my code nice and neat, but then I ran into errors with the positioning so I just cut and paste the code into the right spots. Therefore the code may be VERY MESSY. (lol) http://pastebin.com/6RghCC1q (this is before the fixes) ~Geeky Now I haven't been able to test the REMOVE-ITEM after donation, but I think I solved it all. Heres the file and permissions Also the command has aliases: /healthd, /hdonor, /healthdonor. PERMISSIONS: - healthdonor.* = ALL commands below - healthdonor.donate = /healthdonor <1-19> <player> - healhtdonor.bypassitem = No need for the required item if set to TRUE - healthdonor.bypassremoveitem = Doesn't remove the item after each use FILE: Dropbox Download: https://dl.dropboxusercontent.com/u/66037398/HealthDonor 1.1.jar EDIT by Moderator: merged posts, please use the edit button instead of double posting.
GeekyCompz Permissions work, item works and you can now heal fully to 20 health! There is a small error when the plugin attempts to remove an item after command usage though: Spoiler (Move your mouse to the spoiler area to reveal the content) Show Spoiler Hide Spoiler 2013-09-08 10:41:45 [SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing command 'hdonor' in plugin HealthDonor v1.0 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:191) at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:523) at net.minecraft.server.v1_6_R2.PlayerConnection.handleCommand(PlayerConnection.java:962) at net.minecraft.server.v1_6_R2.PlayerConnection.chat(PlayerConnection.java:880) at net.minecraft.server.v1_6_R2.PlayerConnection.a(PlayerConnection.java:837) at net.minecraft.server.v1_6_R2.Packet3Chat.handle(SourceFile:49) at net.minecraft.server.v1_6_R2.NetworkManager.b(NetworkManager.java:296) at net.minecraft.server.v1_6_R2.PlayerConnection.e(PlayerConnection.java:116) at net.minecraft.server.v1_6_R2.ServerConnection.b(SourceFile:37) at net.minecraft.server.v1_6_R2.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:590) at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:226) at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486) at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419) at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582) Caused by: java.lang.ArrayIndexOutOfBoundsException I also announced this plugin yesterday to the UHC Reddit community, and they were excited and immediatly started to give some suggestions. I don't mind if you take your time with them or don't want to do it, but here they are nonetheless: - Compatibility with MoreHearts (so healing over 20 health is possible)? - "Perhaps you could have an option to set a certain distance the receiver needs to be to transfer hearts? Example: A wants to heal B but B needs to be within 32 blocks from A for A to be able to transfer hearts to B."(Configurable?) - "For ease of transfer, I would recommend some kind of right-click action to trigger the transfer, rather than having to type out a command. Hold down RMB to slowly transfer health etc." (Best to do with an item in hand only and optional?)
Frostbreath Were you holding only one of the item when you went to share the health? Because my coding basically removes 1 item from the players HAND. I'll change it up so that it checks if the player has more than 1 first, then -1. Otherwise just remove the entire item from the players hand. Oh and sure, I can attempt to get the distance suggestion in. However the right-click action is possible but would require some way of how many hearts to donate, maybe half a heart every right-click with the item. (would make that configurable, but first I will fix the removing item problem first). ~Geeky
GeekyCompz Yes, I was holden the item and it gave the error when attempting to use the command. Thanks for trying to add some of the suggestions. Did you also see the MoreHearts compatibility? I'm not sure if it was very clear in my message that it was another suggestion.
Frostbreath Yes, I saw the more hearts suggestion, however this would be very strange to add in the plugin. I think just eating the golden apple, will be good enough for the extra health. Now I did add some extra components and fixed stuff. - Solved removing item after each use. (1) - Added a PING SOUND to both donor and target on the donation. - Added the option to enable/disable the range between a donation. - And also added a configurable maximum range between donations. Now the right-click action would take longer to donate the health you want to donate. (is possible though), I probably won't add this feature in, sorry. I'll send you the next update of the plugin, as soon as I test the range between donations work. ~ Geeky
GeekyCompz Cheers! I don't really mind the right-click feature, I'm already happy the max distance feature is in. Thanks!
@Forstbreath I have released a page for the plugin, and I am still accepting more suggestions. http://dev.bukkit.org/bukkit-plugins/healthdonor/
GeekyCompz Very awesome! I'll download it as soon as the link becomes available there. I think this topic can be locked now, so if any moderator sees this message: go ahead!