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


Java InvalidConfigurationException类代码示例

本文整理汇总了Java中org.bukkit.configuration.InvalidConfigurationException的典型用法代码示例。如果您正苦于以下问题:Java InvalidConfigurationException类的具体用法?Java InvalidConfigurationException怎么用?Java InvalidConfigurationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InvalidConfigurationException类属于org.bukkit.configuration包,在下文中一共展示了InvalidConfigurationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLeave

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
@EventHandler
public void onLeave(PlayerQuitEvent event){
	Player p = event.getPlayer();

	if(Files.user.contains("Users." + p.getName())){

		try{
			Files.user.save(Files.users);
			Files.user.load(Files.users);
		}catch(IOException | InvalidConfigurationException e){
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		if(manager.isInPvP(p)){
			p.setHealth(0D);
			Bukkit.broadcastMessage(Message.prefix + ChatColor.GRAY + " ¡" + ChatColor.GOLD + p.getName() + Message.leave_in_pvp);
		}
	}
}
 
开发者ID:cadox8,项目名称:WC,代码行数:21,代码来源:PlayerEvent.java

示例2: loadMessage

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
static public void loadMessage(){
	File messageFile = new File("plugins" + File.separator + "PVPAsWantedManager" + File.separator + "message.yml");
	if(!messageFile.exists()){
		if(Config.getConfig("language").equals("CN")){
			createCNMessage();
		}else if(Config.getConfig("language").equals("EN")){
			//TODO createENMessage();
		}else{
			createCNMessage();
		}
	}else{
        Bukkit.getConsoleSender().sendMessage("§8[§6PVPAsWantedManager§8] §aFind Message.yml");
	}
	messages = new YamlConfiguration();
	try {messages.load(messageFile);} catch (IOException | InvalidConfigurationException e) {e.printStackTrace();Bukkit.getConsoleSender().sendMessage("§8[§6PVPAsWantedManager§8] §a读取message时发生错误");}
}
 
开发者ID:Saukiya,项目名称:PVPAsWantedManager,代码行数:17,代码来源:Message.java

示例3: onJoin

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent event){
	Player p = event.getPlayer();

	if(!Files.user.contains("Users." + p.getName())){

		Files.user.set("Users." + p.getName() + ".pvp", false);
		
		manager.addNewbie(p);
		
		try{
			Files.user.save(Files.users);
			Files.user.load(Files.users);
		}catch(IOException | InvalidConfigurationException e){
			e.printStackTrace();
		}

		return;
	}
	
}
 
开发者ID:cadox8,项目名称:WC,代码行数:22,代码来源:PlayerEvent.java

示例4: saveFiles

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
public void saveFiles(){
    try{
        config.save(fileConfig);
        users.save(fileUsers);
        fl.save(fileFL);
        casino.save(fileCasino);
        rain.save(fileRain);

        config.load(fileConfig);
        users.load(fileUsers);
        fl.load(fileFL);
        casino.load(fileCasino);
        rain.load(fileRain);
    }catch (java.io.IOException | InvalidConfigurationException e){
        e.printStackTrace();
    }
}
 
开发者ID:cadox8,项目名称:WC,代码行数:18,代码来源:Files.java

示例5: StringToItemStack

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的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

