1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Bandages, Rags and Splints will no longer be consumed if at full health

This commit is contained in:
TheBusyBiscuit 2020-04-26 16:08:01 +02:00
parent 2f188338fc
commit 2b9d109d16
4 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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<ItemUseHandler> {
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);
}

View File

@ -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<ItemUseHandler> {
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);
}

View File

@ -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<ItemUseHandler> {
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);
}