当前位置: 首页>>代码示例>>Java>>正文


Java JavaPlugin.getDataFolder方法代码示例

本文整理汇总了Java中org.bukkit.plugin.java.JavaPlugin.getDataFolder方法的典型用法代码示例。如果您正苦于以下问题:Java JavaPlugin.getDataFolder方法的具体用法?Java JavaPlugin.getDataFolder怎么用?Java JavaPlugin.getDataFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.plugin.java.JavaPlugin的用法示例。


在下文中一共展示了JavaPlugin.getDataFolder方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ConfigFile

import org.bukkit.plugin.java.JavaPlugin; //导入方法依赖的package包/类
public ConfigFile(JavaPlugin plugin, String name) {
    super(plugin.getDataFolder(), name + ".yml");

    if (!plugin.getDataFolder().exists()) {
        plugin.getDataFolder().mkdirs();
    }

    if (!exists()) {
        try {
            if (plugin.getResource(name + ".yml") != null) {
                plugin.saveResource(name + ".yml", true);
            } else {
                createNewFile();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    config = YamlConfiguration.loadConfiguration(this);
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:22,代码来源:ConfigFile.java

示例2: load

import org.bukkit.plugin.java.JavaPlugin; //导入方法依赖的package包/类
private void load(JavaPlugin plugin) {
    try {
        final FileConfiguration configuration = new YamlConfiguration();
        final File file = new File(plugin.getDataFolder(), "bungeecord_signs.yml");
        if (!file.exists()) {
            if (!file.createNewFile()) {
                Bukkit.getLogger().log(Level.WARNING, "File cannot get created.");
            }
        }
        configuration.load(file);
        if (configuration.getConfigurationSection("signs") != null) {
            final Map<String, Object> data = configuration.getConfigurationSection("signs").getValues(false);
            for (final String s : data.keySet()) {
                this.signs.add(new BungeeCordSignInfo.Container(((ConfigurationSection) data.get(s)).getValues(true)));
            }
        }
    } catch (IOException | InvalidConfigurationException e) {
        Bukkit.getLogger().log(Level.WARNING, "Save load location.", e);
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:21,代码来源:BungeeCordController.java

示例3: ConfigAPI

import org.bukkit.plugin.java.JavaPlugin; //导入方法依赖的package包/类
public ConfigAPI(String name, JavaPlugin plugin) {
 	File file = new File(plugin.getDataFolder(), name);
 	if (!file.exists()) {
try {
	file.getParentFile().mkdirs();
	file.createNewFile();
} catch (IOException e) {
	e.printStackTrace();
}
 	}
     this.config = YamlConfiguration.loadConfiguration(file);
 }
 
开发者ID:thekeenant,项目名称:mczone,代码行数:13,代码来源:ConfigAPI.java

示例4: loadLocalMap

import org.bukkit.plugin.java.JavaPlugin; //导入方法依赖的package包/类
private static void loadLocalMap(JavaPlugin plugin, String codeName,
                                    Map<String, String> targetMap, boolean ignoreInternal, boolean ignoreNormal) {
    if (plugin == null || codeName == null || targetMap == null) throw new IllegalArgumentException();
    if (Boolean.parseBoolean(System.getProperty("nyaautils.i18n.refreshLangFiles", "false"))) return;
    File langFile = new File(plugin.getDataFolder(), codeName + ".yml");
    if (langFile.exists() && langFile.isFile()) {
        YamlConfiguration section = YamlConfiguration.loadConfiguration(langFile);
        loadLanguageSection(targetMap, section, "", ignoreInternal, ignoreNormal);
    }
}
 
开发者ID:NyaaCat,项目名称:NyaaCore,代码行数:11,代码来源:LanguageRepository.java

示例5: load

import org.bukkit.plugin.java.JavaPlugin; //导入方法依赖的package包/类
/**
 * Reset then load per-plugin language map
 * Based on {@link this#getPlugin()} and {@link this#getLanguage()}
 */
public void load() {
    String codeName = getLanguage();
    JavaPlugin plugin = getPlugin();
    if (codeName == null) codeName = DEFAULT_LANGUAGE;
    map.clear();
    // load languages
    loadResourceMap(corePlugin, DEFAULT_LANGUAGE, map, true, false);
    loadLocalMap(corePlugin, DEFAULT_LANGUAGE, map, true, false);
    loadResourceMap(corePlugin, codeName, map, true, false);
    loadLocalMap(corePlugin, codeName, map, true, false);

    loadResourceMap(getPlugin(), DEFAULT_LANGUAGE, map, false, false);
    loadLocalMap(getPlugin(), DEFAULT_LANGUAGE, map, false, false);
    loadResourceMap(getPlugin(), codeName, map, false, false);
    loadLocalMap(getPlugin(), codeName, map, false, false);

    // save (probably) modified language file back to disk
    File localLangFile = new File(plugin.getDataFolder(), codeName + ".yml");
    try {
        YamlConfiguration yaml = new YamlConfiguration();
        for (String key : map.keySet()) {
            yaml.set(key, map.get(key));
        }
        yaml.save(localLangFile);
    } catch (IOException ex) {
        plugin.getLogger().warning("Cannot save language file: " + codeName + ".yml");
    }

    plugin.getLogger().info(getFormatted("internal.info.using_language", codeName));
}
 
开发者ID:NyaaCat,项目名称:NyaaCore,代码行数:35,代码来源:LanguageRepository.java

示例6: Config

import org.bukkit.plugin.java.JavaPlugin; //导入方法依赖的package包/类
/**
 * Creates new PluginFile, with defaults
 * @param plugin - Your plugin
 * @param fileName - Name of the file
 * @param defaultsName - Name of the defaults
 */
public Config(JavaPlugin plugin, String fileName, String defaultsName) {
    this.plugin = plugin;
    this.defaults = defaultsName;
    this.file = new File(plugin.getDataFolder(), fileName);
    reload();
}
 
开发者ID:DiscowZombie,项目名称:UltimateTs,代码行数:13,代码来源:Config.java

示例7: DataFile

import org.bukkit.plugin.java.JavaPlugin; //导入方法依赖的package包/类
public DataFile(JavaPlugin plugin, String name) {
	file = new File(plugin.getDataFolder(), name + ".yml");

	if (!file.getParentFile().exists()) {
		file.getParentFile().mkdir();
	}

	plugin.saveResource(name + ".yml", false);

	configuration = YamlConfiguration.loadConfiguration(file);
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:12,代码来源:DataFile.java

示例8: LobbyPopulator

import org.bukkit.plugin.java.JavaPlugin; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param plugin Parent plugin
 */
public LobbyPopulator(JavaPlugin plugin)
{
    this.logger = plugin.getLogger();
    this.file = new File(plugin.getDataFolder(), "lobby.schematic");
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:11,代码来源:LobbyPopulator.java


注:本文中的org.bukkit.plugin.java.JavaPlugin.getDataFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。