org.bukkit.configuration.file.FileConfiguration#getInt ( )源码实例Demo

下面列出了org.bukkit.configuration.file.FileConfiguration#getInt ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MineTinker   文件: ArmorListener.java
private void expCalculation(boolean isBlocking, ItemStack tool, EntityDamageEvent event, Player player) {
	//Armor should not get Exp when successfully blocking
	if(isBlocking && !ToolType.SHIELD.contains(tool.getType()) && ToolType.ARMOR.contains(tool.getType())) return;
	//Shield should not get Exp when not successfully blocking when getting attacked
	if(!isBlocking && player.equals(event.getEntity()) && ToolType.SHIELD.contains(tool.getType())) return;
	FileConfiguration config = MineTinker.getPlugin().getConfig();
	int amount = config.getInt("ExpPerEntityHit");

	if (config.getBoolean("EnableDamageExp")) {
		amount = (int) Math.round(event.getDamage());
	}

	if (config.getBoolean("DisableExpFromFalldamage", false)
			&& event.getCause() == EntityDamageEvent.DamageCause.FALL) {
		return;
	}

	modManager.addExp(player, tool, amount);
}
 
源代码2 项目: MineTinker   文件: Beheading.java
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%DARK_GRAY%");
	config.addDefault("MaxLevel", 10);
	config.addDefault("SlotCost", 2);
	config.addDefault("PercentagePerLevel", 10);  //= 100% at Level 10
	config.addDefault("DropSpawnEggChancePerLevel", 0);

	config.addDefault("EnchantCost", 25);
	config.addDefault("Enchantable", true);

	config.addDefault("Recipe.Enabled", false);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.WITHER_SKELETON_SKULL);

	this.percentagePerLevel = config.getInt("PercentagePerLevel", 10);
	this.dropSpawneggChancePerLevel = config.getInt("DropSpawnEggChancePerLevel", 0);
	this.description = this.description.replace("%chance", String.valueOf(this.percentagePerLevel));
}
 
源代码3 项目: NametagEdit   文件: ConverterTask.java
@Override
public void run() {
    FileConfiguration config = plugin.getHandler().getConfig();
    String connectionString = "jdbc:mysql://" + config.getString("MySQL.Hostname") + ":" + config.getInt("MySQL.Port") + "/" + config.getString("MySQL.Database");
    try (Connection connection = DriverManager.getConnection(connectionString, config.getString("MySQL.Username"), config.getString("MySQL.Password"))) {
        if (databaseToFile) {
            convertDatabaseToFile(connection);
        } else {
            convertFilesToDatabase(connection);
        }
    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        new BukkitRunnable() {
            @Override
            public void run() {
                plugin.getHandler().reload();
            }
        }.runTask(plugin);
    }
}
 
源代码4 项目: MineTinker   文件: Timber.java
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("MaxLevel", 1);
	config.addDefault("SlotCost", 2);
	config.addDefault("Color", "%GREEN%");
	config.addDefault("MaximumBlocksPerSwing", 2000); //-1 to disable it

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "LLL");
	config.addDefault("Recipe.Middle", "LEL");
	config.addDefault("Recipe.Bottom", "LLL");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("L", Material.OAK_WOOD.name());
	recipeMaterials.put("E", Material.EMERALD.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.EMERALD);
	this.maxBlocks = config.getInt("MaximumBlocksPerSwing", 2000);
	this.maxBlocks = (this.maxBlocks == -1) ? Integer.MAX_VALUE : this.maxBlocks;
}
 
