From 2b9d109d16b0e362e37a835d4a5ee1de56468a5d Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 26 Apr 2020 16:08:01 +0200 Subject: [PATCH] Bandages, Rags and Splints will no longer be consumed if at full health --- CHANGELOG.md | 3 +++ .../slimefun4/implementation/items/medical/Bandage.java | 6 ++++++ .../slimefun4/implementation/items/medical/Rag.java | 6 ++++++ .../slimefun4/implementation/items/medical/Splint.java | 6 ++++++ 4 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b4e46d21..c38e7199f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ ## Release Candidate 12 (TBD) +#### Changes +* Bandages, Rags and Splints will no longer be consumed if your health is full and you are not on fire + #### Fixes * Fixed #1824 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java index bbde31cf9..042a20a67 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java @@ -3,6 +3,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.medical; import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.Material; +import org.bukkit.attribute.Attribute; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; @@ -26,6 +27,11 @@ public class Bandage extends SimpleSlimefunItem { return e -> { Player p = e.getPlayer(); + // Player is neither burning nor injured + if (p.getFireTicks() <= 0 && p.getHealth() == p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { + return; + } + if (p.getGameMode() != GameMode.CREATIVE) { ItemUtils.consumeItem(e.getItem(), false); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Rag.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Rag.java index 83ae3e77d..938285456 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Rag.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Rag.java @@ -3,6 +3,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.medical; import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.Material; +import org.bukkit.attribute.Attribute; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; @@ -26,6 +27,11 @@ public class Rag extends SimpleSlimefunItem { return e -> { Player p = e.getPlayer(); + // Player is neither burning nor injured + if (p.getFireTicks() <= 0 && p.getHealth() == p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { + return; + } + if (p.getGameMode() != GameMode.CREATIVE) { ItemUtils.consumeItem(e.getItem(), false); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java index a40a5994b..7ee22b4dd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java @@ -2,6 +2,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.medical; import org.bukkit.GameMode; import org.bukkit.Sound; +import org.bukkit.attribute.Attribute; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; @@ -25,6 +26,11 @@ public class Splint extends SimpleSlimefunItem { return e -> { Player p = e.getPlayer(); + // Player is neither burning nor injured + if (p.getFireTicks() <= 0 && p.getHealth() == p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { + return; + } + if (p.getGameMode() != GameMode.CREATIVE) { ItemUtils.consumeItem(e.getItem(), false); }