Skip to content

Commit 017894c

Browse files
committed
add option to remove effects on heal
1 parent 6e92f22 commit 017894c

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/main/java/dev/noah/perplayerkit/util/PlayerUtil.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package dev.noah.perplayerkit.util;
2020

21+
import dev.noah.perplayerkit.PerPlayerKit;
2122
import org.bukkit.ChatColor;
2223
import org.bukkit.entity.Player;
2324
import org.bukkit.inventory.ItemStack;
@@ -50,6 +51,12 @@ public static void healPlayer(Player p) {
5051
p.setHealth(20);
5152
p.setFoodLevel(20);
5253
p.setSaturation(20);
54+
55+
// Remove potion effects if configured to do so
56+
if (PerPlayerKit.getPlugin().getConfig().getBoolean("feature.heal-remove-effects", false)) {
57+
p.getActivePotionEffects().forEach(potionEffect -> p.removePotionEffect(potionEffect.getType()));
58+
}
59+
5360
p.sendMessage(ChatColor.GREEN + "You have been healed!");
5461
}
5562

src/main/resources/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ feature:
149149
set-saturation-on-enderchest-load: false
150150
remove-potion-effects-on-enderchest-load: false
151151

152+
heal-remove-effects: false #makes the /heal command remove potion effects in addition to healing
153+
152154
rekit-on-respawn: true
153155
rekit-on-kill: false
154156

0 commit comments

Comments
 (0)