源代码5 项目: SkyWarsReloaded   文件: ProjectileSpleefEvent.java
public ProjectileSpleefEvent(GameMap map, boolean b) {
	this.gMap = map;
	this.enabled = b;
	File dataDirectory = SkyWarsReloaded.get().getDataFolder();
       File mapDataDirectory = new File(dataDirectory, "mapsData");

       if (!mapDataDirectory.exists() && !mapDataDirectory.mkdirs()) {
       	return;
       }
       
       File mapFile = new File(mapDataDirectory, gMap.getName() + ".yml");
    if (mapFile.exists()) {
    	eventName = "ProjectileSpleefEvent";
    	slot = 13;
    	material = new ItemStack(Material.EGG, 1);
        FileConfiguration fc = YamlConfiguration.loadConfiguration(mapFile);
        this.min = fc.getInt("events." + eventName + ".minStart");
        this.max = fc.getInt("events." + eventName + ".maxStart");
        this.length = fc.getInt("events." + eventName + ".length");
        this.chance = fc.getInt("events." + eventName + ".chance");
        this.title = fc.getString("events." + eventName + ".title");
        this.subtitle = fc.getString("events." + eventName + ".subtitle");
        this.startMessage = fc.getString("events." + eventName + ".startMessage");
        this.endMessage = fc.getString("events." + eventName + ".endMessage");
        this.announceEvent = fc.getBoolean("events." + eventName + ".announceTimer");
        this.repeatable = fc.getBoolean("events." + eventName + ".repeatable");
		this.eggsToAdd = fc.getInt("events." + eventName + ".eggsAddedToInventory");
    }
}
 
源代码6 项目: Survival-Games   文件: PlayerStatsSession.java
public void calcPoints(){
    FileConfiguration c = SettingsManager.getInstance().getConfig();
    int kpoints = kills * c.getInt("stats.points.kill");
    int ppoints = pppoints * c.getInt("stats.points.position");
    int kspoints = ksbon;

    points = kpoints + ppoints + kspoints + ksbon;
    //System.out.println(player+"  "+kpoints +" "+ppoints+" "+kspoints);

    if(position == 1){
        points = points + c.getInt("stats.points.win");
    }

}
 
源代码7 项目: MapManager   文件: MapManagerPlugin.java
void reload() {
	FileConfiguration config = getConfig();

	ALLOW_VANILLA = config.getBoolean("allowVanilla", ALLOW_VANILLA);
	FORCED_OFFSET = config.getInt("forcedOffset", FORCED_OFFSET);
	CHECK_DUPLICATES = config.getBoolean("checkDuplicates", CHECK_DUPLICATES);
	CACHE_DATA = getConfig().getBoolean("cacheData", CACHE_DATA);
	Sender.DELAY = getConfig().getInt("sender.delay", Sender.DELAY);
	Sender.AMOUNT = getConfig().getInt("sender.amount", Sender.AMOUNT);
	Sender.ALLOW_QUEUE_BYPASS = getConfig().getBoolean("sender.allowQueueBypass", Sender.ALLOW_QUEUE_BYPASS);
}
 
源代码8 项目: MineTinker   文件: Directing.java
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("MaxLevel", 1);
	config.addDefault("SlotCost", 1);
	config.addDefault("WorksOnXP", true);
	config.addDefault("MinimumLevelToGetXP", 1); //Modifier-Level to give Player XP
	config.addDefault("WorkInPVP", true);
	config.addDefault("Color", "%GRAY%");

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "ECE");
	config.addDefault("Recipe.Middle", "CIC");
	config.addDefault("Recipe.Bottom", "ECE");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("C", Material.COMPASS.name());
	recipeMaterials.put("E", Material.ENDER_PEARL.name());
	recipeMaterials.put("I", Material.IRON_BLOCK.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.COMPASS);

	this.workInPVP = config.getBoolean("WorkInPVP", true);
	this.workOnXP = config.getBoolean("WorksOnXP", true);
	this.minimumLevelForXP = config.getInt("MinimumLevelToGetXP", 1);
}
 
源代码9 项目: MineTinker   文件: Glowing.java
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%YELLOW%");
	config.addDefault("MaxLevel", 3);
	config.addDefault("SlotCost", 1);
	config.addDefault("Duration", 200); //ticks INTEGER (20 ticks ~ 1 sec)
	config.addDefault("DurationMultiplier", 1.4); //Duration * (Multiplier^Level) DOUBLE

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "GGG");
	config.addDefault("Recipe.Middle", "GEG");
	config.addDefault("Recipe.Bottom", "GGG");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("G", Material.GLOWSTONE_DUST.name());
	recipeMaterials.put("E", Material.ENDER_EYE.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.GLOWSTONE);

	this.duration = config.getInt("Duration", 200);
	this.durationMultiplier = config.getDouble("DurationMultiplier", 1.4);

	this.description = this.description.replaceAll("%durationmin", String.valueOf(this.duration / 20.0d))
			.replaceAll("%durationmax", String.valueOf(Math.round(this.duration * Math.pow(this.durationMultiplier, this.getMaxLvl() - 1)) / 20.0d));
}
 
