本文整理匯總了Java中org.bukkit.configuration.Configuration.getBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getBoolean方法的具體用法?Java Configuration.getBoolean怎麽用?Java Configuration.getBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.getBoolean方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: onEnable
import org.bukkit.configuration.Configuration; //導入方法依賴的package包/類
@Override
public void onEnable() {
this.getCommand("nbtproxy").setExecutor(new InfoCommand(this.getDescription()));
this.saveDefaultConfig();
Configuration config = getConfig();
int enabledCommands = 0;
for (Permissions perm : Permissions.values()) {
if (config.getBoolean("enabled-commands." + perm.CONFIG_KEY))
enabledCommands |= perm.PERM_ENABLED_FLAG;
}
this.getCommand("nbt").setExecutor(new NBTCommand(enabledCommands));
}
示例3: 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);
}
示例4: 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);
}
示例5: onEnable
import org.bukkit.configuration.Configuration; //導入方法依賴的package包/類
public void onEnable() {
instance = this;
if (!checkLibraries()) {
Bukkit.getLogger().severe("Missing libraries. Plugin had to stop. Please add apache-commons and guava to classpath.");
getPluginLoader().disablePlugin(this);
return;
}
try {
updater = new Updater();
Bukkit.getPluginManager().registerEvents(updater, this);
} catch (MalformedURLException e) {
e.printStackTrace();
}
// Load config
this.saveDefaultConfig();
Bukkit.getPluginCommand("update").setExecutor(new CommandUpdate());
Bukkit.getPluginCommand("credits").setExecutor(new CommandCredit());
Configuration configuration = getConfig();
// World Generator
if (configuration.getBoolean("generator.enabled", false)) {
Bukkit.getPluginManager().registerEvents(new WorldGenerator(configuration), this);
Bukkit.getLogger().info("Improved generation is enabled !");
}
if (configuration.getBoolean("lootReplacer.enabled", false)) {
Bukkit.getPluginManager().registerEvents(new LootReplacer(configuration.getConfigurationSection("lootReplacer")), this);
Bukkit.getLogger().info("Improved loots are enabled !");
}
if (configuration.getBoolean("entitiesDrops.enabled", false)) {
Bukkit.getPluginManager().registerEvents(new EntitiesDropsReplacer(configuration.getConfigurationSection("entitiesDrops")), this);
Bukkit.getLogger().info("Improved entities drops are enabled !");
}
if (configuration.getBoolean("higherCrafts", false)) {
Bukkit.getPluginManager().registerEvents(new HigherCrafts(), this);
Bukkit.getLogger().info("Improved crafts are enabled !");
}
if (configuration.getBoolean("fasterTrees", false)) {
Bukkit.getPluginManager().registerEvents(new TreeCapitator(), this);
Bukkit.getLogger().info("Faster tree breaking is enabled !");
}
if (configuration.getBoolean("fasterObisidian", false)) {
Bukkit.getPluginManager().registerEvents(new FasterObsidian(), this);
Bukkit.getLogger().info("Faster obsidian breaking is enabled !");
}
if (configuration.getBoolean("stoneBreaksAll", false)) {
Bukkit.getPluginManager().registerEvents(new StoneBreaksAll(), this);
Bukkit.getLogger().info("Better tools breaking is enabled !");
}
if (configuration.getBoolean("autoUpdate", false)) {
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> updater.doUpdate(Bukkit.getConsoleSender()), 20, 60 * 30 * 20);
}
if (configuration.getBoolean("netherGen.enabled", false)) {
Bukkit.getPluginManager().registerEvents(new net.zyuiop.fastsurvival.nethers.WorldGenerator(configuration.getDouble("netherGen.probability", 0.01), configuration.getBoolean("netherGen.log", false)), this);
Bukkit.getLogger().info("Nether generation is enabled !");
}
}