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


Java Configuration.contains方法代码示例

本文整理汇总了Java中org.bukkit.configuration.Configuration.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.contains方法的具体用法?Java Configuration.contains怎么用?Java Configuration.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.configuration.Configuration的用法示例。


在下文中一共展示了Configuration.contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:TonyMaster21,项目名称:BungeeMaster,代码行数:22,代码来源:BungeeMaster.java

示例2: inflateUnsafe

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
@Override
public void inflateUnsafe(Configuration config, Object[] args) throws ParseException {
	List<String> lines = Lists.newArrayList();
	
	ConfigurationSection layoutSection = config.getConfigurationSection("layout");
	
	for (int i = 1; i <= SignLayout.LINE_COUNT; i++) {
		String line = layoutSection.getString(String.valueOf(i));
		lines.add(line);
	}
	
	layout = new SignLayout(lines);
	
	if (config.contains("options")) {
		options = config.getConfigurationSection("options");
	}
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:18,代码来源:SignLayoutConfiguration.java

示例3: Modreq

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
/**
 * @author xize
 * @param use the players configuration, and the id of the modreq.
 * @throws NullPointerException when no modreq node exists in this configuration.
 */
public Modreq(Configuration con, int id) {
	if(con.contains("modreqs."+"modreq"+id)) {
		this.con = con;
		this.id = id;	
	} else {
		throw new NullPointerException();
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:14,代码来源:Modreq.java

示例4: thawEntity

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
private void thawEntity(Animals entity, Configuration conf) {
    Debugger.getInstance().debug("thaw entity: " + entity + ", data:" + conf.getString("type"));

    entity.setAge(conf.getInt("age"));
    entity.setAgeLock(conf.getBoolean("ageLock"));
    entity.setCustomName(conf.getString("name"));
    entity.setCustomNameVisible(conf.getBoolean("nameVisible"));
    entity.setMaxHealth(conf.getDouble("maxHealth"));
    entity.setHealth(conf.getDouble("health"));

    if (entity instanceof Tameable) {
        ((Tameable) entity).setTamed(conf.getBoolean("tamed"));
        if (conf.contains("owner")) {
            UUID id = UUID.fromString(conf.getString("owner"));
            ((Tameable) entity).setOwner(Bukkit.getOfflinePlayer(id));
        }
    }

    switch (entity.getType()) {
        case PIG:
            ((Pig) entity).setSaddle(conf.getBoolean("saddled"));
            break;
        case SHEEP:
            ((Sheep) entity).setSheared(conf.getBoolean("sheared"));
            ((Sheep) entity).setColor(DyeColor.valueOf(conf.getString("color")));
            break;
        case OCELOT:
            ((Ocelot) entity).setSitting(conf.getBoolean("sitting"));
            ((Ocelot) entity).setCatType(Ocelot.Type.valueOf(conf.getString("catType")));
            break;
        case WOLF:
            ((Wolf) entity).setSitting(conf.getBoolean("sitting"));
            ((Wolf) entity).setCollarColor(DyeColor.valueOf(conf.getString("collar")));
            break;
        case HORSE:
            Horse h = (Horse) entity;
            h.setColor(Horse.Color.valueOf(conf.getString("horseColor")));
            h.setVariant(Horse.Variant.valueOf(conf.getString("horseVariant")));
            h.setStyle(Horse.Style.valueOf(conf.getString("horseStyle")));
            h.setCarryingChest(conf.getBoolean("chest"));
            h.setJumpStrength(conf.getDouble("jumpStrength"));
            h.setDomestication(conf.getInt("domestication"));
            h.setMaxDomestication(conf.getInt("maxDomestication"));
            // separate saddle & armor entries are obsolete now
            if (conf.contains("saddle")) {
                h.getInventory().setSaddle(new ItemStack(Material.getMaterial(conf.getString("saddle"))));
            }
            if (conf.contains("armor")) {
                h.getInventory().setArmor(new ItemStack(Material.getMaterial(conf.getString("armor"))));
            }
            try {
                Inventory inv = BukkitSerialization.fromBase64(conf.getString("inventory"));
                for (int i = 0; i < h.getInventory().getSize(); i++) {
                    h.getInventory().setItem(i, inv.getItem(i));
                }
            } catch (IOException e) {
                LogUtils.warning("could not restore horse inventory!");
                e.printStackTrace();
            }
            break;
    }
}
 
开发者ID:desht,项目名称:sensibletoolbox,代码行数:63,代码来源:EnderLeash.java


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