源代码10 项目: MineTinker   文件: Shrouded.java
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%DARK_GREEN%");
	config.addDefault("MaxLevel", 2);
	config.addDefault("RadiusPerLevel", 1.5);
	config.addDefault("SlotCost", 1);
	config.addDefault("Duration", 120); //ticks INTEGER (20 ticks ~ 1 sec)
	config.addDefault("DurationMultiplier", 1.1); //Duration * (Multiplier^Level) DOUBLE

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", " D ");
	config.addDefault("Recipe.Middle", "DTD");
	config.addDefault("Recipe.Bottom", " D ");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("T", Material.TNT.name());
	recipeMaterials.put("D", Material.DRAGON_BREATH.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.DRAGON_BREATH);

	this.duration = config.getInt("Duration", 120);
	this.durationMultiplier = config.getDouble("DurationMultiplier", 1.1);
	this.radiusPerLevel = config.getDouble("RadiusPerLevel", 1.0);

	this.description = this.description.replace("%durationmin", String.valueOf(this.duration / 20))
			.replace("%durationmax", String.valueOf(Math.round(this.duration * Math.pow(this.durationMultiplier, getMaxLvl() - 1) * 5) / 100.0));
}
 
源代码11 项目: MineTinker   文件: KineticPlating.java
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%GRAY%");
	config.addDefault("MaxLevel", 5);
	config.addDefault("SlotCost", 1);
	config.addDefault("Amount", 20); //How much XP should be dropped when triggered

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "PIP");
	config.addDefault("Recipe.Middle", "III");
	config.addDefault("Recipe.Bottom", "PIP");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("I", Material.IRON_BLOCK.name());
	recipeMaterials.put("P", Material.PHANTOM_MEMBRANE.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.IRON_BLOCK);

	this.amount = config.getInt("Amount", 1);
	this.description = this.description.replace("%amount", String.valueOf(this.amount));
}
 
源代码12 项目: MineTinker   文件: ExtraModifier.java
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%WHITE%");
	config.addDefault("ExtraModifierGain", 1); //How much Slots should be added per Nether-Star

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "   ");
	config.addDefault("Recipe.Middle", " N ");
	config.addDefault("Recipe.Bottom", "   ");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("N", Material.NETHER_STAR.name());

	config.addDefault("Recipe.Materials", recipeMaterials);
	config.addDefault("OverrideLanguagesystem", false);


	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.NETHER_STAR);

	this.slotCost = 0;

	this.gain = config.getInt("ExtraModifierGain", 1);
	this.description = this.description.replace("%amount", String.valueOf(this.gain));
}
 
源代码13 项目: SkyWarsReloaded   文件: ArrowRainEvent.java
public ArrowRainEvent(GameMap map, boolean b) {
	this.gMap = map;
	this.enabled = b;
	File dataDirectory = SkyWarsReloaded.get().getDataFolder();
       File mapDataDirectory = new File(dataDirectory, "mapsData");

       if (!mapDataDirectory.exists() && !mapDataDirectory.mkdirs()) {
       	return;
       }
       
       File mapFile = new File(mapDataDirectory, gMap.getName() + ".yml");
    if (mapFile.exists()) {
    	eventName = "ArrowRainEvent";
    	slot = 2;
    	material = new ItemStack(Material.ARROW, 1);
        FileConfiguration fc = YamlConfiguration.loadConfiguration(mapFile);
        this.min = fc.getInt("events." + eventName + ".minStart");
        this.max = fc.getInt("events." + eventName + ".maxStart");
        this.length = fc.getInt("events." + eventName + ".length");
        this.chance = fc.getInt("events." + eventName + ".chance");
        this.title = fc.getString("events." + eventName + ".title");
        this.subtitle = fc.getString("events." + eventName + ".subtitle");
        this.startMessage = fc.getString("events." + eventName + ".startMessage");
        this.endMessage = fc.getString("events." + eventName + ".endMessage");
        this.announceEvent = fc.getBoolean("events." + eventName + ".announceTimer");
        this.repeatable = fc.getBoolean("events." + eventName + ".repeatable");
        this.per2Tick = fc.getInt("events." + eventName + ".spawnPer2Tick");
       }
}
 
