Fixed massive datafile issue

Fixes SD-608
Fixed SD-916
This commit is contained in:
TheCreeperCow 2018-12-20 17:36:36 +01:00
parent a4138c6e50
commit 5388335230
No known key found for this signature in database
GPG Key ID: C06A784885981FBD
3 changed files with 9 additions and 0 deletions

View File

@ -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());

View File

@ -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() {

View File

@ -123,4 +123,7 @@ public class Methods {
public static ItemStack createButton(Material material, String name, ArrayList<String> 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);
}
}