当前位置: 首页>>代码示例>>Java>>正文


Java FileConfiguration.getBoolean方法代码示例

本文整理汇总了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));
   }
 
开发者ID:pietrek777,项目名称:AntiBots,代码行数:26,代码来源:Main.java

示例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);
    }

}
 
开发者ID:Vrekt,项目名称:Arc-v2,代码行数:31,代码来源:ArcConfiguration.java

示例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() + " 设定了生物刷新速率~");
    }
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:12,代码来源:WorldSpawnLimiter.java

示例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;
   	}
   }
 
开发者ID:Slaymd,项目名称:CaulCrafting,代码行数:33,代码来源:CraftStorage.java

示例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);

}
 
开发者ID:pietrek777,项目名称:AntiBots,代码行数:16,代码来源:DataProvider.java

示例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);
    }

}
 
开发者ID:Vrekt,项目名称:Arc-v2,代码行数:33,代码来源:CheckManager.java

示例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);
    }
}
 
开发者ID:Vrekt,项目名称:Arc-v2,代码行数:32,代码来源:CheckManager.java

示例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");
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:19,代码来源:EntitySpawnTask.java

示例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
		}
	}
}
 
开发者ID:RadBuilder,项目名称:EmojiChat,代码行数:18,代码来源:EmojiHandler.java

示例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;
}
 
开发者ID:JustBru00,项目名称:EpicBanRequests,代码行数:15,代码来源:Main.java

示例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");
}
 
开发者ID:JustBru00,项目名称:EpicBanRequests,代码行数:16,代码来源:BanRequest.java

示例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);
		}
	});

}
 
开发者ID:Sxtanna,项目名称:dependency-loader,代码行数:67,代码来源:DLoader.java

示例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);
}
 
开发者ID:2008Choco,项目名称:DragonEggDrop,代码行数:56,代码来源:DragonDeathRunnable.java


注:本文中的org.bukkit.configuration.file.FileConfiguration.getBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。