/** * Save the configuration back to file. */ public void save() { try { config.save(configFile); } catch (IOException e) { GlowServer.logger.log(Level.SEVERE, "Failed to write config: " + configFile, e); } }
/** * Save the configuration back to file. */ public void save() { try { config.save(configFile); } catch (IOException e) { GlowServer.logger.log(Level.SEVERE, "Failed to write config: " + configFile, e); } }
private void save(YamlConfiguration config, File file) { try { config.save(file); } catch (IOException e) { e.printStackTrace(); } }
@Override public void save(File file) { try { if (!file.exists()) { file.getParentFile().mkdirs(); file.createNewFile(); } super.save(file); } catch (IOException e) { e.printStackTrace(); } }
public void save() { try { if (!file.exists()) { file.getParentFile().mkdirs(); file.createNewFile(); } super.save(this.file); } catch (IOException e) { e.printStackTrace(); } }
@Override public void setValue(String path, Object value) { configFile.set(path, value); try { configFile.save(file); } catch (IOException e) { serverCaller.getLogger().severe("Error while saving + " + file.getName() + ". Error: " + e.getMessage()); } }
@Override public void save() { this.preSaveCheck(); try { this.yamlConfiguration.save(this.getStorageFile()); } catch (IOException e) { e.printStackTrace(); } } }
public void save(String header) throws IOException { config.options().header(header).indent(2); try { config.save(configFile.toFile()); } catch (IOException ex) { throw new IOException("Failed to save to " + configFile.toAbsolutePath(), ex); } }
private void saveSignsFile() { if (!getConfig().getBoolean("signs-enabled", true)) { return; } saveQueued = false; try { signs.save(this.signsFile); } catch (IOException e) { getLogger().severe("PlayerVaults has encountered an error trying to save the signs file."); getLogger().severe("Please report this error to drtshock."); e.printStackTrace(); } }
void save(SignStore signStore) { YamlConfiguration yaml = new YamlConfiguration(); List<ArenaSign> values = new ArrayList<>(signStore.findAll()); yaml.set("signs", values); try { File data = new File(plugin.getDataFolder(), "data"); yaml.options().header("MobArena Sign Store\n\nPlease DON'T edit this file by hand!\n"); yaml.save(new File(data, SignStore.FILENAME)); } catch (IOException e) { throw new IllegalStateException(e); } }
private void handleFile(Plugin plugin, CommandSender sender, String fileType) throws IOException { final boolean GROUP = fileType.equals("groups"); File nametagConfigFile = new File(plugin.getDataFolder(), fileType + ".yml"); YamlConfiguration nametagConfig = Utils.getConfig(nametagConfigFile); for (String line : getLines(sender, plugin, fileType + ".txt")) { if (!line.contains("=")) continue; // If the special token is missing, skip. Malformed line. if (GROUP) { handleGroup(nametagConfig, line); } else { handlePlayer(nametagConfig, line); } } nametagConfig.save(nametagConfigFile); }
@Override public void save() throws IOException { Path kitFile = plugin.getDataFolder().toPath().resolve("kits.yml"); if (!Files.exists(kitFile)) { plugin.saveResource("kits.yml", true); } YamlConfiguration config = YamlConfiguration.loadConfiguration(kitFile.toFile()); for (SkyKit kit : kits.values()) { SkyKitEnconder.encodeKit(kit, config); } for (SkyKit kit : disabledKits) { SkyKitEnconder.encodeKit(kit, config); } config.options().header(String.format(KIT_HEADER)).indent(2); config.save(kitFile.toFile()); }
private void createBackup() { YamlConfiguration yaml = new YamlConfiguration(); yaml.set("contents", contents); backup = new File(inventories, player.getUniqueId().toString()); try { yaml.save(backup); } catch (IOException e) { throw new RuntimeException("Failed to store inventory for " + player.getName(), e); } arena.getInventoryManager().put(player, contents); }
public void saveArena(Path path, SkyArenaConfig arenaConfig, String header) { YamlConfiguration newConfig = new YamlConfiguration(); newConfig.options().header(header).indent(2); arenaConfig.serialize(newConfig); try { newConfig.save(path.toFile()); } catch (IOException ex) { plugin.getLogger().log(Level.SEVERE, "Failed to save arena config to file " + path.toAbsolutePath(), ex); } }
/** * Save formula file. */ public void saveFormula() { mcMMO.p.debug("Saving previous XP formula type..."); YamlConfiguration formulasFile = new YamlConfiguration(); formulasFile.set("Previous_Formula", previousFormula.toString()); try { formulasFile.save(formulaFile); } catch (Exception e) { e.printStackTrace(); } } }
public void enable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (isOptOut()) { configuration.set("opt-out", false); configuration.save(configurationFile); } // Enable Task, if it is not running if (task == null) { start(); } } }
public void enable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (isOptOut()) { configuration.set("opt-out", false); configuration.save(configurationFile); } // Enable Task, if it is not running if (task == null) { start(); } } }
public void disable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (!isOptOut()) { configuration.set("opt-out", true); configuration.save(configurationFile); } // Disable Task, if it is running if (task != null) { task.cancel(); task = null; } } }
@Override public void createMySQLFile(File f) { mysql.set("MySQL.IP", "localhost"); mysql.set("MySQL.DB-Name", "YourDatabase"); mysql.set("MySQL.Username", "root"); mysql.set("MySQL.Password", "pw123"); mysql.set("MySQL.Port", 3306); try { mysql.save(f); } catch (IOException e) { e.printStackTrace(); } }
public DiscountModule() { config = YamlConfiguration.loadConfiguration(ChestShop.loadFile("discounts.yml")); config.options().header("This file is for discount management. You are able to do that:\n" + "group1: 75\n" + "That means that the person with ChestShop.discount.group1 permission will pay only 75% of the price. \n" + "For example, if the price is 100 dollars, the player pays only 75 dollars.\n" + "(Only works in buy-only Admin Shops!)"); try { config.save(ChestShop.loadFile("discounts.yml")); } catch (IOException e) { e.printStackTrace(); } groupList = config.getKeys(false); }