当前位置: 首页>>代码示例>>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;未经允许,请勿转载。