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


Java YamlConfiguration.getInt方法代碼示例

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


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

示例1: onPlayerExpChange

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
@EventHandler
public void onPlayerExpChange(PlayerExpChangeEvent event){
	Player player = event.getPlayer();
	YamlConfiguration PlayerData = onLoadData(player.getName());
	if(PlayerData ==null)return;
	PlayerData.set("attribute.level", player.getLevel());
	onSaveData(player.getName(), PlayerData);
	if(Config.getConfig("extraExp.enabled").equals("true")){
		int playerWantedPoints = PlayerData.getInt("wanted.points");
		if(playerWantedPoints > 0){
			int exp = event.getAmount();
			int value = Integer.valueOf(Config.getConfig("extraExp.pointsValue").replaceAll("%", ""));
			PlayerData.set("attribute.level", player.getLevel());
			int addExp = Integer.valueOf(String.valueOf(exp*playerWantedPoints*value/100));
			event.setAmount(addExp + exp);
			if(getConfig().getBoolean("extraExp.message") == true)
			player.sendMessage(Message.getMsg("player.expMessage", String.valueOf(addExp), String.valueOf(exp), String.valueOf(exp+addExp)));
			onSaveData(player.getName(), PlayerData);
		}
	}
}
 
開發者ID:Saukiya,項目名稱:PVPAsWantedManager,代碼行數:22,代碼來源:PVPAsWantedManager.java

