enable fire res for meteoric iron set

This commit is contained in:
okx-code
2025-08-28 02:42:56 +01:00
parent c883f299ef
commit fa3016f649

View File

@@ -9,6 +9,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import vg.civcraft.mc.civmodcore.inventory.CustomItem;
public class NetheriteFireResistanceListener {
@@ -31,6 +32,7 @@ public class NetheriteFireResistanceListener {
public void applyFireResistance() {
for (Player player : Bukkit.getOnlinePlayers()) {
int pieces = 0;
int mpieces = 0;
for (ItemStack armour : player.getInventory().getArmorContents()) {
if (armour == null) {
continue;
@@ -39,8 +41,12 @@ public class NetheriteFireResistanceListener {
switch (type) {
case NETHERITE_BOOTS, NETHERITE_HELMET, NETHERITE_CHESTPLATE, NETHERITE_LEGGINGS -> pieces++;
}
String customItem = CustomItem.getCustomItemKey(armour);
if (customItem != null && customItem.startsWith("meteoric_iron_")) {
mpieces++;
}
}
if (pieces == 4) {
if (pieces == 4 || mpieces == 4) {
PotionEffect currentEffect = player.getPotionEffect(PotionEffectType.FIRE_RESISTANCE);
if (currentEffect == null || currentEffect.getDuration() < 5 * 20 + 19) {
player.addPotionEffect(new PotionEffect(