Plugin category: PVP Suggested name: UHCGoldenHeads What I want: an item like the regular golden apple but it gives 4 hearts of regen instead of the normal 2. Ideas for commands: /giveghead <Amount> Perm; GHead.spawn When I'd like it by: Anytime this week
Hi @Meeran there's no possible way to give players more than the default 2 golden hearts provided with the Absorption effect. I have a compromise with it though. I already set up the plugin, but the way it'll work would be: By default the amplifier 1 for Health Boost gives a player 4 more hearts. I could make it so when a player eats a gapple they'll get 4 extra red heart slots that I can either make permanent and give them a regen effect for the same time a regular gapple gives, OR I could make it so the player has the extra 4 hearts for a certain amount of time before it wears off and gets rid of the players hearts. I have the plugin made already so I just need your choice so I can finish it and give you the link to download Also one more thing, would you want it so if a player eats any regular old gapple it'll give them the effect or would you rather I give the item a specific lore so if the player eats the gapple with that lore they'd get the effects and not just regular gapples?
@OTF Catastrophe I would as well, and @Meeran, no reason to be rude about one developer knowing something that another one doesn't.
My apologies, after @Destroyer7712 had messaged me about a possible way of doing it I looked back at my code and realized I had made some errors. It is definitely possible to give a player more than 2 golden hearts from absorption. By using (p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 200, (int) 1.5D)) I was able to give the player exactly 4 hearts of absorption. Again my apologies.
@OTF Catastrophe "(int) 1.5D" This is useless. The double 1.5 will be casted to an int (= deleting everything after the decimal point), making it one. Just use "1".
The reason I used (int) 1.5D was because it equals out to exactly 4 golden hearts like what the OP wanted. 1 as the amplifier equals out to 2 hearts and 2 as the amplifier equals out to 6 golden hearts. So by putting 1.5 you can give the player exactly 4 golden hearts. So for the OP's plugin, the author who made it must have to have used it to make his plugin.
@OTF Catastrophe He is right though, (int)1.5D = 1. Using 0 as an amplifier gives you 2 hearts, where 1 gives you 4, and 2 gives you 6
@OTF Catastrophe Well, the effect one is quite clear. 0 means 2, 1 means 4, 2 means 6 and so on. But to the number things I stated. A double or a float are floating point numbers (a special kind of decimal numbers). An integer (int) can only store whole numbers though. What happens when you cast a decimal number to an int? There are two ways to convert a decimal value to a whole number. Rounding. 1.5 would become 2. In this case you would directly write 2, as it is more clear. To get this behaviour, use the Math#round(double) method. There are also Math#ceil(double) and Math#floor(double), for rounding up and down. Deleting everything after the decimal point. This way 1.99999 would be 1, but 1.0000001 too. This is what happens if you CAST a decimal number to a whole number. This means "1.5" will just be "1" and you can insert that directly. Hope that helped If you have any questions, just ask them!
That's actually really good to know aha. I was working on it previously and every time I put in 1 as the amplifier it'd only give me 2 hearts, then I realized that I totally botched the code I was working with and that's why(It only gave the player 2 hearts from the gapple because I didn't register the events aha.. I know, pretty big fail there.). I was looking over Google and found that people were saying it wasn't possible them I realized the threads where like in 2012 and 2013 therefore not being available at that time. So in any case would decimals EVER be allowed inside of an amplifier? Say 0=2 and 1=4, is there a way to use 1.5 to equal out to say 3 just to get a more specific amount?
@OTF Catastrophe I wouldn't call this a big fail I forget it regularly You just have to find it, before you lose your mind... The javadocs say no. The amplifier is an int. Integers can't be decimal numbers.
Thankfully this time I didn't lose my mind this time aha, thanks for your help regarding my questions as well aha!