當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration.getString方法代碼示例

本文整理匯總了Java中org.bukkit.configuration.Configuration.getString方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getString方法的具體用法?Java Configuration.getString怎麽用?Java Configuration.getString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.configuration.Configuration的用法示例。


在下文中一共展示了Configuration.getString方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ModConfig

import org.bukkit.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Initialize mod config based on the configuration file
 *
 * @param config
 */
public ModConfig(Configuration config) {
    m_isInitialized = false;
    if (config == null) {
        m_blocks = null;
        m_mobs = null;
        m_modIdRegex = null;
        m_textureRes = 0;
        m_versionRegex = null;
        return;
    }

    m_name = config.getString("DisplayName", null);
    m_blocks = config.getConfigurationSection("Blocks");
    m_mobs = config.getConfigurationSection("Mobs");
    m_modIdRegex = config.getString("ModId", null);
    m_alternativeId = config.getString("ModIdAlternative", null);
    m_versionRegex = config.getString("Version", null);
    m_textureRes = config.getInt("TextureRes", 0);
}
 
開發者ID:SBPrime,項目名稱:MCPainter,代碼行數:25,代碼來源:ModConfig.java

示例2: load

import org.bukkit.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Load palette from file
 *
 * @param file
 * @return
 */
public static Palette load(File file) {
    Configuration config = YamlConfiguration.loadConfiguration(file);

    String name = config.getString("name", null);
    BlockEntry[] blockEntries = parseBlocksSection(config);
    
    if (name == null) {
        MCPainterMain.log("* " + file.getName() + "...invalid file format, no name palette defined.");
        return null;
    }
    
    name = name.toLowerCase();
    if (blockEntries == null || blockEntries.length < 2) {
        MCPainterMain.log("* " + name + "...invalid file format, minimum number of blocks in palette is 2.");
        return null;
    }
    
    MCPainterMain.log("* " + name + "..." + blockEntries.length + " blocks defined.");
    return new Palette(name, blockEntries);
}
 
開發者ID:SBPrime,項目名稱:MCPainter,代碼行數:27,代碼來源:Palette.java

示例3: load

import org.bukkit.configuration.Configuration; //導入方法依賴的package包/類
public void load() {
    BukkitScheduler scheduler = plugin.getServer().getScheduler();
    if (task != null) {
        task.cancel();
        task = null;
    }
    ConfigurationSection arenaConfiguration = loadDataFile("arenas");
    load(arenaConfiguration);

    ConfigurationSection arenaData = loadDataFile("data");
    loadData(arenaData);

    plugin.reloadConfig();
    Configuration config = plugin.getConfig();
    pathTemplate = config.getString("path_template", pathTemplate);
    tickInterval = config.getInt("tick_interval", 40);

    task = scheduler.runTaskTimer(plugin, this, 1, tickInterval);
}
 
開發者ID:elBukkit,項目名稱:MagicArenas,代碼行數:20,代碼來源:ArenaController.java

示例4: load

import org.bukkit.configuration.Configuration; //導入方法依賴的package包/類
public void load(Configuration config) throws InvalidConfigurationException {
    this.enabled = config.getBoolean("player-list.enabled", true);
    this.playersSeeObservers = config.getBoolean("player-list.players-see-observers", true);
    this.datacenter = config.getString("player-list.datacenter", null);
    this.server = config.getString("player-list.server", null);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:7,代碼來源:Config.java

示例5: onEnable

import org.bukkit.configuration.Configuration; //導入方法依賴的package包/類
@Override
public void onEnable() {
    File fileConf = new File(this.getDataFolder(), "config.yml");
    if (!fileConf.exists()) {
        this.saveDefaultConfig();
    }

    Configuration rawConfig = this.getConfig();
    this.config = new LongTimeNoSeeConfig();
    this.config.joinMessage = rawConfig.getString("join.message", null);
    this.config.joinBroadcast = rawConfig.getString("join.broadcast", null);
    this.config.joinOverride = rawConfig.getBoolean("join.override", true);
    this.config.firstJoinMessage = rawConfig.getString("firstjoin.message", null);
    this.config.firstJoinBroadcast = rawConfig.getString("firstjoin.broadcast", null);
    this.config.joinOverride = rawConfig.getBoolean("firstjoin.override", true);
    this.config.quitBroadcast = rawConfig.getString("quit.broadcast", null);
    this.config.quitOverride = rawConfig.getBoolean("quit.override", true);
    this.config.commandMessage = rawConfig.getString("command.message", null);
    this.config.dateFormat = rawConfig.getString("date.format", "yyyy/MM/dd H:mm");
    this.config.dateNow = rawConfig.getString("date.now", "now");
    this.config.dateNA = rawConfig.getString("date.na", "N/A");
    this.config.periodFormat = rawConfig.getString("period.format", "Ddays Hhours Mminutes Sseconds");
    this.config.periodNow = rawConfig.getString("period.now", "now");
    this.config.periodNA = rawConfig.getString("period.na", "N/A");

    if (this.config.commandMessage == null) {
        this.getLogger().log(Level.WARNING, "A command message is not defined.");
        return;
    }

    Path dataFolder = this.getDataFolder().toPath().resolve("data");
    this.manager = new TimingManager(this::getLogger, dataFolder, this.config);
    try {
        Files.createDirectories(dataFolder);
    } catch (IOException ex) {
        this.getLogger().log(Level.WARNING, "Failed to create data directory.", ex);
        return;
    }

    if (rawConfig.getBoolean("import", true)) {
        this.getLogger().info("Importing from bukkit cache...");
        rawConfig.set("import", false);
        this.saveConfig();
        for (OfflinePlayer op : this.getServer().getOfflinePlayers()) {
            if (this.manager.hasRecord(op.getUniqueId())) {
                continue;
            }
            TimingRecord record = new TimingRecord();
            record.setFirst(op.getFirstPlayed());
            record.setLast(op.getLastPlayed());
            this.manager.saveRecord(op.getUniqueId(), record);
        }
    }

    this.manager.cache(this.getServer().getOnlinePlayers().stream().map(Player::getUniqueId).collect(Collectors.toList()));

    this.getServer().getPluginManager().registerEvents(this, this);
}
 
開發者ID:4oi,項目名稱:long-time-no-see,代碼行數:59,代碼來源:LongTimeNoSeeBukkit.java

示例6: ModuleInfo

import org.bukkit.configuration.Configuration; //導入方法依賴的package包/類
public ModuleInfo(final Configuration updateConfig, final String path)
{
	url = updateConfig.getString(path + ".url", null);
	version = updateConfig.getString(path + ".version", null);
	hash = updateConfig.getString(path + ".hash", null);
}
 
開發者ID:Curtis3321,項目名稱:Essentials,代碼行數:7,代碼來源:ModuleInfo.java


注:本文中的org.bukkit.configuration.Configuration.getString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。