本文整理匯總了Java中org.bukkit.plugin.Plugin.saveResource方法的典型用法代碼示例。如果您正苦於以下問題:Java Plugin.saveResource方法的具體用法?Java Plugin.saveResource怎麽用?Java Plugin.saveResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.plugin.Plugin
的用法示例。
在下文中一共展示了Plugin.saveResource方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: BSBLocale
import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
/**
* Provides localization
* Locale files are .yml and have the filename "bsb_[country and language tag].yml", e.g. bsb_en_GB.yml
* @param plugin
* @throws MalformedURLException
*/
public BSBLocale(Plugin plugin, String localeId) throws MalformedURLException {
this.plugin = plugin;
//this.localeId = localeId;
// Check if the folder exists
File localeDir = new File(plugin.getDataFolder(), LOCALE_FOLDER);
if (!localeDir.exists()) {
localeDir.mkdirs();
}
// Check if this file does not exist
File localeFile = new File(localeDir, localeId);
if (!localeFile.exists()) {
// Does not exist - look in JAR and save if possible
plugin.saveResource(LOCALE_FOLDER + localeId, false);
}
languageTag = localeId.substring(4, localeId.length() - 4).replace('_', '-');
URL[] urls = {localeDir.toURI().toURL()};
ClassLoader loader = new URLClassLoader(urls);
localeObject = Locale.forLanguageTag(languageTag);
rb = ResourceBundle.getBundle("bsb", localeObject, loader, YamlResourceBundle.Control.INSTANCE);
}
示例2: Messaging
import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
public Messaging(Plugin plugin) {
File storageFile = new File(plugin.getDataFolder(), "messages.yml");
if (!storageFile.exists()) {
plugin.saveResource("messages.yml", false);
}
copyDefaults(storageFile);
storage = YamlConfiguration.loadConfiguration(storageFile);
}
示例3: load
import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
public static MessageManager load(Plugin plugin, String fileName) {
File file = new File(plugin.getDataFolder(), fileName);
if (!file.exists())
plugin.saveResource(fileName, false);
return load(file);
}
示例4: ConfigFile
import org.bukkit.plugin.Plugin; //導入方法依賴的package包/類
public ConfigFile(Plugin plugin, String name) {
this.file = new File(plugin.getDataFolder(), name + ".yml");
if (!this.file.getParentFile().exists()) {
this.file.getParentFile().mkdir();
}
if (!this.file.exists()) {
plugin.saveResource(name + ".yml", false);
}
this.configuration = YamlConfiguration.loadConfiguration(file);
}