本文整理匯總了Java中org.bukkit.configuration.file.FileConfiguration.getBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java FileConfiguration.getBoolean方法的具體用法?Java FileConfiguration.getBoolean怎麽用?Java FileConfiguration.getBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.configuration.file.FileConfiguration
的用法示例。
在下文中一共展示了FileConfiguration.getBoolean方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onEnable
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
@Override
public void onEnable() {
defaultConfig = getConfig();
instance = this;
FileConfiguration config = getConfig();
config.addDefault(PROTECTION_KEY, false);
config.addDefault(PLAYER_KICK_KEY, "Please verify that you're not a robot. Visit %s");
config.addDefault(WHITELIST_KEY, new ArrayList<String>());
config.addDefault(VERIFICATION_ROOT_KEY, "http://yourdomain.com/");
config.addDefault(WIPE_KEY, "secret");
config.options().copyDefaults(true);
saveConfig();
getServer().getPluginManager().registerEvents(new EventListener(), this);
EventListener.protection = config.getBoolean(PROTECTION_KEY);
EventListener.kickMessage = config.getString(PLAYER_KICK_KEY);
this.getCommand("antibots").setExecutor(new CommandAntibots());
getLogger().log(Level.INFO, "Plugin successfully enabled. Default protection is " + config.getBoolean(PROTECTION_KEY));
}
示例2: read
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
/**
* Get the data from config file.
*
* @param config the configuration file.
*/
public void read(FileConfiguration config) {
// read type and time.
banType = BanList.Type.valueOf(config.getString("ban-type"));
banTime = config.getInt("ban-time", banTime);
// convert the days into a date.
String days = config.getString("ban-days");
if (Objects.isNull(days) || Objects.equals(days, "0")) {
banDate = null;
} else {
GregorianCalendar c = new GregorianCalendar();
c.add(GregorianCalendar.DATE, Integer.parseInt(days));
banDate = c.getTime();
}
tpsLimit = config.getInt("tps-limit", tpsLimit);
broadcastBan = config.getBoolean("broadcast-ban");
if (broadcastBan) {
String message = config.getString("broadcast-message");
broadcastMessage = ChatColor.translateAlternateColorCodes('&', message);
}
}
示例3: WorldSeterLimitor
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
@EventHandler
public void WorldSeterLimitor(WorldInitEvent event) {
World world = event.getWorld();
FileConfiguration config = EscapeLag.configOptimize.getValue();
if (config.getBoolean("WorldSpawnLimitor." + world.getName() + ".enable")) {
world.setMonsterSpawnLimit(config.getInt("WorldSpawnLimitor." + world.getName() + ".PerChunkMonsters"));
world.setAnimalSpawnLimit(config.getInt("WorldSpawnLimitor." + world.getName() + ".PerChunkAnimals"));
world.setAmbientSpawnLimit(config.getInt("WorldSpawnLimitor." + world.getName() + ".PerChunkAmbient"));
EscapeLag.MainThis.getLogger().info("已為世界 " + world.getName() + " 設定了生物刷新速率~");
}
}
示例4: getCrafts
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public ArrayList<CraftArray> getCrafts(){
ArrayList<CraftArray> craftlist = new ArrayList<CraftArray>();
try {
File craftfile = new File(plugin.getDataFolder(), "crafts.yml");
craftfile.createNewFile();
FileConfiguration craftconfig = YamlConfiguration.loadConfiguration(craftfile);
if(craftconfig.isSet("Crafts")) {
for(String craftpath : craftconfig.getConfigurationSection("Crafts").getKeys(false)) {
craftpath = "Crafts." + craftpath;
ArrayList<ItemStack> config_craft = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".craft");
ArrayList<ItemStack> config_resultitems = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".result.items");
ArrayList<Integer> config_resultprobs = (ArrayList<Integer>) craftconfig.getIntegerList(craftpath + ".result.probs");
HashMap<ItemStack,Integer> config_result = new HashMap<ItemStack, Integer>();
for(ItemStack resultitem : config_resultitems) {
config_result.put(resultitem, config_resultprobs.get(config_resultitems.indexOf(resultitem)));
}
ArrayList<String> config_cmds = (ArrayList<String>) craftconfig.getStringList(craftpath + ".cmds");
boolean config_redstonepower = craftconfig.getBoolean(craftpath + ".redstonepower");
int config_experience = craftconfig.getInt(craftpath + ".experience");
CraftArray specraft = new CraftArray(config_craft, config_result, config_cmds, config_redstonepower, config_experience);
craftlist.add(specraft);
}
return craftlist;
} else {
return craftlist;
}
} catch (Exception e) {
e.printStackTrace();
return craftlist;
}
}
示例5: DataProvider
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
private DataProvider() {
FileConfiguration config = Main.config();
this.protection = config.getBoolean(Main.PROTECTION_KEY);
this.kickMessage = config.getString(Main.PLAYER_KICK_KEY);
String root = config.getString(Main.VERIFICATION_ROOT_KEY);
if (!root.endsWith("/")) root += '/';
root = root.replace('\\', '/');
this.verificationRoot = root;
this.wipeKey = config.getString(Main.WIPE_KEY);
this.whitelist = config.getStringList(Main.WHITELIST_KEY);
this.formattedMessage = String.format(ChatColor.translateAlternateColorCodes('&', getKickMessage()), root);
}
示例6: CheckManager
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
/**
* Handle getting all the check data.
*
* @param configuration the configuration file.
*/
public CheckManager(FileConfiguration configuration) {
this.configuration = configuration;
for (CheckType check : CheckType.values()) {
String checkName = check.getCheckName().toLowerCase();
ConfigurationSection section = configuration.getConfigurationSection(checkName);
boolean isEnabled = configuration.getBoolean(checkName + ".enabled");
// if were not enabled, continue.
if (!isEnabled) {
continue;
}
// collect the violation levels from the config.
int banViolations = section.getInt("ban");
int cancelViolations = section.getInt("cancel-vl");
int notifyViolations = section.getInt("notify");
// populate the map with the new check data.
boolean cancelCheck = section.getBoolean("cancel");
CheckData data = new CheckData(notifyViolations, cancelViolations, banViolations, cancelCheck, banViolations > 0);
CHECK_DATA.put(check, data);
Arc.getPlugin().getLogger().info("Finished getting data for check: " + checkName);
}
}
示例7: reload
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
/**
* Reload the configuration.
*/
public void reload(FileConfiguration configuration) {
this.configuration = configuration;
for (CheckType check : CheckType.values()) {
String checkName = check.getCheckName().toLowerCase();
ConfigurationSection section = configuration.getConfigurationSection(checkName);
boolean isEnabled = configuration.getBoolean(checkName + ".enabled");
// if were not enabled, continue.
if (!isEnabled) {
continue;
}
// collect the violation levels from the config.
int banViolations = section.getInt("ban");
int cancelViolations = section.getInt("cancel-vl");
int notifyViolations = section.getInt("notify");
// populate the map with the new check data.
boolean cancelCheck = section.getBoolean("cancel");
CHECK_DATA.remove(check);
CheckData data = new CheckData(notifyViolations, cancelViolations, banViolations, cancelCheck, banViolations > 0);
CHECK_DATA.put(check, data);
Arc.getPlugin().getLogger().info("Finished getting data for check: " + checkName);
}
}
示例8: EntitySpawnTask
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
/**Constructor, passes arguments to super class and loads special values from config.
* @param parent The Room this Task belongs to
* @param conf Given config file of this room has entries on tasks.
* @param taskNr Task number is needed to load keys correctly.
*/
public EntitySpawnTask(Room parent, FileConfiguration conf, int taskNr) {
super(parent, conf, taskNr);
this.type = TaskType.ENTITYSPAWN;
// loading values for this Task type:
String path = "tasks.task" + this.taskNr + ".";
grp = new EntityGroup();
grp.type = EntityType.valueOf(conf.getString( path + "entityType"));
grp.count = conf.getInt( path + "count");
//TODO: maxCount noch einbauen -> bei jedem Spawning z�hlen, bei Tod runterz�hlen
grp.maxCount = conf.getInt( path + "maxCount");
grp.isTarget = conf.getBoolean(path + "isTarget");
}
示例9: loadDisabledEmojis
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
/**
* Loads the disabled emojis from the config.
*
* @param config The config to load disabled emojis from.
* @param plugin The EmojiChat main class instance.
*/
private void loadDisabledEmojis(FileConfiguration config, EmojiChat plugin) {
if (config.getBoolean("disable-emojis")) {
for (String disabledEmoji : config.getStringList("disabled-emojis")) {
if (disabledEmoji == null || !emojis.containsKey(disabledEmoji)) {
plugin.getLogger().warning("Invalid emoji specified in 'disabled-emojis': '" + disabledEmoji + "'. Skipping...");
continue;
}
disabledCharacters.add(emojis.remove(disabledEmoji)); // Remove disabled emojis from the emoji list
}
}
}
示例10: getPendingRequests
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
public static int getPendingRequests() {
FileConfiguration c = Main.getInstance().getConfig();
int pending = 0;
for (int i = 0; i <= c.getInt("current_id"); i++) {
if (!c.getBoolean("ban_requests." + i + ".closed")) {
pending = pending + 1;
}
}
return pending;
}
示例11: BanRequest
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
public BanRequest(int _id) {
id = _id;
FileConfiguration c = Main.getInstance().getConfig();
timeOpened = c.getLong("ban_requests." + id + ".timeOpened");
timeClosed = c.getLong("ban_requests." + id + ".timeClosed");
openerUUID = c.getString("ban_requests." + id + ".openerUUID");
closerUUID = c.getString("ban_requests." + id + ".closerUUID");
timeOpenedFormatted = c.getString("ban_requests." + id + ".timeOpenedFormatted");
timeClosedFormatted = c.getString("ban_requests." + id + ".timeClosedFormatted");
closed = c.getBoolean("ban_requests." + id + ".closed");
accepted = c.getBoolean("ban_requests." + id + ".accepted");
denied = c.getBoolean("ban_requests." + id + ".denied");
banReason = c.getString("ban_requests." + id + ".banReason");
playerToBanUUID = c.getString("ban_requests." + id + ".playerToBanUUID");
}
示例12: onLoad
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
@SuppressWarnings("ResultOfMethodCallIgnored")
@Override
public void onLoad() {
instance = this;
if (!working) return;
dependencyFolder = new File(getDataFolder(), "Dependencies");
if (!dependencyFolder.exists()) dependencyFolder.mkdirs();
saveDefaultConfig();
FileConfiguration config = getConfig();
showDebug = config.getBoolean("options.showDebug", false);
enforceFileCheck = config.getBoolean("options.showDebug", true);
Urls.addRepositories(config.getStringList("options.repositories"));
PluginDescriptionFile pluginDesc = getDescription();
log(Level.INFO,
" ", " ",
blockBar(45),
"< ",
"< Dependency Loader " + pluginDesc.getVersion() + " by - " + pluginDesc.getAuthors(),
"< ",
"< Showing Debug Messages? -> " + showDebug,
"< Enforcing File Check? -> " + enforceFileCheck,
"< ",
blockBar(45),
" ", " ");
ConfigurationSection configDeps = config.getConfigurationSection("dependencies");
if (configDeps == null) return;
Set<String> keys = configDeps.getKeys(false);
keys.forEach(name -> {
String groupId = configDeps.getString(name + ".group", "");
String version = configDeps.getString(name + ".version", "");
String artifactId = configDeps.getString(name + ".artifact", "");
String customRepo = configDeps.getString(name + ".repository", "");
boolean alwaysUpdate = configDeps.getBoolean(name + ".always-update", false);
if (version.isEmpty() || groupId.isEmpty() || artifactId.isEmpty()) {
log(Level.SEVERE,
" ", " ",
blockBar(45),
"< ",
"< Dependency " + name + " has incomplete details",
"< Requires, case-sensitive",
"< 'version', 'group', 'artifact'",
"< ",
blockBar(45),
" ", " ");
} else {
final Dependency dependency = new Dependency(name.toLowerCase(), version, groupId, artifactId, customRepo, alwaysUpdate);
if (dependencies.containsValue(dependency)) debug("Dependency " + name + " has a duplicate");
debug("Attempting load of Dependency " + name + " From Config");
load(dependency);
}
});
}
示例13: DragonDeathRunnable
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
/**
* Construct a new DragonDeathRunnable object
*
* @param plugin an instance of the DragonEggDrop plugin
* @param worldWrapper the world in which the dragon death is taking place
* @param dragon the dragon dying in this runnable
*/
public DragonDeathRunnable(DragonEggDrop plugin, EndWorldWrapper worldWrapper, EnderDragon dragon) {
this.plugin = plugin;
this.worldWrapper = worldWrapper;
this.world = worldWrapper.getWorld();
this.dragon = dragon;
FileConfiguration config = plugin.getConfig();
this.particleType = Particle.valueOf(config.getString("Particles.type", "FLAME").toUpperCase());
this.particleAmount = config.getInt("Particles.amount", 4);
this.particleExtra = config.getDouble("Particles.extra", 0.0D);
this.particleMultiplier = config.getDouble("Particles.speed-multiplier", 0.0D);
this.particleStreamInterval = 360 / Math.max(1, config.getInt("Particles.stream-count"));
this.xOffset = config.getDouble("Particles.xOffset");
this.yOffset = config.getDouble("Particles.yOffset");
this.zOffset = config.getDouble("Particles.zOffset");
this.particleInterval = config.getLong("Particles.interval", 1L);
this.lightningAmount = config.getInt("lightning-amount");
// Portal location
DragonBattle dragonBattle = plugin.getNMSAbstract().getEnderDragonBattleFromDragon(dragon);
Location portalLocation = dragonBattle.getEndPortalLocation();
this.currentY = config.getDouble("Particles.egg-start-y");
this.location = new Location(world, portalLocation.getX(), this.currentY, portalLocation.getZ());
// Expression parsing
String shape = config.getString("Particles.Advanced.preset-shape");
String xCoordExpressionString = config.getString("Particles.Advanced.x-coord-expression");
String zCoordExpressionString = config.getString("Particles.Advanced.z-coord-expression");
if (shape.equalsIgnoreCase("BALL")) {
this.particleShape = new ParticleShapeDefinition(location, "x", "z");
}
else if (shape.equalsIgnoreCase("HELIX")) {
this.particleShape = new ParticleShapeDefinition(location, "cos(theta) * 1.2", "sin(theta) * 1.2");
}
else if (shape.equalsIgnoreCase("OPEN_END_HELIX")) {
this.particleShape = new ParticleShapeDefinition(location, "cos(theta) * (100 / t)", "sin(theta) * (100 / t)");
}
else { // CUSTOM or default
this.particleShape = new ParticleShapeDefinition(location, xCoordExpressionString, zCoordExpressionString);
}
this.respawnDragon = config.getBoolean("respawn-on-death", false);
this.runTaskTimer(plugin, 0, this.particleInterval);
BattleStateChangeEvent bscEventCrystals = new BattleStateChangeEvent(dragonBattle, dragon, BattleState.BATTLE_END, BattleState.PARTICLES_START);
Bukkit.getPluginManager().callEvent(bscEventCrystals);
}