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


Java FileConfiguration.set方法代码示例

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


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

示例1: removeSignJoinGame

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void removeSignJoinGame(String gameNumber) {
	File signJoinFile = new File(SkyWarsReloaded.get().getDataFolder(), "signJoinGames.yml");
	FileConfiguration storage = YamlConfiguration.loadConfiguration(signJoinFile);
 		storage.set("games." + gameNumber, null);
 		try {
		storage.save(signJoinFile);
	} catch (IOException e) {
		e.printStackTrace();
	}
       signJoinGames.remove(Integer.valueOf(gameNumber));
       Game game = getGame(Integer.valueOf(gameNumber));
       if (game != null) {
           if (game.getState() != GameState.PLAYING) {
           	game.endGame();
           }
       }
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:18,代码来源:GameController.java

示例2: save

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void save() {
    FileConfiguration config = ManagerHandler.getConfig().getArenasConfig().getConfig();

    config.set("arenas." + this.name + ".display-name", this.displayName);
    config.set("arenas." + this.name + ".display-order", this.displayOrder);

    if (this.location1 != null) {
        config.set("arenas." + this.name + ".location1", LocationUtils.getString(this.location1));
    } else {
        config.set("arenas." + this.name + ".location1", "unset");
    }

    if (this.location2 != null) {
        config.set("arenas." + this.name + ".location2", LocationUtils.getString(this.location2));
    } else {
        config.set("arenas." + this.name + ".location2", "unset");
    }

    ManagerHandler.getConfig().getArenasConfig().save();
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:21,代码来源:Arena.java

示例3: restoreNodes

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public static void restoreNodes(Coord<File, FileConfiguration> coord, Class<? extends Configurable> clazz) throws IllegalArgumentException, IllegalAccessException, IOException {
	FileConfiguration config = coord.getValue();

    for (Field field : clazz.getDeclaredFields()) {
        Node node = field.getAnnotation(Node.class);
        if (node == null) continue;
        field.setAccessible(true);

        Object def = field.get(null);
        int mod = field.getModifiers();
        if (Modifier.isStatic(mod) && !Modifier.isFinal(mod)) {
            String path = node.path();
            Object value = config.get(path);
            if (value == null) {
                config.set(path, def);
                field.set(null, AzureAPI.colorzine(def)); // for colorzine
            } else {
                field.set(null, AzureAPI.colorzine(value));
            }
        }
    }

    config.save(coord.getKey());
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:25,代码来源:Configurable.java

示例4: removeCraft

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void removeCraft(int nb) {
try {
	//replacing in the file
   	File craftfile = new File(plugin.getDataFolder(), "crafts.yml");
	craftfile.createNewFile();
	FileConfiguration craftconfig = YamlConfiguration.loadConfiguration(craftfile);
	int count = 0;
	for(String craftuuid : craftconfig.getConfigurationSection("Crafts").getKeys(false)) {
		if(nb == count) {
			craftconfig.set("Crafts." + craftuuid, null);
		}
		count++;
	}
	craftconfig.save(craftfile);
  	} catch (Exception e) {
  		//
  	}
  }
 
开发者ID:Slaymd,项目名称:CaulCrafting,代码行数:19,代码来源:CraftStorage.java

示例5: storeNewData

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void storeNewData(Learn learn, KnownCheating knownCheating) {
	final FileConfiguration fc = getConfig();

	// Generate a UUID for this check (its identifier).
	UUID uuid = UUID.randomUUID();

	while (fc.isConfigurationSection(uuid.toString())) {
		uuid = UUID.randomUUID();
	}

	// The path to put the data in the file.
	String cheatPath = getCheatPath(knownCheating);

	// Get general values.
	final double currentMean = fc.getDouble(cheatPath + "CurrentMean");
	final double currentLowRange = fc.getDouble(cheatPath + "CurrentLowRange");
	final double currentHighRange = fc.getDouble(cheatPath + "CurrentHighRange");
	final long totalSamples = fc.getLong(cheatPath + "TotalSamples");

	if (currentLowRange == 0.0 || learn.getValue() < currentLowRange) {
		fc.set(cheatPath + "CurrentLowRange", learn.getValue());
	} else if (learn.getValue() > currentHighRange) {
		fc.set(cheatPath + "CurrentHighRange", learn.getValue());
	}

	// Calculate the new average.
	double updateMean = (currentMean + learn.getValue()) / 2.0;

	fc.set(cheatPath + "CurrentMean", updateMean);
	fc.set(cheatPath + "TotalSamples", totalSamples + 1);

	// Save the file.
	save(fc);
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:35,代码来源:LearnData.java

示例6: createFile

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void createFile(Player p) {
	File pFileDir = new File(Main.getInstance().getDataFolder(), "Players");
	if (!pFileDir.exists()) {
		pFileDir.mkdir();
	}
	File pFile = new File(Main.getInstance().getDataFolder(), "Players/" + p.getName().toLowerCase() + ".yml");
	if (!pFile.exists())
		try {
			pFile.createNewFile();
			List<String> combo = new ArrayList<String>();
			List<String> guilds = new ArrayList<String>();
			combo.add(0, "???");
			combo.add(1, "???");
			combo.add(2, "???");
			FileConfiguration pConfig = YamlConfiguration.loadConfiguration(pFile);
			pConfig.set("User", p.getName());
			pConfig.set("Class", Default);
			pConfig.set("Race", Default);
			pConfig.set("Guilds", guilds);
			pConfig.set("Kills", Integer.valueOf(0));
			pConfig.set("Deaths", Integer.valueOf(0));

			pConfig.set("Counter", Integer.valueOf(1));
			pConfig.set("Combo", combo);

			// pConfig.set("Reader", Boolean[].class);
			/*
			 * pConfig.set("ObservationHakiLevel", Integer.valueOf(0));
			 * pConfig.set("ObservationHakiXP", Integer.valueOf(0));
			 * pConfig.set("ConquerorsHaki", Boolean.valueOf(false));
			 * pConfig.set("ConquerorHakiLevel", Integer.valueOf(0));
			 * pConfig.set("ConquerorHakiXP", Integer.valueOf(0));
			 */
			pConfig.save(pFile);
		} catch (Exception e) {
		}
}
 
开发者ID:MohibMirza,项目名称:RPGPlus,代码行数:38,代码来源:Datafiles.java

示例7: addKill

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public static void addKill(String p) {
	File pFile = new File(Main.getInstance().getDataFolder(), "Players/" + p.toLowerCase() + ".yml");
	FileConfiguration pConfig = YamlConfiguration.loadConfiguration(pFile);
	pConfig.set("Kills", Integer.valueOf(pConfig.getInt("Kills") + 1));
	try {
		pConfig.save(pFile);
	} catch (Exception e) {
	}
}
 
开发者ID:MohibMirza,项目名称:RPGPlus,代码行数:10,代码来源:Datafiles.java

示例8: addDeath

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public static void addDeath(String p) {
	File pFile = new File(Main.getInstance().getDataFolder(), "Players/" + p.toLowerCase() + ".yml");
	FileConfiguration pConfig = YamlConfiguration.loadConfiguration(pFile);
	pConfig.set("Deaths", Integer.valueOf(pConfig.getInt("Deaths") + 1));
	try {
		pConfig.save(pFile);
	} catch (Exception e) {
	}
}
 
开发者ID:MohibMirza,项目名称:RPGPlus,代码行数:10,代码来源:Datafiles.java

示例9: setPoints

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void setPoints(String p, int newAmount) {
	File pFile = new File(Main.getInstance().getDataFolder(), "Players/" + p.toLowerCase() + ".yml");
	FileConfiguration pConfig = YamlConfiguration.loadConfiguration(pFile);
	pConfig.set("Points", Integer.valueOf(newAmount));
	try {
		pConfig.save(pFile);
	} catch (Exception e) {
	}
}
 
开发者ID:MohibMirza,项目名称:RPGPlus,代码行数:10,代码来源:Datafiles.java

示例10: writeToConfig

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void writeToConfig() {
	FileConfiguration c = Main.getInstance().getConfig();
	c.set("ban_requests." + id + ".timeOpened", timeOpened);
	c.set("ban_requests." + id + ".timeClosed", timeClosed);
	c.set("ban_requests." + id + ".openerUUID", openerUUID);
	c.set("ban_requests." + id + ".closerUUID", closerUUID);
	c.set("ban_requests." + id + ".timeOpenedFormatted", timeOpenedFormatted);
	c.set("ban_requests." + id + ".timeClosedFormatted", timeClosedFormatted);
	c.set("ban_requests." + id + ".closed", closed);
	c.set("ban_requests." + id + ".accepted", accepted);
	c.set("ban_requests." + id + ".denied", denied);
	c.set("ban_requests." + id + ".banReason", banReason);
	c.set("ban_requests." + id + ".playerToBanUUID", playerToBanUUID);
	Main.getInstance().saveConfig();
}
 
开发者ID:JustBru00,项目名称:EpicBanRequests,代码行数:16,代码来源:BanRequest.java

示例11: takePoints

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void takePoints(String p, int amountTaken) {
	File pFile = new File(Main.getInstance().getDataFolder(), "Players/" + p.toLowerCase() + ".yml");
	FileConfiguration pConfig = YamlConfiguration.loadConfiguration(pFile);
	int PointsCurrent = pConfig.getInt("Points");
	if (PointsCurrent - amountTaken >= 0) {
		int newAmount = PointsCurrent - amountTaken;
		pConfig.set("Points", Integer.valueOf(newAmount));
	}
	try {
		pConfig.save(pFile);
	} catch (Exception e) {
	}
}
 
开发者ID:MohibMirza,项目名称:RPGPlus,代码行数:14,代码来源:Datafiles.java

示例12: saveUsers

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void saveUsers(){
	File userFile = new File(mainFolder, "AllowedUsers.yml");
	FileConfiguration config = new YamlConfiguration();
	for(Entry<String, Date> ent : allowedUsers.entrySet()){
		config.set(ent.getKey().replace(".", "_(dot)_"), ent.getValue());
	}
	try {
		config.save(userFile);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Kitt3120,项目名称:ViperBot,代码行数:13,代码来源:DDoSManager.java

示例13: incrementCounter

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public static void incrementCounter(String p) {
	File pFile = new File(Main.getInstance().getDataFolder(), "Players/" + p.toLowerCase() + ".yml");
	FileConfiguration pConfig = YamlConfiguration.loadConfiguration(pFile);
	pConfig.set("counter", Integer.valueOf(pConfig.getInt("counter") + 1));
	try {
		pConfig.save(pFile);
	} catch (Exception e) {
	}
}
 
开发者ID:MohibMirza,项目名称:RPGPlus,代码行数:10,代码来源:Datafiles.java

示例14: getConfig

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public FileConfiguration getConfig(){
	FileConfiguration config = new YamlConfiguration();
	File userFile = new File(mainFolder, "AllowedUsers.yml");
	if(userFile.exists()){
		try {
			config.load(userFile);
		} catch (IOException | InvalidConfigurationException e) {
			e.printStackTrace();
			config.set("Data", allowedUsers);
		}
	}
	return config;		
}
 
开发者ID:Kitt3120,项目名称:ViperBot,代码行数:14,代码来源:DDoSManager.java

示例15: addSignJoinGame

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public boolean addSignJoinGame(Location loc, String mapName) {
	if (SkyWarsReloaded.getMC().mapRegistered(mapName)) {
		String world = loc.getWorld().getName().toString();
		int x = loc.getBlockX();
		int y = loc.getBlockY();
		int z = loc.getBlockZ();
		GameSign gs = new GameSign(x, y, z, world, mapName);
		gameNumber = -1;
		File signJoinFile = new File(SkyWarsReloaded.get().getDataFolder(), "signJoinGames.yml");
		if (!signJoinFile.exists()) {
			SkyWarsReloaded.get().saveResource("signJoinGames.yml", false);
		}
		if (signJoinFile.exists()) {
			FileConfiguration storage = YamlConfiguration.loadConfiguration(signJoinFile);
			for (int i = 1; i < 1000; i++) {
				if (storage.getString("games." + i + ".map") == null) {
					gameNumber = i;
					break;
				}
			}
			storage.set("games." + gameNumber + ".x", x);
			storage.set("games." + gameNumber + ".y", y);
			storage.set("games." + gameNumber + ".z", z);
			storage.set("games." + gameNumber + ".world", world);
			storage.set("games." + gameNumber + ".map", mapName);
			try {
				storage.save(signJoinFile);
			} catch (IOException e) {
				e.printStackTrace();
			}
			signJoinGames.put(gameNumber, gs);
			createGame(gameNumber, gs);
			return true;
		} else {
			return false;
		}
		}
	return false;
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:40,代码来源:GameController.java


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