/** * Retrieve the file that is used to store the update time stamp. * * @return File storing the update time stamp. */ private File getLastUpdateFile() { return new File(plugin.getDataFolder(), LAST_UPDATE_FILE); }
/** * Retrieve a reference to the configuration file. * * @return Configuration file on disk. */ public File getFile() { return new File(plugin.getDataFolder(), "config.yml"); }
/** * Returns the former images directory of a given plugin * @param plugin The plugin. * @return the corresponding 'Image' directory */ static public File getOldImagesDirectory(Plugin plugin) { return new File(plugin.getDataFolder(), OLD_IMAGES_DIRECTORY_NAME); }
private File getLanguageDir() { File dir = new File(plugin.getDataFolder(), "Language"); if (!dir.exists()) { dir.mkdirs(); } return dir; } }
private void createFolder(Plugin plugin) { languageFolder = new File(plugin.getDataFolder(), "Language2"); if (!languageFolder.exists()) { languageFolder.mkdir(); } } }
public File getConfigFile() { // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use // is to abuse the plugin object we already have // plugin.getDataFolder() => base/plugins/PluginA/ // pluginsFolder => base/plugins/ // The base is not necessarily relative to the startup directory. File pluginsFolder = plugin.getDataFolder().getParentFile(); // return => base/plugins/PluginMetrics/config.yml return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml"); }
public File getConfigFile() { // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use // is to abuse the plugin object we already have // plugin.getDataFolder() => base/plugins/PluginA/ // pluginsFolder => base/plugins/ // The base is not necessarily relative to the startup directory. File pluginsFolder = plugin.getDataFolder().getParentFile(); // return => base/plugins/PluginMetrics/config.yml return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml"); }
public static void loadYamlFile(Plugin plugin) { file = new File(plugin.getDataFolder(), "database.yml"); if (!file.exists()) { plugin.getDataFolder().mkdirs(); plugin.saveResource("database.yml", true); } config = YamlConfiguration.loadConfiguration(file); }
public EffectManager(Plugin owningPlugin) { imageCacheFolder = owningPlugin == null ? null : new File(owningPlugin.getDataFolder(), "imagecache"); this.owningPlugin = owningPlugin; Transforms.setEffectManager(this); effects = new HashMap<Effect, BukkitTask>(); disposed = false; disposeOnTermination = false; }
private String replaceUrlString(String input) { //Replace the windows separators ('\') with a '/'; \\ escape regEx --> \\\\ escape java String result = input.replaceAll("\\{DIR\\}", plugin.getDataFolder().getPath().replaceAll("\\\\", "/") + '/'); result = result.replaceAll("\\{NAME\\}", plugin.getDescription().getName().replaceAll("[^\\w-]", "")); return result; } }
private List<String> getLines(CommandSender commandSender, Plugin plugin, String oldFileName) throws IOException { File oldFile = new File(plugin.getDataFolder(), oldFileName); if (!oldFile.exists()) { NametagMessages.FILE_DOESNT_EXIST.send(commandSender, oldFileName); return new ArrayList<>(); } return getLines(oldFile); }
@Override public void initialize(MageController controller, ConfigurationSection configuration) { super.initialize(controller, configuration); Plugin plugin = controller.getPlugin(); String playerFolder = configuration.getString("folder", "players"); String migrateFolder = configuration.getString("migration_folder", "migrated"); playerDataFolder = new File(plugin.getDataFolder(), playerFolder); playerDataFolder.mkdirs(); migratedDataFolder = new File(plugin.getDataFolder(), migrateFolder); }
public static void saveLanguageFile(String name, Plugin plugin) { if (!new File(new File(plugin.getDataFolder(), "Languages"), name + ".yml").exists()) { plugin.saveResource("Languages/" + name + ".yml", true); MsgUtils.Console("&8[" + plugin.getName() + "]&7 生成语言文件&f: " + name + ".yml"); } } }
public static void reloadItemCache() { itemCaches.clear(); itemCachesFinal.clear(); loadItemsFile(getItemCacheFile(), false); finalItemsFolder = new File(Main.getInst().getDataFolder(), "FinalItems"); if (!finalItemsFolder.exists()) { finalItemsFolder.mkdir(); } Arrays.stream(finalItemsFolder.listFiles()).forEach(file -> loadItemsFile(file, true)); TabooLib.debug("Loaded " + (itemCaches.size() + itemCachesFinal.size()) + " items."); // TLocale.Logger.info("ITEM-UTILS.SUCCESS-LOAD-CACHES", String.valueOf(itemCaches.size() + itemCachesFinal.size())); }
public static File getItemCacheFile() { File itemCacheFile = new File(Main.getInst().getDataFolder(), "items.yml"); if (!itemCacheFile.exists()) { Main.getInst().saveResource("items.yml", true); } return itemCacheFile; }
private TLib() { libsFolder = new File(Main.getInst().getDataFolder(), "/libs"); if (!libsFolder.exists()) { libsFolder.mkdirs(); } try { String yamlText = new String(IO.readFully(FileUtils.getResource("lang/internal.yml")), Charset.forName("utf-8")); internalLanguage = new YamlConfiguration(); internalLanguage.loadFromString(yamlText); } catch (IOException | InvalidConfigurationException ignored) { } }
public RegisterTask(Plugin plugin, Player player, String code) { logger = plugin.getLogger(); File dataFolder = new File(plugin.getDataFolder(), "data"); registerFile = new File(dataFolder, "registered.yml"); playerId = player.getUniqueId().toString(); playerName = player.getName(); skinURL = SkinUtils.getOnlineSkinURL(playerName); this.code = code; }
public static EffectLibManager initialize(Plugin plugin) { if (effectManager == null) { effectManager = new EffectManager(plugin); effectManager.setImageCacheFolder(new File(plugin.getDataFolder(), "data/imagemapcache")); } return new EffectLibManager(plugin); }
/** * Loads a file out of the plugins data folder by the given name * @param file * @param locale * @return If any language keys were added * @throws IOException * @throws InvalidConfigurationException */ public boolean loadYamlLanguageFile(String file, Locale locale) throws IOException, InvalidConfigurationException { YamlConfiguration yamlConfiguration = new YamlConfiguration(); yamlConfiguration.load(new File(this.manager.plugin.getDataFolder(), file)); return loadLanguage(yamlConfiguration, locale); }
private void saveTimings(TimedListenerManager manager) { try { File destination = new File(plugin.getDataFolder(), "Timings - " + System.currentTimeMillis() + ".txt"); TimingReportGenerator generator = new TimingReportGenerator(); // Print to a text file generator.saveTo(destination, manager); manager.clear(); } catch (IOException e) { reporter.reportMinimal(plugin, "saveTimings()", e); } }