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


Java FileConfiguration.getInt方法代码示例

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


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

示例1: loadCommands

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
/**
 * Loads all of the startup commands from the plugin's configuration file.
 * @param plugin the StartupCommands plugin instance
 */
public static void loadCommands(StartupCommands plugin) {
	FileConfiguration config = plugin.getConfig();
		
		if (config.getConfigurationSection("commands") == null) {
			plugin.getLogger().info("There are no startup commands present.");
		} else {
			int delay = 0;

			for (String command : config.getConfigurationSection("commands").getKeys(false)) {
				delay = config.getInt("commands." + command + ".delay", 0);
				
				// Try to create the command
				try {
					plugin.getCommands().add(new Command(command, delay));
				} catch (IllegalArgumentException e) {
					plugin.getLogger().severe(e.getMessage());
				}
	 		}
		}
}
 
开发者ID:mattgd,项目名称:StartupCommands,代码行数:25,代码来源:Command.java

示例2: signJoinLoad

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void signJoinLoad() {
	 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);
    	 try {
	    	 for (String gameNumber : storage.getConfigurationSection("games.").getKeys(false)) {
	    		 String mapName = storage.getString("games." + gameNumber + ".map");
	    		 String world = storage.getString("games." + gameNumber + ".world");
	    		 if (mapName != null && world != null) {
	    			 GameSign gs = new GameSign(storage.getInt("games." + gameNumber + ".x"), storage.getInt("games." + gameNumber + ".y"), storage.getInt("games." + gameNumber + ".z"), world, mapName);
	    			 signJoinGames.put(Integer.valueOf(gameNumber), gs);
	    			 createGame(Integer.valueOf(gameNumber), gs);
	    		 }
	    	 }
    	 } catch (NullPointerException e) {
    	 }
     }
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:24,代码来源:GameController.java

示例3: read

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
/**
 * Get the data from config file.
 *
 * @param config the configuration file.
 */
public void read(FileConfiguration config) {

    // read type and time.
    banType = BanList.Type.valueOf(config.getString("ban-type"));
    banTime = config.getInt("ban-time", banTime);

    // convert the days into a date.
    String days = config.getString("ban-days");
    if (Objects.isNull(days) || Objects.equals(days, "0")) {
        banDate = null;
    } else {
        GregorianCalendar c = new GregorianCalendar();
        c.add(GregorianCalendar.DATE, Integer.parseInt(days));
        banDate = c.getTime();
    }

    tpsLimit = config.getInt("tps-limit", tpsLimit);

    broadcastBan = config.getBoolean("broadcast-ban");
    if (broadcastBan) {
        String message = config.getString("broadcast-message");
        broadcastMessage = ChatColor.translateAlternateColorCodes('&', message);
    }

}
 
开发者ID:Vrekt,项目名称:Arc-v2,代码行数:31,代码来源:ArcConfiguration.java

示例4: onEnable

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void onEnable()
{
    //ignore
    getLogger();
    String protocol;
    String name;
    String ip;
    int port;
    FileConfiguration config = getConfig();
    config.addDefault("settings.protocol", valueOf("TCP"));
    config.addDefault("settings.name", valueOf("minecraft"));
    config.addDefault("settings.ipaddress", valueOf("0.0.0.0"));
    config.addDefault("settings.port", 25565);
    config.options().copyDefaults(true);
    protocol = config.getString("settings.protocol");
    name = config.getString("settings.name");
    ip = config.getString("settings.ipaddress");
    port = config.getInt("settings.port");
    saveConfig();
    openPort(ip, port, name, protocol);
}
 
开发者ID:firestorm942,项目名称:upnp,代码行数:22,代码来源:autoupnp.java

示例5: initiateArenas

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

    if (!config.contains("arenas")) return;

    for (String name : config.getConfigurationSection("arenas").getKeys(false)) {
        try {
            String displayName = config.getString("arenas." + name + ".display-name");
            Integer displayOrder = config.getInt("arenas." + name + ".display-order");
            Location location1 = LocationUtils.getLocation(config.getString("arenas." + name + ".location1"));
            Location location2 = LocationUtils.getLocation(config.getString("arenas." + name + ".location2"));
            Arena arena = new Arena(name, displayName, displayOrder, location1, location2);
            this.arenas.put(name, arena);
        }
        catch (Exception e) {
            PracticePlugin.getInstance().getLogger().severe("Failed to load arena '" + name + "', stack trace below:");
            PracticePlugin.getInstance().getLogger().severe("------------------------------------------------------");
            e.printStackTrace();
            PracticePlugin.getInstance().getLogger().severe("------------------------------------------------------");
        }
    }
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:23,代码来源:ArenaManager.java

