diff --git a/src/main/java/com/songoda/ultimaterepairing/UltimateRepairing.java b/src/main/java/com/songoda/ultimaterepairing/UltimateRepairing.java index 838ec2b..8ecf13c 100644 --- a/src/main/java/com/songoda/ultimaterepairing/UltimateRepairing.java +++ b/src/main/java/com/songoda/ultimaterepairing/UltimateRepairing.java @@ -137,6 +137,7 @@ public final class UltimateRepairing extends JavaPlugin implements Listener { * Save anvils from AnvilManager to Configuration. */ for (UAnvil anvil : anvilManager.getAnvils()) { + if (!anvil.shouldSave())continue; String locationStr = Arconix.pl().getApi().serialize().serializeLocation(anvil.getLocation()); dataFile.getConfig().set("data." + locationStr + ".hologram", anvil.isHologram()); dataFile.getConfig().set("data." + locationStr + ".particles", anvil.isParticles()); diff --git a/src/main/java/com/songoda/ultimaterepairing/anvil/UAnvil.java b/src/main/java/com/songoda/ultimaterepairing/anvil/UAnvil.java index 00b6a98..64ec1da 100644 --- a/src/main/java/com/songoda/ultimaterepairing/anvil/UAnvil.java +++ b/src/main/java/com/songoda/ultimaterepairing/anvil/UAnvil.java @@ -1,7 +1,9 @@ package com.songoda.ultimaterepairing.anvil; import com.songoda.ultimaterepairing.UltimateRepairing; +import com.songoda.ultimaterepairing.utils.Methods; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.World; import java.util.Objects; @@ -85,6 +87,9 @@ public class UAnvil { UAnvil other = (UAnvil) obj; return Objects.equals(location, other.location); } + public boolean shouldSave(){ + return hologram || particles || infinity || permPlaced && Methods.isAnvil(getLocation().getBlock().getType()); + } @Override public String toString() { diff --git a/src/main/java/com/songoda/ultimaterepairing/utils/Methods.java b/src/main/java/com/songoda/ultimaterepairing/utils/Methods.java index e8529ea..12d6bc3 100644 --- a/src/main/java/com/songoda/ultimaterepairing/utils/Methods.java +++ b/src/main/java/com/songoda/ultimaterepairing/utils/Methods.java @@ -123,4 +123,7 @@ public class Methods { public static ItemStack createButton(Material material, String name, ArrayList lore) { return createButton(material, name, lore.toArray(new String[0])); } + public static boolean isAnvil(Material material){ + return material.equals(Material.ANVIL) || material.equals(Material.CHIPPED_ANVIL) || material.equals(Material.DAMAGED_ANVIL); + } }