當前位置: 首頁>>代碼示例>>Java>>正文


Java YamlConfiguration.contains方法代碼示例

本文整理匯總了Java中org.bukkit.configuration.file.YamlConfiguration.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java YamlConfiguration.contains方法的具體用法?Java YamlConfiguration.contains怎麽用?Java YamlConfiguration.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.configuration.file.YamlConfiguration的用法示例。


在下文中一共展示了YamlConfiguration.contains方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initFile

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
/**
 * 初始化配置文件
 *
 * @param config
 *            配置文件
 * @throws IOException
 */
private static void initFile(final YamlConfiguration config) throws IOException {
    if (config.getString("guid") == null) {
        config.options().header("YUMC數據中心 http://www.yumc.pw 收集的數據僅用於統計插件使用情況").copyDefaults(true);
        config.set("guid", UUID.randomUUID().toString());
        config.set("debug", false);
        config.save(configfile);
    }
    if (!config.contains("YumAccount")) {
        config.set("YumAccount.username", "Username Not Set");
        config.set("YumAccount.password", "Password NotSet");
        config.save(configfile);
    }
    if (!config.contains("TellrawManualHandle")) {
        config.set("TellrawManualHandle", false);
        config.save(configfile);
    }
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:25,代碼來源:YUMCStatistics.java

示例2: StringToItemStack

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public static ItemStack StringToItemStack(String string) {
	if (string == null) {
		return null;
	}
	YamlConfiguration yaml = new YamlConfiguration();
	try {
		yaml.loadFromString(string);
	} catch (InvalidConfigurationException e) {
		e.printStackTrace();
	}
	if (yaml.contains("item")) {
		return yaml.getItemStack("item", null);
	} else {
		return yaml.getItemStack("i", null);
	}
}
 
開發者ID:RoboTricker,項目名稱:Transport-Pipes,代碼行數:17,代碼來源:InventoryUtils.java

示例3: get

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public MComponent get(String type, String node) {
	if(node == null)
		return Void;
	MComponent result = super.get(node, false);
	if(result!=null)return result;
	else{
		YamlConfiguration config =  this.config.get(VanillaPlusCore.getDefaultLang());
		if(config.contains(node)){
			ErrorLogger.addPrefix(node);
			result = create(type, VanillaPlusCore.getDefaultLang(), config.getString(node));
			ErrorLogger.removePrefix();
		}
		if(result!=null){
			addLangs(result, node);
			super.register(node, result, false);
			return result;
		}
		else{
			Error.MISSING_NODE.add(node);
			return Void;
		}
	}
}
 
開發者ID:dracnis,項目名稱:VanillaPlus,代碼行數:24,代碼來源:MComponentManager.java

示例4: copyDefaultNode

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public static void copyDefaultNode(YamlConfiguration configFile, Plugin plugin, String path, String nodPath){
	configFile.createSection(nodPath);
	path = fixPath(path);
	InputStream file = plugin.getResource(path.replace(File.separatorChar, '/'));
	if(file!=null){
		YamlConfiguration defaultFile = YamlConfiguration.loadConfiguration(new InputStreamReader(file));
		if(defaultFile.contains(nodPath))
			configFile.set(nodPath, defaultFile.get(path));
		else
			configFile.set(nodPath, Error.MISSING_NODE.getMessage());
	}
	File temp = new File(plugin.getDataFolder(), path);
	try {
		configFile.save(temp);
	} catch (IOException e) {
		e.printStackTrace();
		ErrorLogger.addError("I/O Exception for file : " + temp.getAbsolutePath());
	}
}
 
開發者ID:dracnis,項目名稱:VanillaPlus,代碼行數:20,代碼來源:ConfigUtils.java

示例5: onChat

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
@EventHandler
public void onChat(AsyncPlayerChatEvent e) {
	String[] words = e.getMessage().split(" ");
	if (pit.contains(e.getPlayer().getName())) {
		executeBSC(e.getPlayer(), e.getMessage());
		e.setCancelled(true);
		return;
	}
	if (haulted) {
		if (!e.getPlayer().isOp()) {
			e.getPlayer().sendMessage(TAG + ChatColor.RED + "Server Haulted!");
			e.setCancelled(true);
			return;
		}
	}
	Player player = (Player) e.getPlayer();
	String msg = e.getMessage().toLowerCase().replaceAll(" ", "");
	if (msg.contains("(.)") || msg.contains(".net") || msg.contains(".com") || msg.contains(".co")
			|| msg.contains(" . ")) {
		player.kickPlayer(TAG + ChatColor.RED + "Possible advertising");
		return;
	}
	// detecting variables
	YamlConfiguration varConf = YamlConfiguration.loadConfiguration(varFile);
	int word = 0;
	for (String s : words) {
		if ((!(s.length() < 3)) && s.startsWith("%") && s.endsWith("%")) {
			String ss = s.replace("%", "");
			if (varConf.contains(ss)) {
				words[word] = varConf.getString(ss);
				String newText = "";
				for (int i = 0; i < words.length; i++) {
					newText = newText + words[i] + " ";
				}
				e.setMessage(newText);
			}
		}
		word++;
	}
}
 
開發者ID:OverloadedCore,項目名稱:behave,代碼行數:41,代碼來源:MainPart.java

示例6: addLangs

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public void addLangs(MComponent message, String node){
	for(Localizer loc : VanillaPlusCore.getLangs()){
		if(loc == VanillaPlusCore.getDefaultLang())
			continue;
		YamlConfiguration config = this.config.get(loc);
		if(config.contains(node)){
			message.addLang(loc, config.getString(node));
		}else{
			message.addLang(loc, Error.MISSING_NODE.add(" " + loc.getCode() + " => " + node));
		}
	}
}
 
開發者ID:dracnis,項目名稱:VanillaPlus,代碼行數:13,代碼來源:MComponentManager.java

示例7: mergeInDefaultConfig

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
private void mergeInDefaultConfig(YamlConfiguration c) {
     for (Map.Entry<String, Object> defaultConfigItem : defaults.entrySet()) {
        if (!c.contains(defaultConfigItem.getKey())) {
            c.set(defaultConfigItem.getKey(), defaultConfigItem.getValue());
        }
    }
}
 
開發者ID:Deltik,項目名稱:SignEdit,代碼行數:8,代碼來源:Configuration.java


注:本文中的org.bukkit.configuration.file.YamlConfiguration.contains方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。