39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
package eu.mhsl.minecraft.pixelblocks;
|
|
|
|
import org.bukkit.configuration.file.FileConfiguration;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
public record PixelBlockConfiguration(
|
|
int pixelsPerBlock,
|
|
boolean liveUpdate,
|
|
double hitboxOffset,
|
|
boolean onlyBreakableByOwner,
|
|
boolean onlyEditableByOwner
|
|
) {
|
|
public static void setDefaults(FileConfiguration config) {
|
|
config.addDefault(Keys.PixelsPerBlock.key, 16);
|
|
config.addDefault(Keys.LiveUpdate.key, true);
|
|
config.addDefault(Keys.HitboxOffset.key, 0.005);
|
|
config.addDefault(Keys.OnlyBreakableByOwners.key, false);
|
|
config.addDefault(Keys.OnlyEditableByOwners.key, true);
|
|
config.options().copyDefaults(true);
|
|
}
|
|
|
|
public enum Keys {
|
|
PixelsPerBlock("pixelsPerBlock"),
|
|
LiveUpdate("liveUpdate"),
|
|
HitboxOffset("hitboxOffset"),
|
|
OnlyBreakableByOwners("onlyBreakableByOwners"),
|
|
OnlyEditableByOwners("onlyEditableByOwners");
|
|
|
|
private final String key;
|
|
Keys(@NotNull String key) {
|
|
this.key = key;
|
|
}
|
|
|
|
public @NotNull String getKey() {
|
|
return key;
|
|
}
|
|
}
|
|
}
|