本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}