mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
enable fire res for meteoric iron set
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user