當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。