예제 #1
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);
    }
  }
예제 #2
0
  /** 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);
    }
  }
예제 #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();
    }
  }
예제 #4
0
 @Override
 public void resetRecipes() {
   craftingManager.resetRecipes();
 }
예제 #5
0
 @Override
 public void clearRecipes() {
   craftingManager.clearRecipes();
 }
예제 #6
0
 @Override
 public boolean addRecipe(Recipe recipe) {
   return craftingManager.addRecipe(recipe);
 }
예제 #7
0
 @Override
 public Iterator<Recipe> recipeIterator() {
   return craftingManager.iterator();
 }
예제 #8
0
 @Override
 public List<Recipe> getRecipesFor(ItemStack result) {
   return craftingManager.getRecipesFor(result);
 }