Esempio n. 1
0
  /** Creates a new server. */
  public GlowServer(ServerConfig config) {
    this.config = config;
    // stuff based on selected config directory
    opsList = new UuidListFile(config.getFile("ops.json"));
    whitelist = new UuidListFile(config.getFile("whitelist.json"));
    nameBans = new GlowBanList(this, BanList.Type.NAME);
    ipBans = new GlowBanList(this, BanList.Type.IP);

    Bukkit.setServer(this);
    loadConfig();
  }
Esempio n. 2
0
  /** Load the server configuration. */
  private void loadConfig() {
    config.load();

    // modifiable values
    spawnRadius = config.getInt(ServerConfig.Key.SPAWN_RADIUS);
    whitelistEnabled = config.getBoolean(ServerConfig.Key.WHITELIST);
    idleTimeout = config.getInt(ServerConfig.Key.PLAYER_IDLE_TIMEOUT);
    craftingManager.initialize();

    // special handling
    warnState = Warning.WarningState.value(config.getString(ServerConfig.Key.WARNING_STATE));
    try {
      defaultGameMode = GameMode.valueOf(config.getString(ServerConfig.Key.GAMEMODE));
    } catch (IllegalArgumentException | NullPointerException e) {
      defaultGameMode = GameMode.SURVIVAL;
    }

    // server icon
    defaultIcon = new GlowServerIcon();
    try {
      File file = config.getFile("server-icon.png");
      if (file.isFile()) {
        defaultIcon = new GlowServerIcon(file);
      }
    } catch (Exception e) {
      logger.log(Level.WARNING, "Failed to load server-icon.png", e);
    }
  }