Newer
Older
void-pack-super-server / work / nms.old.1585251758016 / minecraft / server / DedicatedServerSettings.java
Simon Lindgren on 26 Mar 2020 995 bytes first commit
package net.minecraft.server;

import java.util.function.UnaryOperator;
// CraftBukkit start
import java.io.File;
import joptsimple.OptionSet;
// CraftBukkit end

public class DedicatedServerSettings {

    private final java.nio.file.Path path;
    private DedicatedServerProperties properties;

    // CraftBukkit start
    public DedicatedServerSettings(OptionSet optionset) {
        this.path = ((File) optionset.valueOf("config")).toPath();
        this.properties = DedicatedServerProperties.load(path, optionset);
        // CraftBukkit end
    }

    public DedicatedServerProperties getProperties() {
        return this.properties;
    }

    public void save() {
        this.properties.savePropertiesFile(this.path);
    }

    public DedicatedServerSettings setProperty(UnaryOperator<DedicatedServerProperties> unaryoperator) {
        (this.properties = (DedicatedServerProperties) unaryoperator.apply(this.properties)).savePropertiesFile(this.path);
        return this;
    }
}