本文整理了Java中org.bukkit.configuration.file.YamlConfiguration.getBoolean()
方法的一些代码示例,展示了YamlConfiguration.getBoolean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.getBoolean()
方法的具体详情如下:
包路径:org.bukkit.configuration.file.YamlConfiguration
类名称:YamlConfiguration
方法名:getBoolean
暂无
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public boolean getBoolean(Key key) {
if (parameters.containsKey(key)) {
return (Boolean) parameters.get(key);
}
boolean bool = config.getBoolean(key.path, (Boolean) key.def);
parameters.put(key, bool);
return bool;
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public boolean getBoolean(Key key) {
if (cache.containsKey(key)) {
return (Boolean) cache.get(key);
}
boolean bool = config.getBoolean(key.path, (Boolean) key.def);
cache.put(key, bool);
return bool;
}
代码示例来源:origin: com.greatmancode/tools
@Override
public boolean getBoolean(String path) {
return configFile.getBoolean(path);
}
代码示例来源:origin: DevLeoko/AdvancedBan
@Override
public Boolean getBoolean(Object file, String path) {
return ((YamlConfiguration) file).getBoolean(path);
}
代码示例来源:origin: DevLeoko/AdvancedBan
@Override
public boolean getBoolean(Object file, String path, boolean def) {
return ((YamlConfiguration) file).getBoolean(path, def);
}
代码示例来源:origin: dzikoysk/WildSkript
private static void loadConfig() {
loadDefaultFiles(new String[]{ "config.yml" });
YamlConfiguration yaml = YamlConfiguration.loadConfiguration(CFG);
doc = yaml.getBoolean("doc");
mcstats = yaml.getBoolean("mcstats-enable");
debug = yaml.getBoolean("debug");
WildSkript.debug = debug;
}
代码示例来源:origin: FunnyGuilds/FunnyGuilds
public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException | InvalidConfigurationException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
}
return configuration.getBoolean("opt-out", false);
}
}
代码示例来源:origin: mcMMO-Dev/mcMMO
public void load() {
InputStreamReader reader = mcMMO.p.getResourceAsReader(fileName);
if (reader != null) {
config = YamlConfiguration.loadConfiguration(reader);
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
conversionRate = config.getInt("Options.ConversionRate", 1);
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);
uuidConvertAmount = config.getInt("Options.UUIDConvertAmount", 5);
mojangRateLimit = config.getInt("Options.MojangRateLimit", 50000);
mojangLimitPeriod = config.getLong("Options.MojangLimitPeriod", 600000);
}
}
代码示例来源:origin: gvlfm78/BukkitOldCombatMechanics
/**
* Has the server owner denied plugin metrics?
*
* @return true if metrics should be opted out of it
*/
public boolean isOptOut(){
synchronized(optOutLock){
try{
// Reload the metrics file
configuration.load(getConfigFile());
} catch(IOException | InvalidConfigurationException ex){
if(debug){
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
}
return configuration.getBoolean("opt-out", false);
}
}
代码示例来源:origin: zDevelopers/ImageOnMap
/**
* Has the server owner denied plugin metrics?
*
* @return true if metrics should be opted out of it
*/
public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException | InvalidConfigurationException ex) {
if (debug) {
PluginLogger.info("[Metrics] " + ex.getMessage());
}
return true;
}
return configuration.getBoolean("opt-out", false);
}
}
代码示例来源:origin: SkyWars/SkyWars
public boolean getSetBoolean(String path, boolean defaultBoolean) throws InvalidConfigurationException {
if (config.isBoolean(path)) {
return config.getBoolean(path);
} else if (config.contains(path)) {
throw new InvalidConfigurationException("Object " + config.get(path) + " found under " + path + " in file " + configFile.toAbsolutePath() + " is not a boolean (true/false)");
} else {
logger.log(Level.INFO, "Setting {0} to {1} in file {2}", new Object[]{path, defaultBoolean, configFile});
config.set(path, defaultBoolean);
return defaultBoolean;
}
}
代码示例来源:origin: dzikoysk/WildSkript
public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
} catch (InvalidConfigurationException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
}
return configuration.getBoolean("opt-out", false);
}
}
代码示例来源:origin: BentoBoxWorld/BentoBox
private AddonDescription asDescription(YamlConfiguration data) {
AddonDescription.Builder builder = new AddonDescription.Builder(data.getString("main"), data.getString("name"), data.getString("version"))
.authors(data.getString("authors"))
.metrics(data.getBoolean("metrics"));
if (data.getString("depend") != null) {
builder.dependencies(Arrays.asList(data.getString("depend").split("\\s*,\\s*")));
}
if (data.getString("softdepend") != null) {
builder.softDependencies(Arrays.asList(data.getString("softdepend").split("\\s*,\\s*")));
}
return builder.build();
}
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
public McStatsMetrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.loadConfiguration(configurationFile);
// add some defaults
configuration.addDefault("opt-out", false);
configuration.addDefault("guid", UUID.randomUUID().toString());
configuration.addDefault("debug", false);
// Do we need to create the file?
if (configuration.get("guid", null) == null) {
configuration.options().header("http://mcstats.org").copyDefaults(true);
configuration.save(configurationFile);
}
// Load the guid then
guid = configuration.getString("guid");
debug = configuration.getBoolean("debug", false);
}
代码示例来源:origin: BedwarsRel/BedwarsRel
public McStatsMetrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.loadConfiguration(configurationFile);
// add some defaults
configuration.addDefault("opt-out", false);
configuration.addDefault("guid", UUID.randomUUID().toString());
configuration.addDefault("debug", false);
// Do we need to create the file?
if (configuration.get("guid", null) == null) {
configuration.options().header("http://mcstats.org").copyDefaults(true);
configuration.save(configurationFile);
}
// Load the guid then
guid = configuration.getString("guid");
debug = configuration.getBoolean("debug", false);
}
代码示例来源:origin: gvlfm78/BukkitOldCombatMechanics
public MetricsLite(Plugin plugin) throws IOException{
if(plugin == null){
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.loadConfiguration(configurationFile);
// add some defaults
configuration.addDefault("opt-out", false);
configuration.addDefault("guid", UUID.randomUUID().toString());
configuration.addDefault("debug", false);
// Do we need to create the file?
if(configuration.get("guid", null) == null){
configuration.options().header("http://mcstats.org").copyDefaults(true);
configuration.save(configurationFile);
}
// Load the guid then
guid = configuration.getString("guid");
debug = configuration.getBoolean("debug", false);
}
代码示例来源:origin: Hidendra/Plugin-Metrics
public MetricsLite(Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.loadConfiguration(configurationFile);
// add some defaults
configuration.addDefault("opt-out", false);
configuration.addDefault("guid", UUID.randomUUID().toString());
configuration.addDefault("debug", false);
// Do we need to create the file?
if (configuration.get("guid", null) == null) {
configuration.options().header("http://mcstats.org").copyDefaults(true);
configuration.save(configurationFile);
}
// Load the guid then
guid = configuration.getString("guid");
debug = configuration.getBoolean("debug", false);
}
代码示例来源:origin: Hidendra/Plugin-Metrics
public Metrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.loadConfiguration(configurationFile);
// add some defaults
configuration.addDefault("opt-out", false);
configuration.addDefault("guid", UUID.randomUUID().toString());
configuration.addDefault("debug", false);
// Do we need to create the file?
if (configuration.get("guid", null) == null) {
configuration.options().header("http://mcstats.org").copyDefaults(true);
configuration.save(configurationFile);
}
// Load the guid then
guid = configuration.getString("guid");
debug = configuration.getBoolean("debug", false);
}
代码示例来源:origin: dzikoysk/WildSkript
public Metrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.loadConfiguration(configurationFile);
// add some defaults
configuration.addDefault("opt-out", false);
configuration.addDefault("guid", UUID.randomUUID().toString());
configuration.addDefault("debug", false);
// Do we need to create the file?
if (configuration.get("guid", null) == null) {
configuration.options().header("http://mcstats.org").copyDefaults(true);
configuration.save(configurationFile);
}
// Load the guid then
guid = configuration.getString("guid");
debug = configuration.getBoolean("debug", false);
}
代码示例来源:origin: lucko/helper
@Override
protected void enable() {
SqlProvider sqlProvider = getService(SqlProvider.class);
Sql sql;
// load sql instance
YamlConfiguration config = loadConfig("config.yml");
if (config.getBoolean("use-global-credentials", true)) {
sql = sqlProvider.getSql();
} else {
sql = sqlProvider.getSql(DatabaseCredentials.fromConfig(config));
}
// init the table
String tableName = config.getString("table-name", "helper_profiles");
int preloadAmount = config.getInt("preload-amount", 2000);
// provide the ProfileRepository service
provideService(ProfileRepository.class, bindModule(new HelperProfileRepository(sql, tableName, preloadAmount)));
}
内容来源于网络,如有侵权,请联系作者删除!