/** 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);
    }
  }
  /** Reloads the server, refreshing settings and plugin information */
  @Override
  public void reload() {
    try {
      // Reload relevant configuration
      loadConfig();
      opsList.load();
      whitelist.load();
      nameBans.load();
      ipBans.load();

      // Reset crafting
      craftingManager.resetRecipes();

      // Load plugins
      loadPlugins();
      enablePlugins(PluginLoadOrder.STARTUP);
      enablePlugins(PluginLoadOrder.POSTWORLD);
    } catch (Exception ex) {
      logger.log(Level.SEVERE, "Uncaught error while reloading", ex);
    }
  }
Beispiel #3
0
  /** Reloads the server, refreshing settings and plugin information */
  public void reload() {
    try {
      // Reload relevant configuration
      config.load();
      opsList.load();
      whitelist.load();

      // Reset crafting
      craftingManager.resetRecipes();

      // Load plugins
      loadPlugins();
      DefaultPermissions.registerCorePermissions();
      GlowCommandMap.initGlowPermissions(this);
      commandMap.registerAllPermissions();
      enablePlugins(PluginLoadOrder.STARTUP);
      enablePlugins(PluginLoadOrder.POSTWORLD);
      commandMap.registerServerAliases();
      consoleManager.refreshCommands();
    } catch (Exception ex) {
      logger.log(Level.SEVERE, "Uncaught error while reloading: {0}", ex.getMessage());
      ex.printStackTrace();
    }
  }
 @Override
 public void resetRecipes() {
   craftingManager.resetRecipes();
 }
 @Override
 public void clearRecipes() {
   craftingManager.clearRecipes();
 }
 @Override
 public boolean addRecipe(Recipe recipe) {
   return craftingManager.addRecipe(recipe);
 }
 @Override
 public Iterator<Recipe> recipeIterator() {
   return craftingManager.iterator();
 }
 @Override
 public List<Recipe> getRecipesFor(ItemStack result) {
   return craftingManager.getRecipesFor(result);
 }