Exemple #1
0
 public int getPartyFeatureUnlockLevel(PartyFeature partyFeature) {
   return config.getInt(
       "Party.Leveling."
           + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "")
           + "_UnlockLevel",
       0);
 }
Exemple #2
0
  @Override
  protected boolean validateKeys() {
    // Validate all the settings!
    List<String> reason = new ArrayList<String>();

    /* General Settings */
    if (getSaveInterval() <= 0) {
      reason.add("General.Save_Interval should be greater than 0!");
    }

    /* MySQL Settings */
    for (PoolIdentifier identifier : PoolIdentifier.values()) {
      if (getMySQLMaxConnections(identifier) <= 0) {
        reason.add(
            "MySQL.Database.MaxConnections."
                + StringUtils.getCapitalized(identifier.toString())
                + " should be greater than 0!");
      }
      if (getMySQLMaxPoolSize(identifier) <= 0) {
        reason.add(
            "MySQL.Database.MaxPoolSize."
                + StringUtils.getCapitalized(identifier.toString())
                + " should be greater than 0!");
      }
    }

    /* Mob Healthbar */
    if (getMobHealthbarTime() == 0) {
      reason.add(
          "Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value.");
    }

    /* Scoreboards */
    if (getRankScoreboardTime() != -1 && getRankScoreboardTime() <= 0) {
      reason.add("Scoreboard.Types.Rank.Display_Time should be greater than 0, or -1!");
    }

    if (getStatsScoreboardTime() != -1 && getStatsScoreboardTime() <= 0) {
      reason.add("Scoreboard.Types.Stats.Display_Time should be greater than 0, or -1!");
    }

    if (getTopScoreboardTime() != -1 && getTopScoreboardTime() <= 0) {
      reason.add("Scoreboard.Types.Top.Display_Time should be greater than 0, or -1!");
    }

    if (getInspectScoreboardTime() != -1 && getInspectScoreboardTime() <= 0) {
      reason.add("Scoreboard.Types.Inspect.Display_Time should be greater than 0, or -1!");
    }

    if (getSkillScoreboardTime() != -1 && getSkillScoreboardTime() <= 0) {
      reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
    }

    if (getSkillLevelUpTime() != -1 && getSkillScoreboardTime() <= 0) {
      reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
    }

    if (!(getRankUseChat() || getRankUseBoard())) {
      reason.add("Either Board or Print in Scoreboard.Types.Rank must be true!");
    }

    if (!(getTopUseChat() || getTopUseBoard())) {
      reason.add("Either Board or Print in Scoreboard.Types.Top must be true!");
    }

    if (!(getStatsUseChat() || getStatsUseBoard())) {
      reason.add("Either Board or Print in Scoreboard.Types.Stats must be true!");
    }

    if (!(getInspectUseChat() || getInspectUseBoard())) {
      reason.add("Either Board or Print in Scoreboard.Types.Inspect must be true!");
    }

    /* Database Purging */
    if (getPurgeInterval() < -1) {
      reason.add("Database_Purging.Purge_Interval should be greater than, or equal to -1!");
    }

    if (getOldUsersCutoff() != -1 && getOldUsersCutoff() <= 0) {
      reason.add("Database_Purging.Old_User_Cutoff should be greater than 0 or -1!");
    }

    /* Hardcore Mode */
    if (getHardcoreDeathStatPenaltyPercentage() < 0.01
        || getHardcoreDeathStatPenaltyPercentage() > 100) {
      reason.add(
          "Hardcore.Death_Stat_Loss.Penalty_Percentage only accepts values from 0.01 to 100!");
    }

    if (getHardcoreVampirismStatLeechPercentage() < 0.01
        || getHardcoreVampirismStatLeechPercentage() > 100) {
      reason.add("Hardcore.Vampirism.Leech_Percentage only accepts values from 0.01 to 100!");
    }

    /* Items */
    if (getChimaeraUseCost() < 1 || getChimaeraUseCost() > 64) {
      reason.add("Items.Chimaera_Wing.Use_Cost only accepts values from 1 to 64!");
    }

    if (getChimaeraRecipeCost() < 1 || getChimaeraRecipeCost() > 9) {
      reason.add("Items.Chimaera_Wing.Recipe_Cost only accepts values from 1 to 9!");
    }

    if (getChimaeraItem() == null) {
      reason.add("Items.Chimaera_Wing.Item_Name is invalid!");
    }

    /* Particles */
    if (getLevelUpEffectsTier() < 1) {
      reason.add("Particles.LevelUp_Tier should be at least 1!");
    }

    /* PARTY SETTINGS */
    if (getAutoPartyKickInterval() < -1) {
      reason.add("Party.AutoKick_Interval should be at least -1!");
    }

    if (getAutoPartyKickTime() < 0) {
      reason.add("Party.Old_Party_Member_Cutoff should be at least 0!");
    }

    if (getPartyShareBonusBase() <= 0) {
      reason.add("Party.Sharing.ExpShare_bonus_base should be greater than 0!");
    }

    if (getPartyShareBonusIncrease() < 0) {
      reason.add("Party.Sharing.ExpShare_bonus_increase should be at least 0!");
    }

    if (getPartyShareBonusCap() <= 0) {
      reason.add("Party.Sharing.ExpShare_bonus_cap should be greater than 0!");
    }

    if (getPartyShareRange() <= 0) {
      reason.add("Party.Sharing.Range should be greater than 0!");
    }

    if (getPartyXpCurveMultiplier() < 1) {
      reason.add("Party.Leveling.Xp_Curve_Modifier should be at least 1!");
    }

    for (PartyFeature partyFeature : PartyFeature.values()) {
      if (getPartyFeatureUnlockLevel(partyFeature) < 0) {
        reason.add(
            "Party.Leveling."
                + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "")
                + "_UnlockLevel should be at least 0!");
      }
    }

    /* Inspect command distance */
    if (getInspectDistance() <= 0) {
      reason.add("Commands.inspect.Max_Distance should be greater than 0!");
    }

    if (getTreeFellerThreshold() <= 0) {
      reason.add("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!");
    }

    if (getDetonatorItem() == null) {
      reason.add("Skills.Mining.Detonator_Item is invalid!");
    }

    if (getRepairAnvilMaterial() == null) {
      reason.add("Skills.Repair.Anvil_Type is invalid!!");
    }

    if (getSalvageAnvilMaterial() == null) {
      reason.add("Skills.Repair.Salvage_Anvil_Type is invalid!");
    }

    if (getRepairAnvilMaterial() == getSalvageAnvilMaterial()) {
      reason.add("Cannot use the same item for Repair and Salvage anvils!");
    }

    if (getTamingCOTWMaterial(EntityType.WOLF) == null) {
      reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Material is invalid!!");
    }

    if (getTamingCOTWMaterial(EntityType.OCELOT) == null) {
      reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Material is invalid!!");
    }

    if (getTamingCOTWMaterial(EntityType.HORSE) == null) {
      reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Material is invalid!!");
    }

    if (getTamingCOTWCost(EntityType.WOLF) <= 0) {
      reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Amount should be greater than 0!");
    }

    if (getTamingCOTWCost(EntityType.OCELOT) <= 0) {
      reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Amount should be greater than 0!");
    }

    if (getTamingCOTWCost(EntityType.HORSE) <= 0) {
      reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Amount should be greater than 0!");
    }

    if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
      reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Summon_Amount should be greater than 0!");
    }

    if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
      reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Summon_Amount should be greater than 0!");
    }

    if (getTamingCOTWAmount(EntityType.HORSE) <= 0) {
      reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Summon_Amount should be greater than 0!");
    }

    return noErrorsInConfig(reason);
  }