示例6: updateConfig

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
/**
 * Update the configuration file
 * 
 * @param currentVersion the version of the configuration file
 */
public void updateConfig(int currentVersion) {
	InputStream in = plugin.getResource("config.yml");
	try (InputStreamReader inReader = new InputStreamReader(in)) {
		FileConfiguration defaultConfig = YamlConfiguration.loadConfiguration(inReader);
		
		if (defaultConfig.getInt("version") == currentVersion) {
			return;
		}
		
		Set<String> newKeys = defaultConfig.getKeys(false);
		for (String key : plugin.getConfig().getKeys(false)) {
			if (key.equalsIgnoreCase("version")) {
				continue;
			}
			if (newKeys.contains(key)) {
				defaultConfig.set(key, plugin.getConfig().get(key));
			}
		}
		
		defaultConfig.save(new File(plugin.getDataFolder() + "/config.yml"));
	} catch (IOException e) { e.printStackTrace(); }
}
 
开发者ID:2008Choco,项目名称:DragonEggDrop,代码行数:28,代码来源:ConfigUtil.java

示例7: 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

示例8: getCrafts

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public ArrayList<CraftArray> getCrafts(){
   	ArrayList<CraftArray> craftlist = new ArrayList<CraftArray>();
   	try {
    	File craftfile = new File(plugin.getDataFolder(), "crafts.yml");
		craftfile.createNewFile();
		FileConfiguration craftconfig = YamlConfiguration.loadConfiguration(craftfile);
		if(craftconfig.isSet("Crafts")) {
			for(String craftpath : craftconfig.getConfigurationSection("Crafts").getKeys(false)) {
				craftpath = "Crafts." + craftpath;
				ArrayList<ItemStack> config_craft = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".craft");
				ArrayList<ItemStack> config_resultitems = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".result.items");
				ArrayList<Integer> config_resultprobs = (ArrayList<Integer>) craftconfig.getIntegerList(craftpath + ".result.probs");
				HashMap<ItemStack,Integer> config_result = new HashMap<ItemStack, Integer>();
				for(ItemStack resultitem : config_resultitems) {
					config_result.put(resultitem, config_resultprobs.get(config_resultitems.indexOf(resultitem)));
				}
				ArrayList<String> config_cmds = (ArrayList<String>) craftconfig.getStringList(craftpath + ".cmds");
				boolean config_redstonepower = craftconfig.getBoolean(craftpath + ".redstonepower");
				int config_experience = craftconfig.getInt(craftpath + ".experience");
				CraftArray specraft = new CraftArray(config_craft, config_result, config_cmds, config_redstonepower, config_experience);
				craftlist.add(specraft);
			}
			return craftlist;
		} else {
			return craftlist;
		}
   	} catch (Exception e) {
   		e.printStackTrace();
   		return craftlist;
   	}
   }
 
开发者ID:Slaymd,项目名称:CaulCrafting,代码行数:33,代码来源:CraftStorage.java

示例9: onEnable

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
@Override
public void onEnable() {
	FileConfiguration config = this.getConfig();
	config.options().copyDefaults(true);
	this.saveConfig();
	String pluginName = config.getString("debug.pluginName");
	int port = config.getInt("debug.socketPort");
	socketThread = new Thread(new SocketRunnable(port, pluginName, this.getDataFolder().getParentFile()));
	socketThread.start();
	this.getLogger().info("Enabled MCPluginDebugger(target: " + pluginName + ", port: " + port + ")");
}
 
开发者ID:syuchan1005,项目名称:MCPluginDebuggerforMC,代码行数:12,代码来源:MCPluginDebugger.java