示例2: CheckAndDownloadPlugin

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public static void CheckAndDownloadPlugin() {
    if (ConfigMain.AutoUpdate == true) {
        try {
            // 整體獲取
            File NetworkerFile = new File(EscapeLag.MainThis.getDataFolder(), "networkerlog");
            DowloadFile("http://www.relatev.com/files/EscapeLag/NetWorker.yml", NetworkerFile);
            YamlConfiguration URLLog = YamlConfiguration.loadConfiguration(NetworkerFile);
            // 檢查插件並下載新版本
            EscapeLag.MainThis.getLogger().info("正在檢查新版本插件,請稍等...");
            int NewVersion = URLLog.getInt("UpdateVersion");
            int NowVersion = Integer.valueOf("%BUILD_NUMBER%");
            if (NewVersion > NowVersion) {
                EscapeLag.MainThis.getLogger().info("插件檢測到新版本 " + NewVersion + ",正在自動下載新版本插件...");
                DowloadFile("https://www.relatev.com/files/EscapeLag/EscapeLag.jar", EscapeLag.getPluginsFile());
                EscapeLag.MainThis.getLogger().info("插件更新版本下載完成!正在重啟服務器!");
                Bukkit.shutdown();
            } else {
                EscapeLag.MainThis.getLogger().info("EscapeLag插件工作良好,暫無新版本檢測更新。");
            }
            // 完成提示
            EscapeLag.MainThis.getLogger().info("全部網絡工作都讀取完畢了...");
        } catch (IOException ex) {
        }
    }
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:26,代碼來源:NetWorker.java

示例3: load

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public static FireCraftTableRecipe load(String name){
	 File f=new File(rs.getDataFolder()+File.separator+"SyntheticFormula"+File.separator+"FireCraftTable"+File.separator+name+".yml");
	 if(!f.exists())return null;
	 YamlConfiguration recipe=YamlConfiguration.loadConfiguration(f);
	 HashMap<Character,ItemStack> materials=new HashMap<>();
	 char c=' ';
	 for(String s:recipe.getStringList(name+".shape"))
		 for(char temp:s.toCharArray())
			 if(temp!=' '&&temp!=c){
				 c=temp;
				 materials.put(c, recipe.getItemStack(name+".material."+c));
			 }
	 ItemStack[] product=new ItemStack[4];
	 for(int i=0;i<3;i++)
		 product[i]=recipe.getItemStack(name+".product."+i);
	 
	 return new FireCraftTableRecipe(recipe.getInt(name+".time"),recipe.getDouble(name+".temperature"),recipe.getInt(name+".maxTime"), name,
			 recipe.getStringList(name+".shape"), materials, product);
}
 
開發者ID:SchoolUniform,項目名稱:RealSurvival,代碼行數:20,代碼來源:FireCraftTableRecipe.java

示例4: loadData

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public void loadData() {
	file = new PluginFile(main, "data", FileType.YAML);
	YamlConfiguration config = file.returnYaml();
	
	checkDefaults();
	
	// Supplydrops related.
	for (String worldString : config.getStringList("supply-drops.enabled-worlds")) {
		supplyDropWorlds.add(Bukkit.getWorld(worldString));
	}
	
	// Radiation related.
	this.defaultRadiationDamage = config.getDouble("radiation.default-damage");
	this.stormRadiationDamage = config.getDouble("radiation.storm-damage");
	this.waterRadiationDamage = config.getDouble("radiation.water-damage");
	this.radiationDamageDelay = config.getInt("radiation.seconds-delay");
}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:18,代碼來源:DataManager.java

示例5: isJailPlayer

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public Boolean isJailPlayer(Player player){
       YamlConfiguration PlayerData = PVPAsWantedManager.onLoadData(player.getName());
       if(PlayerData == null) return false;
       int playerJaiTimes = PlayerData.getInt("jail.times");
       if(playerJaiTimes > 0){
   		return true;
       }
       return false;
}
 
開發者ID:Saukiya,項目名稱:PVPAsWantedManager,代碼行數:10,代碼來源:JailManager.java

示例6: surrendPlayer

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public static void surrendPlayer(Player player){
       YamlConfiguration PlayerData = PVPAsWantedManager.onLoadData(player.getName());
       int value = PlayerData.getInt("jail.times");
	int times = PlayerData.getInt("wanted.points")*Integer.valueOf(Config.getConfig("timeTick.jailPlayerTimes").replace("min", "").replace("m", ""));
	if(value > 0){
		player.sendMessage(Message.getMsg("player.isAlreadyInJailMessage"));
		return;
	}
	if(times <1){
		player.sendMessage(Message.getMsg("player.notSurrendMessage"));
		return;
	}
	Location location = player.getLocation();
       int playerX = location.getBlockX();
       int playerY = location.getBlockY();
       int playerZ = location.getBlockZ();
       String playerWorld = location.getWorld().getName();
       PlayerData.set("attribute.X", playerX);
       PlayerData.set("attribute.Y", playerY);
       PlayerData.set("attribute.Z", playerZ);
       PlayerData.set("attribute.World", playerWorld);
       PlayerData.set("wanted.points", Integer.valueOf(0));
       PlayerData.set("jail.times", times);
       PVPAsWantedManager.onDeleteList(player.getName(), "WantedList");
       PVPAsWantedManager.onCreateList(player.getName(), "JailedList");
       PVPAsWantedManager.onSaveData(player.getName(), PlayerData);
	JailManager.playerJoinJail(player,location);
	player.sendMessage(Message.getMsg("player.surrendMessage",String.valueOf(times)));
}
 
開發者ID:Saukiya,項目名稱:PVPAsWantedManager,代碼行數:30,代碼來源:JailManager.java

示例7: onSetJailTimes

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
@PlayerCommand(cmd="setTime",arg = " <player> <times>")
public void onSetJailTimes(CommandSender sender,String args[]){
	if(sender instanceof Player){
		if(!sender.hasPermission("pvpaswantedmanager." + args[0])) {
			sender.sendMessage(Message.getMsg("player.noPermissionMessage"));
			return;
		}
	}
	if(args.length <= 2 ){
		sender.sendMessage(Message.getMsg("admin.setTimeCorrectionsMessage"));
		return;
	}
	if(!Pattern.compile("[-0-9]*").matcher(args[2]).matches()){
		sender.sendMessage(Message.getMsg("admin.wrongFormatMessage"));
		return;
	}
	String playerName = args[1];
       YamlConfiguration PlayerData = PVPAsWantedManager.onLoadData(playerName);
       if(PlayerData == null){
       	sender.sendMessage(Message.getMsg("admin.playerNullMessage"));
       	return;
       }
	int times = PlayerData.getInt("jail.times");
	int value = times + Integer.valueOf(args[2]);
	PlayerData.set("jail.times", value);
	onSaveData(playerName, PlayerData);
	sender.sendMessage(Message.getMsg("admin.EditPlayerJailTimesMessage", playerName,String.valueOf(value)));
	
}
 
開發者ID:Saukiya,項目名稱:PVPAsWantedManager,代碼行數:30,代碼來源:PVPAsWantedManager.java

示例8: onQuitJail

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
@PlayerCommand(cmd="quitJail",arg = " <player>")
public void onQuitJail(CommandSender sender,String args[]){
	if(sender instanceof Player){
		if(!sender.hasPermission("pvpaswantedmanager." + args[0])) {
			sender.sendMessage(Message.getMsg("player.noPermissionMessage"));
			return;
		}
	}
	if(args.length <=1){
		sender.sendMessage(Message.getMsg("admin.quitJailCorrectionsMessage"));
		return;
	}
	String playerName = args[1];
	if(isPlayerOnline(playerName)){
		Player player = Bukkit.getPlayer(playerName);
		YamlConfiguration PlayerData = onLoadData(player.getName());
		if(PlayerData ==null)return;
		int value = PlayerData.getInt("jail.times");
		if(value == 0){
			sender.sendMessage(Message.getMsg("admin.playerIsNotInJailMessage"));
			return;
		}
		PlayerData.set("jail.times", Integer.valueOf(0));
        PlayerData.set("attribute.X", Integer.valueOf(0));
        PlayerData.set("attribute.Y", Integer.valueOf(0));
        PlayerData.set("attribute.Z", Integer.valueOf(0));
        PlayerData.set("attribute.World", String.valueOf("world"));
		JailManager.playerQuitJail(player);
		onDeleteList(player.getName(),"JailedList");
        PVPAsWantedManager.onSaveData(player.getName(), PlayerData);
		sender.sendMessage(Message.getMsg("admin.quitJailPlayerMessage", args[1]));
		player.sendMessage(Message.getMsg("player.jailedCancelMessage"));
	}else{
		sender.sendMessage(Message.getMsg("admin.playerOfflineMessage"));
	}
}
 
開發者ID:Saukiya,項目名稱:PVPAsWantedManager,代碼行數:37,代碼來源:PVPAsWantedManager.java

示例9: onSetPoint

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
@PlayerCommand(cmd="setPoint",arg = " <player> <value>")
public void onSetPoint(CommandSender sender,String args[]){
	if(sender instanceof Player){
		if(!sender.hasPermission("pvpaswantedmanager." + args[0])) {
			sender.sendMessage(Message.getMsg("player.noPermissionMessage"));
			return;
		}
	}
	if(args.length <3){
		sender.sendMessage(Message.getMsg("admin.wrongFormatMessage"));
		return;
	}
	
	YamlConfiguration PlayerData = onLoadData(args[1]);
	if(PlayerData == null){
		sender.sendMessage(Message.getMsg("admin.playerNullMessage"));
		return;
	}
	if(!Pattern.compile("[0-9]*").matcher(args[2]).matches()){
		sender.sendMessage(Message.getMsg("admin.wrongFormatMessage"));
		return;
	}
	int value = Integer.valueOf(args[2]);
	if(PlayerData.getInt("wanted.points")==0&& value > 0){
		PVPAsWantedManager.onCreateList(args[1], "WantedList");
	}else if(PlayerData.getInt("wanted.points")>0 && value ==0){
		PVPAsWantedManager.onDeleteList(args[1], "WantedList");
	}
	PlayerData.set("wanted.points", value);
	PVPAsWantedManager.onSaveData(args[1], PlayerData);
	sender.sendMessage(Message.getMsg("admin.EditPlayerDataMessage"));
	
}
 
開發者ID:Saukiya,項目名稱:PVPAsWantedManager,代碼行數:34,代碼來源:PVPAsWantedManager.java

示例10: reloadConfigs

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
static void reloadConfigs()
  {
      YamlConfiguration mainConfig = load(configFolder + "/" + MAIN_CONFIG);

WORLDGUARD_DEFAULT = mainConfig.getBoolean("worldguard_flag_enable"); 
PRISON_PICK_FLAG = new StateFlag("prison-picks", WORLDGUARD_DEFAULT);

      EXPLOSIVE_COLOR = ChatColor.getByChar(mainConfig.getString("explosive_color").charAt(1));
      PICK_O_PLENTY_COLOR = ChatColor.getByChar(mainConfig.getString("pick_o_plenty_color").charAt(1));
      FAKE_EXPLOSIVE_PICK_O_PLENTY_COLOR = ChatColor.getByChar(mainConfig.getString("fake_xpop_color").charAt(1));

      CHAT_SUCCESS_COLOR = ChatColor.getByChar(mainConfig.getString("success_color").charAt(1));
      CHAT_FAIL_COLOR = ChatColor.getByChar(mainConfig.getString("fail_color").charAt(1));
      CHAT_PICK_BREAK = ChatColor.getByChar(mainConfig.getString("pick_break_color").charAt(1));
      CHAT_EXPLOSIVE_REPAIR = ChatColor.getByChar(mainConfig.getString("explosive_repair_msg").charAt(1));
      CHAT_POP_REPAIR = ChatColor.getByChar(mainConfig.getString("pop_repair_msg").charAt(1));
      CHAT_XPOP_REPAIR = ChatColor.getByChar(mainConfig.getString("xpop_repair_msg").charAt(1));

      COAL_PRIORITY = mainConfig.getInt("coal_priority");
      IRON_PRIORITY = mainConfig.getInt("iron_priority");
      REDSTONE_PRIORITY = mainConfig.getInt("redstone_priority");
      LAPIS_PRIORITY = mainConfig.getInt("lapis_priority");
      GOLD_PRIORITY = mainConfig.getInt("gold_priority");
      QUARTZ_PRIORITY = mainConfig.getInt("quartz_priority");
      DIAMOND_PRIORITY = mainConfig.getInt("diamond_priority");
      DIAMOND_BLOCK_PRIORITY = mainConfig.getInt("diamond_block_priority");
      EMERALD_PRIORITY = mainConfig.getInt("emerald_priority");
      
  }
 
開發者ID:ThePhilderbeast,項目名稱:prisonPicks,代碼行數:30,代碼來源:Config.java

示例11: loadPlayersFromDisk

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public void loadPlayersFromDisk() {
	file = new PluginFile(main, "players", FileType.YAML);
	YamlConfiguration config = file.returnYaml();

	for (String key : config.getConfigurationSection("").getKeys(false)) {

		// Only convert online players to PlayerObject and add to Map.
		// for (Player online : Bukkit.getOnlinePlayers()) {
		UUID uuid = UUID.fromString(key);

		// if (!online.getUniqueId().equals(uuid))
		// continue;

		PlayerObject p = new PlayerObject(uuid);
		PKStates state = PKStates.getStateByString(config.getString(key + ".pk-state"));
		boolean inGeckRange = config.getBoolean(key + ".in-geck-range");
		long lastPlayerKill = config.getLong(key + ".last-player-kill");
		int playerKills = config.getInt(key + ".kills");
		
		p.setPkState(state);
		p.setPlayerKills(playerKills);
		p.setPlayerInRangeOfGeck(inGeckRange);
		p.setLastPlayerKillTime(lastPlayerKill);

		mtPlayers.put(uuid, p);
		// }
	}

}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:30,代碼來源:PlayerManager.java

示例12: loadSupplyData

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public void loadSupplyData() {
	file = new PluginFile(main, "supplyDrops", FileType.YAML);
	YamlConfiguration config = file.returnYaml();

	// Supply content
	// If no content for supply drops is set in config, set a default one to
	// avoid a NPE.
	if (config.getConfigurationSection("supply-drops.items") == null) {
		main.getLogger().info("No Supplydrop content found. Setting defaults.");
		String path = "supply-drops.items.0";
		config.set(path + ".material", "STONE");
		config.set(path + ".chance", 75);
		config.set(path + ".amount", 32);
		file.save(config);
	}

	for (String key : config.getConfigurationSection("supply-drops.items").getKeys(false)) {

		Material itemMaterial = Material
				.valueOf(config.getString("supply-drops.items." + key + ".material").toUpperCase());
		int itemChance = config.getInt("supply-drops.items." + key + ".chance");
		int itemAmount = config.getInt("supply-drops.items." + key + ".amount");

		supplyContent.add(new SupplyDropContent(itemMaterial, itemChance, itemAmount));
	}

	// Supply drops
	for (String s : config.getStringList("supply-drops.objects")) {
		Location loc = StringUtilities.stringToLocation(s);

		loc.getBlock().setType(Material.CHEST);
		Chest chest = (Chest) loc.getBlock().getState();
		supplyDrops.add(new SupplyDropObject(loc, chest, chest.getInventory()));
	}
}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:36,代碼來源:SupplyDropManager.java

示例13: onLoad

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
@Override
public void onLoad() {
    try {
        Path data = getDataFolder().toPath();
        Path resolve = data.resolve("config.yml");
        if (!resolve.toFile().exists()) {
            getLogger().warning("Configuration file does not exist! Recreating!");
            List<String> lines = new ArrayList<>();
            lines.add("# RManager configuration file");
            lines.add("");
            lines.add("# Server ID, used for identification purposes");
            lines.add("server-id: 'foo_bar'");
            lines.add("");
            lines.add("# Database information, points to a valid Redis server");
            lines.add("# Database-id selects the database number provided, if unsure, leave as 0");
            lines.add("hostname: 'localhost'");
            lines.add("password: 'password'");
            lines.add("port: 6379");
            lines.add("database-id: 0");
            if (!data.toFile().exists())
                Files.createDirectory(data);
            Files.write(resolve, lines, StandardOpenOption.CREATE);
        }
        getLogger().info("Loading configuration file...");
        YamlConfiguration configuration = YamlConfiguration.loadConfiguration(resolve.toFile());
        String serverID = configuration.getString("server-id");
        String hostname = configuration.getString("hostname");
        String password = configuration.getString("password");
        int port = configuration.getInt("port");
        int dbID = configuration.getInt("database-id");
        getLogger().info("Success! Initializing database as '" + serverID + "'! (" + hostname + ":" + port + "/" + dbID + ")");
        Database.initDatabase(serverID, hostname, password, port, dbID);
    } catch (Exception e) {
        throw new RuntimeException("Error loading configuration: ", e);
    }
}
 
開發者ID:RedEpicness,項目名稱:RManager,代碼行數:37,代碼來源:Main.java

示例14: sanitizeConfig

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
private void sanitizeConfig(YamlConfiguration c) {
    int lineStartsAt = c.getInt(CONFIG_LINE_STARTS_AT);
    if (lineStartsAt < 0 || lineStartsAt > 1) setDefaultConfig(CONFIG_LINE_STARTS_AT);

    String clicking = c.getString(CONFIG_CLICKING);
    if (clicking == null ||
            !(clicking.equalsIgnoreCase("true") ||
            clicking.equalsIgnoreCase("false") ||
            clicking.equalsIgnoreCase("auto"))) setDefaultConfig(CONFIG_CLICKING);
}
 
開發者ID:Deltik,項目名稱:SignEdit,代碼行數:11,代碼來源:Configuration.java

示例15: onJoinJail

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
@PlayerCommand(cmd="joinJail",arg = " <player> <times>")
public void onJoinJail(CommandSender sender,String args[]){
	if(sender instanceof Player){
		if(!sender.hasPermission("pvpaswantedmanager." + args[0])) {
			sender.sendMessage(Message.getMsg("player.noPermissionMessage"));
			return;
		}
	}
	if(args.length <=2 ){
		sender.sendMessage(Message.getMsg("admin.joinJailCorrectionsMessage"));
		return;
	}
	String playerName = args[1];
	if(!Pattern.compile("[0-9]*").matcher(args[2]).matches()){
		sender.sendMessage(Message.getMsg("admin.wrongFormatMessage"));
		return;
	}
	int times = Integer.valueOf(args[2]);
	if(isPlayerOnline(playerName)){
		Player player = Bukkit.getPlayer(playerName);
        YamlConfiguration PlayerData = PVPAsWantedManager.onLoadData(player.getName());
		if(PlayerData ==null)return;
        int value = PlayerData.getInt("jail.times");
		if(value > 0){
			sender.sendMessage(Message.getMsg("admin.playerIsAlreadyInJailMessage"));
			return;
		}
		Location location = player.getLocation();
        int playerX = location.getBlockX();
        int playerY = location.getBlockY();
        int playerZ = location.getBlockZ();
        String playerWorld = location.getWorld().getName();
        PlayerData.set("attribute.X", playerX);
        PlayerData.set("attribute.Y", playerY);
        PlayerData.set("attribute.Z", playerZ);
        PlayerData.set("attribute.World", playerWorld);
        PlayerData.set("jail.times", times);
        onDeleteList(player.getName(), "WantedList");
        onCreateList(player.getName(), "JailedList");
        onSaveData(player.getName(), PlayerData);
		JailManager.playerJoinJail(player,location);
		sender.sendMessage(Message.getMsg("admin.joinJailPlayerMessage", args[1],args[2]));
		player.sendMessage(Message.getMsg("player.jailedJoinMessage",args[2]));
	}else{
		sender.sendMessage(Message.getMsg("admin.playerOfflineMessage"));
	}
}
 
開發者ID:Saukiya,項目名稱:PVPAsWantedManager,代碼行數:48,代碼來源:PVPAsWantedManager.java


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