源代码14 项目: uSkyBlock   文件: CommonLevelLogic.java
CommonLevelLogic(uSkyBlock plugin, FileConfiguration config) {
    this.plugin = plugin;
    this.config = config;
    activateNetherAtLevel = config.getInt("nether.activate-at.level", 100);
    pointsPerLevel = config.getInt("general.pointsPerLevel");
    load();
}
 
源代码15 项目: SkyWarsReloaded   文件: DoubleDamageEvent.java
public DoubleDamageEvent(GameMap map, boolean b) {
	this.gMap = map;
	this.enabled = b;
	File dataDirectory = SkyWarsReloaded.get().getDataFolder();
       File mapDataDirectory = new File(dataDirectory, "mapsData");

       if (!mapDataDirectory.exists() && !mapDataDirectory.mkdirs()) {
       	return;
       }
       
       File mapFile = new File(mapDataDirectory, gMap.getName() + ".yml");
    if (mapFile.exists()) {
    	eventName = "DoubleDamageEvent";
    	slot = 15;
    	material = new ItemStack(Material.DIAMOND_AXE, 1);
        FileConfiguration fc = YamlConfiguration.loadConfiguration(mapFile);
        this.min = fc.getInt("events." + eventName + ".minStart");
        this.max = fc.getInt("events." + eventName + ".maxStart");
        this.length = fc.getInt("events." + eventName + ".length");
        this.chance = fc.getInt("events." + eventName + ".chance");
        this.title = fc.getString("events." + eventName + ".title");
        this.subtitle = fc.getString("events." + eventName + ".subtitle");
        this.startMessage = fc.getString("events." + eventName + ".startMessage");
        this.endMessage = fc.getString("events." + eventName + ".endMessage");
        this.announceEvent = fc.getBoolean("events." + eventName + ".announceTimer");
        this.repeatable = fc.getBoolean("events." + eventName + ".repeatable");
    }
}
 
源代码16 项目: BedwarsRel   文件: BedwarsRel.java
public Integer getRespawnProtectionTime() {
  FileConfiguration config = this.getConfig();
  if (config.contains("respawn-protection") && config.isInt("respawn-protection")) {
    return config.getInt("respawn-protection");
  }
  return 0;
}
 
源代码17 项目: MineTinker   文件: Poisonous.java
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%DARK_GREEN%");
	config.addDefault("MaxLevel", 5);
	config.addDefault("SlotCost", 1);
	config.addDefault("Duration", 120); //ticks INTEGER (20 ticks ~ 1 sec)
	config.addDefault("DurationMultiplier", 1.1); //Duration * (Multiplier^Level) DOUBLE
	config.addDefault("EffectAmplifier", 2); //per Level (Level 1 = 0, Level 2 = 2, Level 3 = 4, ...) INTEGER
	config.addDefault("DropRottenMeatIfPoisoned", true);
	config.addDefault("EffectHealsPlayer", true);

	config.addDefault("EnchantCost", 20);
	config.addDefault("Enchantable", true);

	config.addDefault("Recipe.Enabled", false);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.ROTTEN_FLESH);

	this.duration = config.getInt("Duration", 120);
	this.durationMultiplier = config.getDouble("DurationMultiplier", 1.1);
	this.effectAmplifier = config.getInt("EffectAmplifier", 2);
	this.dropPoisonedMeat = config.getBoolean("DropRottenMeatIfPoisoned", true);
	this.effectHealsPlayer = config.getBoolean("EffectHealsPlayer", true);

	this.description = this.description.replace("%duration", String.valueOf(this.duration))
			.replace("%multiplier", String.valueOf(this.durationMultiplier));
}
 
源代码18 项目: Bukkit-Connect   文件: ConnectSettingsImpl.java
public ConnectSettingsImpl(FileConfiguration fileConfiguration) {
	this.outboundIp = fileConfiguration.getString("settings.address");
	this.outboundPort = fileConfiguration.getInt("settings.port");
	this.username = fileConfiguration.getString("settings.credentials.username");
	this.password = fileConfiguration.getString("settings.credentials.password");
}
 