示例6: load

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
private void load(JavaPlugin plugin) {
    try {
        final FileConfiguration configuration = new YamlConfiguration();
        final File file = new File(plugin.getDataFolder(), "bungeecord_signs.yml");
        if (!file.exists()) {
            if (!file.createNewFile()) {
                Bukkit.getLogger().log(Level.WARNING, "File cannot get created.");
            }
        }
        configuration.load(file);
        if (configuration.getConfigurationSection("signs") != null) {
            final Map<String, Object> data = configuration.getConfigurationSection("signs").getValues(false);
            for (final String s : data.keySet()) {
                this.signs.add(new BungeeCordSignInfo.Container(((ConfigurationSection) data.get(s)).getValues(true)));
            }
        }
    } catch (IOException | InvalidConfigurationException e) {
        Bukkit.getLogger().log(Level.WARNING, "Save load location.", e);
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:21,代码来源:BungeeCordController.java

示例7: save

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
void save(Arena item) {
    if (item != null && item.getName() != null) {
        try {
            final FileConfiguration configuration = new YamlConfiguration();
            final File file = new File(this.getFolder(), "arena_" + item.getName() + ".yml");
            if (file.exists()) {
                if (!file.delete())
                    throw new IllegalStateException("Cannot delete file!");
            }
            if (!file.createNewFile())
                throw new IllegalStateException("Cannot create file!");
            configuration.load(file);
            final Map<String, Object> data = item.serialize();
            for (final String key : data.keySet()) {
                configuration.set("arena." + key, data.get(key));
            }
            configuration.save(file);
        } catch (IOException | InvalidConfigurationException ex) {
            Bukkit.getLogger().log(Level.WARNING,"Cannot save arena." ,ex.getMessage());
        }
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:23,代码来源:ArenaFileManager.java

示例8: create

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
public static void create() throws IOException{
    File pluginFolder = DogTags.getInstance().getDataFolder();
    f = new File(pluginFolder, "config.yml");

    if(!f.exists()){
        f.getParentFile().mkdirs();
        DogTags.getInstance().saveResource(f.getName(), false);
        LogUtil.outputMsg("File &6%file% &fdoesn't exist, creating file!".replace("%file%", f.getName()));
    }
    fc = new YamlConfiguration();
    try {
        fc.load(f);
    } catch (InvalidConfigurationException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Chazmondo,项目名称:DogTags,代码行数:17,代码来源:ConfigManager.java

示例9: getConfig

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
/**Static method to get a modules config alone, returns null if failed.
 * The loading is tested during the initial yml test and should therefore work during DunGen runtime.
 * @param parent 	The parent plugin
 * @param name 		The modules name for witch the config should be loaded (file 'name'.yml)
 * @return			The config object. Returns null if errors occured and sets plugin state to ERROR.
 */
public static YamlConfiguration getConfig(DunGen parent, String name) {
	File confFile = new File(parent.getDataFolder(),name+".yml");
	if (!confFile.exists()) {
		parent.setStateAndNotify(State.ERROR, "Config file for module " + name + " could not be found!");
		return null;
	}
	
	YamlConfiguration conf = new YamlConfiguration();
	try {
		conf.load(confFile);
	}catch (IOException | InvalidConfigurationException e) {
		parent.setStateAndNotify(State.ERROR, "Loading of config file for module " + name + " failed:");
		e.printStackTrace();
		return null;
	}
	// everything ok, if code reached here.
	parent.getLogger().info("YML file for module " + name + " loaded.");
	return conf;
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:26,代码来源:Module.java

示例10: finishHandshake

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
private void finishHandshake(ChannelHandlerContext ctx, FullHttpResponse response) {
    if (response.getStatus().equals(HttpResponseStatus.SWITCHING_PROTOCOLS)) {
        try {
            handshaker.finishHandshake(ctx.channel(), response);
            connection.handshakeFuture.setSuccess();

            logger.info("Successfully connected to AudioConnect server!");
            return;
        } catch (Exception e) {
            connection.handshakeFuture.setFailure(e);
        }
    } else {
        connection.handshakeFuture.setFailure(new InvalidConfigurationException());
    }

    String responseMsg = response.content().toString(StandardCharsets.UTF_8);
    logger.severe("Failed to Connect with AudioConnect server: " + responseMsg);
    logger.severe("Stopping client event loop due to failure to establish connection with AudioConnect server");

    disconnect();
}
 
开发者ID:DeadmanDungeons,项目名称:AudioConnect,代码行数:22,代码来源:AudioConnectClient.java

示例11: createFile

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
/**
 * Creates the config file if it doesn't exist yet.
 * If there are exceptions the stacktrace will be printed.
 */
private void createFile() {
    if (file == null) {
        new InvalidConfigurationException("File cannot be null!").printStackTrace();
    }
    try {
        if (!file.exists()) {
            if (file.getParentFile() != null) {
                file.getParentFile().mkdirs();
            }
            file.createNewFile();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:GameBoxx,项目名称:GameBoxx,代码行数:20,代码来源:OptionCfg.java

示例12: load

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
/**
 * Load the config file in to memory.
 * The value of all fields will be set with the config values.
 */
public void load() {
    if (file != null) {
        try {
            if (!file.exists()) {
                if (file.getParentFile() != null) {
                    file.getParentFile().mkdirs();
                }
                file.createNewFile();
            }

            conf.load(file);
            if (fields == null) {
                onLoad(conf);
            } else {
                onLoad(conf, fields);
            }
            conf.save(file);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        new InvalidConfigurationException("File cannot be null!").printStackTrace();
    }
}
 
开发者ID:GameBoxx,项目名称:GameBoxx,代码行数:29,代码来源:EasyConfig.java

示例13: save

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
/**
 * Save the config file to disk.
 * All values from the fields will be placed in the config.
 */
public void save() {
    if (file != null) {
        try {
            if (!file.exists()) {
                if (file.getParentFile() != null) {
                    file.getParentFile().mkdirs();
                }
                file.createNewFile();
            }
            if (fields == null) {
                onSave(conf);
            } else {
                onSave(conf, fields);
            }
            conf.save(file);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        new InvalidConfigurationException("File cannot be null!").printStackTrace();
    }
}
 
开发者ID:GameBoxx,项目名称:GameBoxx,代码行数:27,代码来源:EasyConfig.java

示例14: getTemporaryStorage

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
public List<ItemStack> getTemporaryStorage(OfflinePlayer player) {
    Query<TempStorageRepo> result = query(TempStorageRepo.class).whereEq("player_id", player.getUniqueId().toString());
    if (result == null || result.count() == 0) return Collections.emptyList();
    YamlConfiguration cfg = new YamlConfiguration();
    try {
        cfg.loadFromString(result.selectUnique().yaml);
    } catch (InvalidConfigurationException ex) {
        ex.printStackTrace();
        return Collections.emptyList();
    }
    List<ItemStack> ret = new ArrayList<>();
    for (String key : cfg.getKeys(false)) {
        ret.add(cfg.getItemStack(key));
    }
    return ret;
}
 
开发者ID:NyaaCat,项目名称:HamsterEcoHelper,代码行数:17,代码来源:Database.java

示例15: loadItems

import org.bukkit.configuration.InvalidConfigurationException; //导入依赖的package包/类
public List<ShopItem> loadItems(String path) {
    YamlConfiguration configuration = new YamlConfiguration();
    try {
        configuration.loadFromString(this.yaml);
    } catch (InvalidConfigurationException e) {
        e.printStackTrace();
    }
    ArrayList<ShopItem> list = new ArrayList<>();
    if (configuration.isConfigurationSection(path)) {
        ConfigurationSection section = configuration.getConfigurationSection(path);
        for (String k : section.getKeys(false)) {
            list.add(new ShopItem(section.getConfigurationSection(k)));
        }
    }
    return list;
}
 
开发者ID:NyaaCat,项目名称:HamsterEcoHelper,代码行数:17,代码来源:SignShop.java


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