Package simpleserver.options

Source Code of simpleserver.options.MinecraftOptions

/*
* Copyright (c) 2010 SimpleServer authors (see CONTRIBUTORS)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package simpleserver.options;

import simpleserver.config.SortedProperties;

public class MinecraftOptions extends AbstractOptions {
  private final Options simpleServerOptions;

  public MinecraftOptions(Options options) {
    super("server.properties");

    simpleServerOptions = options;
  }

  @Override
  public void save() {
    load();
    options.setProperty("server-ip", "127.0.0.1");
    options.setProperty("online-mode", "false");
    options.setProperty("white-list", "false");
    options.setProperty("server-port", simpleServerOptions.get("internalPort"));
    options.setProperty("difficulty", simpleServerOptions.get("difficulty"));
    options.setProperty("max-players", "1024");
    options.setProperty("level-name", simpleServerOptions.get("levelName"));
    options.setProperty("level-type", simpleServerOptions.get("levelType"));
    options.setProperty("spawn-animals", simpleServerOptions.get("spawnAnimals"));
    options.setProperty("spawn-monsters", simpleServerOptions.get("spawnMonsters"));
    options.setProperty("spawn-npcs", simpleServerOptions.get("spawnNPCs"));
    options.setProperty("allow-flight", simpleServerOptions.get("allowFlight"));
    options.setProperty("pvp", simpleServerOptions.get("pvp"));
    options.setProperty("view-distance", simpleServerOptions.get("viewDistance"));
    options.setProperty("allow-nether", simpleServerOptions.get("allowNether"));
    options.setProperty("level-seed", simpleServerOptions.get("worldSeed"));
    options.setProperty("generate-structures",
                        simpleServerOptions.get("generateStructures"));
    options.setProperty("generator-settings", simpleServerOptions.get("generatorSettings"));
    options.setProperty("gamemode", simpleServerOptions.get("gameMode"));
    options.setProperty("spawn-protection", simpleServerOptions.get("spawnProtection"));
    options.setProperty("motd", "");
    options.setProperty("enable-command-block", simpleServerOptions.get("enableCommandBlock"));
    options.setProperty("hardcore", simpleServerOptions.get("hardcore"));
    options.setProperty("max-build-height", simpleServerOptions.get("maxBuildHeight"));
    options.setProperty("snooper-enabled", simpleServerOptions.get("snooperEnabled"));
    options.setProperty("texture-pack", simpleServerOptions.get("texturePack"));
   
    super.save();
  }

  @Override
  protected String getComment() {
    return "Generated by SimpleServer\nDO NOT EDIT THIS FILE!";
  }

  @Override
  protected void loadDefaults() {
    defaultOptions = new SortedProperties();
  }

  @Override
  protected void missingFile() {
    // skip
  }
}
TOP

Related Classes of simpleserver.options.MinecraftOptions

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.