本文整理汇总了Java中org.bukkit.configuration.Configuration.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getInt方法的具体用法?Java Configuration.getInt怎么用?Java Configuration.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.getInt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadConfig
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public void loadConfig() {
Configuration configuration = YamlConfiguration.loadConfiguration(configFile);
ConfigurationSection bungeeSection;
if (configuration.contains("bungee")){
bungeeSection = configuration.getConfigurationSection("bungee");
} else {
getLogger().warning("The section 'bungee' in the configuration is not found, " +
"defaults will be assumed. Delete the config file and restart to have a " +
"clean valid configuration file.");
bungeeSection = configuration.createSection("bungee");
}
boolean serverSocketEnabled = configuration.getBoolean("server-socket", true);
boolean serverPortAuto = configuration.getBoolean("port-automatic", true);
int serverPort = configuration.getInt("port", 3112);
String host = bungeeSection.getString("host");
int port = bungeeSection.getInt("port");
char[] password = bungeeSection.getString("password", "").toCharArray();
int heartbeatSeconds = bungeeSection.getInt("heartbeat-seconds", 30);
int reconnectAttempts = bungeeSection.getInt("reconnect-attempts", 7);
bungeeMasterSpigotConfig = new BungeeMasterSpigotConfig(serverSocketEnabled, serverPortAuto, serverPort, host, port, password, heartbeatSeconds, reconnectAttempts);
}
示例2: checkConfigVersions
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
private void checkConfigVersions(Configuration config, Path dataFolder) {
if (config.getInt("config-version", 0) < TradeConfiguration.CURRENT_CONFIG_VERSION) {
Path configSource = dataFolder.resolve(TradeConfiguration.DESTINATION_FILE_NAME);
Path configTarget = dataFolder.resolve("config_old.yml");
try {
Files.move(configSource, configTarget, StandardCopyOption.REPLACE_EXISTING);
URL configResource = getClass().getResource(TradeConfiguration.CLASSPATH_RESOURCE_NAME);
copyResource(configResource, configSource.toFile());
ConsoleCommandSender sender = Bukkit.getConsoleSender();
sender.sendMessage(ChatColor.RED + "Due to a SimpleTrading update your old configuration has been renamed");
sender.sendMessage(ChatColor.RED + "to config_old.yml and a new one has been generated. Make sure to");
sender.sendMessage(ChatColor.RED + "apply your old changes to the new config!");
} catch (IOException e) {
getLogger().log(Level.SEVERE, "Could not create updated configuration due to an IOException", e);
}
}
}
示例3: 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);
}
示例4: 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);
}
示例5: checkConfigVersions
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
private void checkConfigVersions(Configuration config, Path dataFolder) {
if (config.getInt("config-version") < DefaultConfig.CURRENT_CONFIG_VERSION) {
Path configSource = dataFolder.resolve(ConfigType.DEFAULT_CONFIG.getDestinationFileName());
Path configTarget = dataFolder.resolve("config_old.yml");
try {
Files.move(configSource, configTarget, StandardCopyOption.REPLACE_EXISTING);
URL configResource = getClass().getResource(ConfigType.DEFAULT_CONFIG.getClasspathResourceName());
copyResource(configResource, configSource.toFile());
ConsoleCommandSender sender = Bukkit.getConsoleSender();
sender.sendMessage(ChatColor.RED + "Due to a HeavySpleef update your old configuration has been renamed");
sender.sendMessage(ChatColor.RED + "to config_old.yml and a new one has been generated. Make sure to");
sender.sendMessage(ChatColor.RED + "apply your old changes to the new config");
} catch (IOException e) {
getLogger().log(Level.SEVERE, "Could not create updated configuration due to an IOException", e);
}
}
}
示例6: checkCopyConfig
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
private boolean checkCopyConfig() throws IOException {
File file = new File(getDataFolder(), CONFIG_FILE_NAME);
if (file.exists()) {
Configuration config = YamlConfiguration.loadConfiguration(file);
int version = config.getInt("config-version");
if (version < BungeemodeConfig.CURRENT_CONFIG_VERSION) {
Path dataFolderPath = getDataFolder().toPath();
Files.move(file.toPath(), dataFolderPath.resolve("config_old.yml"), StandardCopyOption.REPLACE_EXISTING);
return true;
}
} else {
return true;
}
return false;
}
示例7: VersionInfo
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public VersionInfo(final Configuration updateConfig, final String path)
{
changelog = updateConfig.getStringList(path + ".changelog");
minBukkit = updateConfig.getInt(path + ".min-bukkit", 0);
maxBukkit = updateConfig.getInt(path + ".max-bukkit", 0);
modules = new HashMap<String, ModuleInfo>();
final String modulesPath = path + ".modules";
for (String module : updateConfig.getKeys(false))
{
modules.put(module, new ModuleInfo(updateConfig, modulesPath + module));
}
}
示例8: inflate
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
@Override
public void inflate(Configuration config, Object... args) {
ConfigurationSection generalSection = config.getConfigurationSection("general");
this.generalSection = new GeneralSection(generalSection);
ConfigurationSection queueSection = config.getConfigurationSection("queues");
this.queueSection = new QueueSection(queueSection);
defaultGameProperties = new EnumMap<GameProperty, Object>(GameProperty.class);
ConfigurationSection propsSection = config.getConfigurationSection("default-game-properties");
Set<String> keys = propsSection.getKeys(false);
for (GameProperty property : GameProperty.values()) {
for (String key : keys) {
GameProperty mappedProperty = mapPropertyString(key);
Object value;
if (mappedProperty != null) {
value = propsSection.get(key, mappedProperty.getDefaultValue());
} else {
value = property.getDefaultValue();
}
defaultGameProperties.put(mappedProperty, value);
}
}
ConfigurationSection localizationSection = config.getConfigurationSection("localization");
this.localization = new Localization(localizationSection);
ConfigurationSection flagSection = config.getConfigurationSection("flags");
this.flagSection = new FlagSection(flagSection);
ConfigurationSection signSection = config.getConfigurationSection("signs");
this.signSection = new SignSection(signSection);
ConfigurationSection spectateSection = config.getConfigurationSection("spectate");
this.spectateSection = new SpectateSection(spectateSection);
ConfigurationSection lobbySection = config.getConfigurationSection("lobby");
this.lobbySection = new LobbySection(lobbySection);
ConfigurationSection updateSection = config.getConfigurationSection("update");
this.updateSection = new UpdateSection(updateSection);
this.configVersion = config.getInt("config-version", CURRENT_CONFIG_VERSION);
}