源代码19 项目: NovaGuilds   文件: ResourceManagerRegionImpl.java
@Override
public List<NovaRegion> load() {
	final List<NovaRegion> list = new ArrayList<>();

	for(File regionFile : getFiles()) {
		FileConfiguration configuration = loadConfiguration(regionFile);
		String guildString = configuration.getString("name");
		String[] homeSplit = StringUtils.split(configuration.getString("center"), ',');
		String worldString = homeSplit[0];
		World world = plugin.getServer().getWorld(worldString);

		if(world == null) {
			LoggerUtils.info("Failed loading region for guild " + guildString + ", world does not exist.");
			continue;
		}

		int x = Integer.parseInt(homeSplit[1]);
		int y = Integer.parseInt(homeSplit[2]);
		int z = Integer.parseInt(homeSplit[3]);
		Location center = new Location(world, x, y, z);
		NovaGuild guild = ((YamlStorageImpl) getStorage()).guildMap.get(guildString);

		if(guild == null) {
			LoggerUtils.error("There's no guild matching region " + guildString);
			continue;
		}

		NovaRegion region = new NovaRegionImpl(UUID.randomUUID());

		int size = configuration.getInt("size");
		Location corner1 = center.clone().add(size, 0, size);
		Location corner2 = center.clone().subtract(size, 0, size);

		region.setAdded();
		region.setCorner(0, corner1);
		region.setCorner(1, corner2);
		region.setWorld(center.getWorld());

		guild.addRegion(region);
		region.setUnchanged();
		list.add(region);
	}

	return list;
}
 
源代码20 项目: SkyWarsReloaded   文件: LevelManager.java
public void loadWinSounds() {
    winSoundList.clear();
    File soundFile = new File(SkyWarsReloaded.get().getDataFolder(), "winsounds.yml");

    if (!soundFile.exists()) {
    	if (SkyWarsReloaded.getNMS().getVersion() < 9) {
            	SkyWarsReloaded.get().saveResource("winsounds18.yml", false);
            	File sf = new File(SkyWarsReloaded.get().getDataFolder(), "winsounds18.yml");
            	if (sf.exists()) {
            		sf.renameTo(new File(SkyWarsReloaded.get().getDataFolder(), "winsounds.yml"));
            	}
    	} else {
        	SkyWarsReloaded.get().saveResource("winsounds.yml", false);
    	}
    }

    if (soundFile.exists()) {
        FileConfiguration storage = YamlConfiguration.loadConfiguration(soundFile);

        if (storage.getConfigurationSection("sounds") != null) {
        	for (String key: storage.getConfigurationSection("sounds").getKeys(false)) {
        		String sound = storage.getString("sounds." + key + ".sound");
            	String name = storage.getString("sounds." + key + ".displayName");
            	int volume = storage.getInt("sounds." + key + ".volume");
            	int pitch = storage.getInt("sounds." + key + ".pitch");
            	String material = storage.getString("sounds." + key + ".icon");
            	int level = storage.getInt("sounds." + key + ".level");
            	int cost = storage.getInt("sounds." + key + ".cost");
            	boolean isCustom = storage.getBoolean("sounds." + key + ".isCustomSound");
            	
            	Material mat = Material.matchMaterial(material);
            	if (mat != null) {
            		if (!isCustom) {
            			try {
            				Sound s = Sound.valueOf(sound);
            				if (s != null) {
                				winSoundList.add(new SoundItem(key, sound, name, level, cost, volume, pitch, mat, isCustom));
            				}
            			} catch (IllegalArgumentException e) {
            				SkyWarsReloaded.get().getServer().getLogger().info(sound + " is not a valid sound in winsounds.yml");
            			}
            		} else {
            			winSoundList.add(new SoundItem(key, sound, name, level, cost, volume, pitch, mat, isCustom));
            		}
            			
                } else {
                	SkyWarsReloaded.get().getServer().getLogger().info(mat + " is not a valid Material in winsounds.yml");
                }
        	}
        }
    }
    Collections.<SoundItem>sort(winSoundList);
}