示例10: signRemoved

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
@EventHandler
  public void signRemoved(BlockBreakEvent event) {
      Location blockLocation = event.getBlock().getLocation();
      World w = blockLocation.getWorld();
  	Block b = w.getBlockAt(blockLocation);
if(b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN_POST){
   	Sign sign = (Sign) b.getState();
   	String line1 = ChatColor.stripColor(sign.getLine(0));
	if (line1.equalsIgnoreCase(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', new Messaging.MessageFormatter().format("signJoinSigns.line1"))))) {
          	 String world = blockLocation.getWorld().getName().toString();
       		 int x = blockLocation.getBlockX();
       		 int y = blockLocation.getBlockY();
       		 int z = blockLocation.getBlockZ();
       		 File signJoinFile = new File(SkyWarsReloaded.get().getDataFolder(), "signJoinGames.yml");
       		 if (signJoinFile.exists()) {
       			FileConfiguration storage = YamlConfiguration.loadConfiguration(signJoinFile);
                  for (String gameNumber : storage.getConfigurationSection("games.").getKeys(false)) {
                  	String world1 = storage.getString("games." + gameNumber + ".world");
                  	int x1 = storage.getInt("games." + gameNumber + ".x");
                  	int y1 = storage.getInt("games." + gameNumber + ".y");
                  	int z1 = storage.getInt("games." + gameNumber + ".z");
                  	if (x1 == x && y1 == y && z1 == z && world.equalsIgnoreCase(world1)) {
                  		if (event.getPlayer().hasPermission("swr.signs")) {
                        		SkyWarsReloaded.getGC().removeSignJoinGame(gameNumber);
                        	} else {
                        		event.setCancelled(true);
                          	event.getPlayer().sendMessage(ChatColor.RED + "YOU DO NOT HAVE PERMISSION TO DESTROY SWR SIGNS");
                  		}
                  	}
             	 	} 
       		 }
           }
}
  }
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:35,代码来源:SignListener.java

示例11: MazeTask

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public MazeTask(Room parent, FileConfiguration conf, int taskNr) {
	super(parent, conf, taskNr);
	assert(period == 0);	// This task is not allowed to run multiple times -> period MUST be zero!
	this.type = TaskType.MAZE;
	// loading values for this Task type:
	String path = "tasks.task" + this.taskNr + ".";
	mazeMaterial = Material.getMaterial(conf.getString(path + "mazeMaterial").toUpperCase(Locale.ENGLISH)); // this is a lookup 'string' -> 'enum value'
	//mazeEntry =   BukkitUtil.toVector(conf.getVector(path + "entry"));
	//mazeExit  =   BukkitUtil.toVector(conf.getVector(path + "exit"));
	wayWidth  =	  conf.getInt(path + "wayWidth");
	wallWidth =	  conf.getInt(path + "wallWidth");
	wallHeight=	  conf.getInt(path + "wallHeight");
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:14,代码来源:MazeTask.java

示例12: EntitySpawnTask

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
/**Constructor, passes arguments to super class and loads special values from config.
 * @param parent	The Room this Task belongs to
 * @param conf		Given config file of this room has entries on tasks.
 * @param taskNr	Task number is needed to load keys correctly.
 */
public EntitySpawnTask(Room parent, FileConfiguration conf, int taskNr) {
	super(parent, conf, taskNr);
	this.type = TaskType.ENTITYSPAWN;
	
	// loading values for this Task type:
	String path = "tasks.task" + this.taskNr + ".";
	grp = new EntityGroup();
	grp.type = EntityType.valueOf(conf.getString( path + "entityType"));
	grp.count = 				  conf.getInt(    path + "count");
	//TODO: maxCount noch einbauen -> bei jedem Spawning z�hlen, bei Tod runterz�hlen
	grp.maxCount =				  conf.getInt(    path + "maxCount");
	grp.isTarget = 				  conf.getBoolean(path + "isTarget");
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:19,代码来源:EntitySpawnTask.java

示例13: getPendingRequests

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public static int getPendingRequests() {
	
	FileConfiguration c = Main.getInstance().getConfig();
	
	int pending = 0;
	
	for (int i = 0; i <= c.getInt("current_id"); i++) {
		if (!c.getBoolean("ban_requests." + i + ".closed")) {
			pending = pending + 1;
		}
	}
	
	return pending;
}
 
开发者ID:JustBru00,项目名称:EpicBanRequests,代码行数:15,代码来源:Main.java

示例14: getKills

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

示例15: getDeaths

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


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