mirror of
https://github.com/songoda/UltimateRepairing.git
synced 2024-11-25 20:16:14 +01:00
Fixed massive datafile issue
Fixes SD-608 Fixed SD-916
This commit is contained in:
parent
a4138c6e50
commit
5388335230
@ -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());
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user