MainConfig.java 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  1. package com.gmail.nossr50.config;
  2. import com.gmail.nossr50.datatypes.MobHealthbarType;
  3. import com.gmail.nossr50.datatypes.party.PartyFeature;
  4. import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
  5. import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
  6. import com.gmail.nossr50.mcMMO;
  7. import com.gmail.nossr50.party.PartyManager;
  8. import com.gmail.nossr50.util.StringUtils;
  9. import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
  10. import org.bukkit.Material;
  11. import org.bukkit.block.data.BlockData;
  12. import org.bukkit.entity.EntityType;
  13. import java.util.ArrayList;
  14. import java.util.List;
  15. @ConfigSerializable
  16. public class MainConfig extends ConfigValidated {
  17. public static final String METRICS = "Metrics";
  18. public static final String BSTATS = "bstats";
  19. public static final String GENERAL = "General";
  20. public static final String RETRO_MODE = "RetroMode";
  21. public static final String ENABLED = "Enabled";
  22. public static final String LOCALE = "Locale";
  23. public static final String EN_US = "en_us";
  24. public static final String SHOW_PROFILE_LOADED = "Show_Profile_Loaded";
  25. public static final String DONATE_MESSAGE = "Donate_Message";
  26. public static final String MCMMO = "mcmmo";
  27. public static final String DATABASE_PREFIX = MCMMO + "_";
  28. public static final String COMMANDS = "Commands";
  29. public static final String SAVE_INTERVAL = "Save_Interval";
  30. public static final String STATS = "Stats";
  31. public static final String STATS_TRACKING = STATS + "_Tracking";
  32. public static final String UPDATE_CHECK = "Update_Check";
  33. public static final String PREFER_BETA = "Prefer_Beta";
  34. public static final String VERBOSE_LOGGING = "Verbose_Logging";
  35. public static final String PARTYCHAT = "partychat";
  36. public static final String CHAT_PREFIX_FORMAT = "Chat_Prefix_Format";
  37. public static final String NAME = "Name";
  38. public static final String GOLD_LEADER_NAME = "Gold_Leader_" + NAME;
  39. public static final String USE_DISPLAY_NAMES = "Use_Display_" + NAME + "s";
  40. public static final String ALLY = "_Ally";
  41. public static final String ADMINCHAT = "adminchat";
  42. public static final String GENERIC = "Generic";
  43. public static final String MATCH_OFFLINE_PLAYERS = "Match_OfflinePlayers";
  44. public static final String DATABASE = "Database";
  45. public static final String COOLDOWN = "Cooldown";
  46. public static final String PLAYER_COOLDOWN = "Player_" + COOLDOWN;
  47. public static final String LEVEL_UP = "LevelUp_";
  48. public static final String SOUND = "Sound";
  49. public static final String LEVEL_UP_SOUNDS = "LevelUp_Sounds";
  50. public static final String REFRESH_CHUNKS = "Refresh_Chunks";
  51. public static final String MOB_HEALTHBAR = "Mob_Healthbar";
  52. public static final String DISPLAY_TYPE = "Display_Type";
  53. public static final String HEARTS = "HEARTS";
  54. public static final String DISPLAY_TIME = "Display_Time";
  55. public static final String SCOREBOARD = "ConfigScoreboard";
  56. public static final String USE_SCOREBOARDS = "UseScoreboards";
  57. public static final String POWER = "Power_";
  58. public static final String POWER_LEVEL_TAGS = POWER + "Level_Tags";
  59. public static final String KEEP = "Keep";
  60. public static final String ALLOW_KEEP = "Allow_" + KEEP;
  61. public static final String TIPS_AMOUNT = "Tips_Amount";
  62. public static final String SHOW_STATS_AFTER_LOGIN = "Show_" + STATS + "_After_Login";
  63. public static final String RAINBOWS = "Rainbows";
  64. public static final String ABILITY_NAMES = "Ability_" + NAME + "s";
  65. public static final String TYPES = "Types";
  66. public static final String RANK = "Rank";
  67. public static final String PRINT = "Print";
  68. public static final String BOARD = "Board";
  69. public static final String TOP = "Top";
  70. public static final String INSPECT = "Inspect";
  71. public static final String SKILL = "Skill";
  72. public static final String TIME = "Time";
  73. public static final String PURGING = "_Purging";
  74. public static final String PURGE_INTERVAL = "Purge_Interval";
  75. public static final String OLD_USER_CUTOFF = "Old_User_Cutoff";
  76. public static final String BACKUPS = "Backups";
  77. public static final String KEEP_LAST_24_HOURS = KEEP + ".Last_24_Hours";
  78. public static final String DAILY_LAST_WEEK = "Daily_Last_Week";
  79. public static final String WEEKLY_PAST_MONTHS = "Weekly_Past_Months";
  80. public static final String MY_SQL = "MySQL";
  81. public static final String TABLE_PREFIX = "TablePrefix";
  82. public static final String USER_NAME = "User_" + NAME;
  83. public static final String SERVER = "Server";
  84. public static final String PORT = "Port";
  85. public static final String ADDRESS = "Address";
  86. public static final String LOCALHOST = "localhost";
  87. public static final String USER_PASSWORD = "User_Password";
  88. public static final String MAX_CONNECTIONS = "MaxConnections";
  89. public static final String MAX_POOL_SIZE = "MaxPoolSize";
  90. public static final String SSL = "SSL";
  91. public static final String HARDCORE = "Hardcore";
  92. public static final String DEATH_STAT_LOSS = "Death_Stat_Loss";
  93. public static final String PENALTY_PERCENTAGE = "Penalty_Percentage";
  94. public static final String LEVEL_THRESHOLD = "Level_Threshold";
  95. public static final String VAMPIRISM = "Vampirism";
  96. public static final String LEECH_PERCENTAGE = "Leech_Percentage";
  97. public static final String ITEMS = "Items";
  98. public static final String CHIMAERA_WING = "Chimaera_Wing";
  99. public static final String USE_COST = "Use_Cost";
  100. public static final String RECIPE_COST = "Recipe_Cost";
  101. public static final String ITEM = "Item_";
  102. public static final String FEATHER = "Feather";
  103. public static final String PREVENT = "Prevent_";
  104. public static final String PREVENT_USE_UNDERGROUND = PREVENT + "Use_Underground";
  105. public static final String USE_BED_SPAWN = "Use_Bed_Spawn";
  106. public static final String WARMUP = "Warmup";
  107. public static final String RECENTLY_HURT = "RecentlyHurt_";
  108. public static final String PARTICLES = "Particles";
  109. public static final String ACTIVATION = "Activation";
  110. public static final String ABILITY_ACTIVATION = "Ability_" + ACTIVATION;
  111. public static final String ABILITY_DEACTIVATION = "Ability_Deactivation";
  112. public static final String BLEED = "Bleed";
  113. public static final String DODGE = "Dodge";
  114. public static final String FLUX = "Flux";
  115. public static final String GREATER_IMPACT = "Greater_Impact";
  116. public static final String CALL_OF_THE_WILD = "Call_of_the_Wild";
  117. public static final String TIER = "Tier";
  118. public static final String LARGE_FIREWORKS = "LargeFireworks";
  119. public static final String PARTY = "Party";
  120. public static final String FRIENDLY_FIRE = "FriendlyFire";
  121. public static final String MAX_SIZE = "MaxSize";
  122. public static final String AUTO_KICK_INTERVAL = "AutoKick_Interval";
  123. public static final String OLD_PARTY_MEMBER_CUTOFF = "Old_Party_Member_Cutoff";
  124. public static final String SHARING = "Sharing";
  125. public static final String SHARING_EXP_SHARE_BONUS_BASE = SHARING + "ExpShare_bonus_base";
  126. public static final String EXP_SHARE_BONUS_INCREASE = "ExpShare_bonus_increase";
  127. public static final String EXP_SHARE_BONUS_CAP = "ExpShare_bonus_cap";
  128. public static final String RANGE = "Range";
  129. public static final String LEVELING = "Leveling";
  130. public static final String LEVEL_CAP = "Level_Cap";
  131. public static final String XP_CURVE_MODIFIER = "Xp_Curve_Modifier";
  132. public static final String NEAR_MEMBERS_NEEDED = "Near_Members_Needed";
  133. public static final String INFORM_ALL_PARTY_MEMBERS_ON_LEVEL_UP = "Inform_All_Party_Members_On_LevelUp";
  134. public static final String UNLOCK_LEVEL = "_UnlockLevel";
  135. public static final String PTP = "ptp";
  136. public static final String ACCEPT_REQUIRED = "Accept_Required";
  137. public static final String REQUEST_TIMEOUT = "Request_Timeout";
  138. public static final String WORLD_BASED_PERMISSIONS = "World_Based_Permissions";
  139. public static final String INSPECT1 = "inspect";
  140. public static final String MAX_DISTANCE = "Max_Distance";
  141. public static final String SKILLS = "Skills";
  142. public static final String URL_LINKS = "URL_Links";
  143. public static final String ABILITIES = "Abilities";
  144. public static final String MESSAGES = "Messages";
  145. public static final String ONLY_ACTIVATE_WHEN_SNEAKING = "Only_Activate_When_Sneaking";
  146. public static final String LEVEL_GATE_ABILITIES = "Level_Gate_Abilities";
  147. public static final String COOLDOWNS = "Cooldowns";
  148. public static final String MAX_SECONDS = "Max_Seconds";
  149. public static final String TOOLS = "Tools";
  150. public static final String DURABILITY_LOSS = "Durability_Loss";
  151. public static final String LIMITS = "Limits";
  152. public static final String TREE_FELLER = "Tree_Feller_";
  153. public static final String TREE_FELLER_THRESHOLD = TREE_FELLER + "Threshold";
  154. public static final String DOUBLE_DROPS = "Double_Drops";
  155. public static final String AXES = "Axes";
  156. public static final String TRUNCATE = "Truncate";
  157. public static final String FOR_PVP = "_For_PVP";
  158. public static final String FOR_PVE = "_For_PVE";
  159. public static final String ACROBATICS = "Acrobatics";
  160. public static final String PREVENT_AFK = PREVENT + "AFK_";
  161. public static final String WOODCUTTING = "Woodcutting";
  162. public static final String SOUNDS = "Sounds";
  163. public static final String MAX_TRIES_AT_SAME_LOCATION = "Max_Tries_At_Same_Location";
  164. public static final String HERBALISM = "Herbalism";
  165. public static final String TAMING = "Taming";
  166. public static final String CALL_OF_THE_WILD1 = "Call_Of_The_Wild";
  167. public static final String SUMMON_AMOUNT = "Summon_Amount";
  168. public static final String SUMMON_LENGTH = "Summon_Length";
  169. public static final String SUMMON_MAX_AMOUNT = "Summon_Max_Amount";
  170. public static final String AMOUNT = "Amount";
  171. public static final String MATERIAL = "Material";
  172. public static final String REPAIR = "Repair";
  173. public static final String CONFIRM_REQUIRED = "Confirm_Required";
  174. public static final String ANVIL = "Anvil_";
  175. public static final String ANVIL_MATERIAL = ANVIL + "Material";
  176. public static final String IRON_BLOCK = "IRON_BLOCK";
  177. public static final String ANVIL_USE = ANVIL + "Use_";
  178. public static final String ANVIL_PLACED = ANVIL + "Placed_";
  179. public static final String SALVAGE = "Salvage";
  180. public static final String UNARMED = "Unarmed";
  181. public static final String BLOCK_CRACKER = "Block_Cracker";
  182. public static final String SMOOTH_BRICK_TO_CRACKED_BRICK = "SmoothBrick_To_CrackedBrick";
  183. public static final String PICKUP_DISABLED_FULL_INVENTORY = "Pickup_Disabled_Full_Inventory";
  184. public static final String AS = "_As_";
  185. public static final String MINING = "Mining";
  186. public static final String DETONATOR = "Detonator_";
  187. public static final String FLINT_AND_STEEL = "FLINT_AND_STEEL";
  188. public static final String FISHING = "Fishing";
  189. public static final String LURE_MODIFIER = "Lure_Modifier";
  190. public static final String EXTRA_FISH = "Extra_Fish";
  191. public static final String OVERRIDE_VANILLA_TREASURES = "Override_Vanilla_Treasures";
  192. public static final String DROPS = "Drops_";
  193. public static final String ALCHEMY = "Alchemy";
  194. public static final String PREVENT_HOPPER_TRANSFER_BOTTLES = PREVENT + "Hopper_Transfer_Bottles";
  195. public static final String PREVENT_HOPPER_TRANSFER_INGREDIENTS = PREVENT + "Hopper_Transfer_Ingredients";
  196. public static final String FOR_HOPPERS = "_for_Hoppers";
  197. public static final String XP_AFTER_TELEPORT = "XP_After_Teleport_";
  198. public static final String LIGHTNING = "_Lightning";
  199. public static final String GOLD_BLOCK = "GOLD_BLOCK";
  200. public static final String PICKAXE = "_Pickaxe";
  201. public static final String EXP_SHARE_BONUS_BASE = "ExpShare_bonus_base";
  202. public MainConfig() {
  203. //super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "config.yml", true);
  204. super("main", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
  205. }
  206. /**
  207. * This grabs an instance of this config class from the Config Manager
  208. * This method is deprecated and will be removed in the future
  209. * @see mcMMO#getConfigManager()
  210. * @return the instance of this config
  211. * @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
  212. */
  213. @Deprecated
  214. public static MainConfig getInstance() {
  215. return mcMMO.getConfigManager().getMainConfig();
  216. }
  217. @Override
  218. public void unload() {
  219. //do nothing
  220. }
  221. /**
  222. * The version of this config
  223. *
  224. * @return
  225. */
  226. @Override
  227. public double getConfigVersion() {
  228. return 1;
  229. }
  230. @Override
  231. public List<String> validateKeys() {
  232. // Validate all the settings!
  233. List<String> reason = new ArrayList<String>();
  234. /* General Settings */
  235. if (getSaveInterval() <= 0) {
  236. reason.add(GENERAL + SAVE_INTERVAL + " should be greater than 0!");
  237. }
  238. /* MySQL Settings */
  239. /*for (SQLDatabaseManager.PoolIdentifier identifier : SQLDatabaseManager.PoolIdentifier.values()) {
  240. if (getMySQLMaxConnections(identifier) <= 0) {
  241. reason.add(MY_SQL + "." + DATABASE + "." + MAX_CONNECTIONS + "." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
  242. }
  243. if (getMySQLMaxPoolSize(identifier) <= 0) {
  244. reason.add(MY_SQL + "." + DATABASE + "." + MAX_POOL_SIZE + "." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
  245. }
  246. }*/
  247. /* Mob Healthbar */
  248. if (getMobHealthbarTime() == 0) {
  249. reason.add(MOB_HEALTHBAR + "." + DISPLAY_TIME + " cannot be 0! Set to -1 to disable or set a valid value.");
  250. }
  251. /* Scoreboards */
  252. /*if (getRankScoreboardTime() != -1 && getRankScoreboardTime() <= 0) {
  253. reason.add("ConfigScoreboard.Types.Rank.Display_Time should be greater than 0, or -1!");
  254. }
  255. if (getStatsScoreboardTime() != -1 && getStatsScoreboardTime() <= 0) {
  256. reason.add("ConfigScoreboard.Types.Stats.Display_Time should be greater than 0, or -1!");
  257. }
  258. if (getTopScoreboardTime() != -1 && getTopScoreboardTime() <= 0) {
  259. reason.add("ConfigScoreboard.Types.Top.Display_Time should be greater than 0, or -1!");
  260. }
  261. if (getInspectScoreboardTime() != -1 && getInspectScoreboardTime() <= 0) {
  262. reason.add("ConfigScoreboard.Types.Inspect.Display_Time should be greater than 0, or -1!");
  263. }
  264. if (getSkillScoreboardTime() != -1 && getSkillScoreboardTime() <= 0) {
  265. reason.add("ConfigScoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
  266. }
  267. if (getSkillLevelUpTime() != -1 && getSkillScoreboardTime() <= 0) {
  268. reason.add("ConfigScoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
  269. }
  270. if (!(getRankUseChat() || getRankUseBoard())) {
  271. reason.add("Either Board or Print in ConfigScoreboard.Types.Rank must be true!");
  272. }
  273. if (!(getTopUseChat() || getTopUseBoard())) {
  274. reason.add("Either Board or Print in ConfigScoreboard.Types.Top must be true!");
  275. }
  276. if (!(getStatsUseChat() || getStatsUseBoard())) {
  277. reason.add("Either Board or Print in ConfigScoreboard.Types.Stats must be true!");
  278. }
  279. if (!(getInspectUseChat() || getInspectUseBoard())) {
  280. reason.add("Either Board or Print in ConfigScoreboard.Types.Inspect must be true!");
  281. }*/
  282. /* Hardcore Mode */
  283. if (getHardcoreDeathStatPenaltyPercentage() < 0.01 || getHardcoreDeathStatPenaltyPercentage() > 100) {
  284. reason.add(HARDCORE + "." + DEATH_STAT_LOSS + "." + PENALTY_PERCENTAGE + " only accepts values from 0.01 to 100!");
  285. }
  286. if (getHardcoreVampirismStatLeechPercentage() < 0.01 || getHardcoreVampirismStatLeechPercentage() > 100) {
  287. reason.add(HARDCORE + "." + VAMPIRISM + "." + LEECH_PERCENTAGE + " only accepts values from 0.01 to 100!");
  288. }
  289. /* Items */
  290. if (getChimaeraUseCost() < 1 || getChimaeraUseCost() > 64) {
  291. reason.add(ITEMS + "." + CHIMAERA_WING + "." + USE_COST + " only accepts values from 1 to 64!");
  292. }
  293. if (getChimaeraRecipeCost() < 1 || getChimaeraRecipeCost() > 9) {
  294. reason.add(ITEMS + "." + CHIMAERA_WING + "." + RECIPE_COST + " only accepts values from 1 to 9!");
  295. }
  296. if (getChimaeraItem() == null) {
  297. reason.add(ITEMS + "." + CHIMAERA_WING + "." + ITEM + NAME + " is invalid!");
  298. }
  299. /* Particles */
  300. if (getLevelUpEffectsTier() < 1) {
  301. reason.add(PARTICLES + "." + LEVEL_UP + "Tier should be at least 1!");
  302. }
  303. /* PARTY SETTINGS */
  304. /*if (getAutoPartyKickInterval() < -1) {
  305. reason.add(PARTY + "." + AUTO_KICK_INTERVAL + " should be at least -1!");
  306. }
  307. if (getAutoPartyKickTime() < 0) {
  308. reason.add(PARTY + "." + OLD_PARTY_MEMBER_CUTOFF + " should be at least 0!");
  309. }
  310. if (getPartyShareBonusBase() <= 0) {
  311. reason.add(PARTY + "." + SHARING_EXP_SHARE_BONUS_BASE + " should be greater than 0!");
  312. }
  313. if (getPartyShareBonusIncrease() < 0) {
  314. reason.add(PARTY + "." + SHARING + "." + EXP_SHARE_BONUS_INCREASE + " should be at least 0!");
  315. }
  316. if (getPartyShareBonusCap() <= 0) {
  317. reason.add(PARTY + "." + SHARING + "." + EXP_SHARE_BONUS_CAP + " should be greater than 0!");
  318. }
  319. if (getPartyShareRange() <= 0) {
  320. reason.add(PARTY + "." + SHARING + "." + RANGE + " should be greater than 0!");
  321. }*/
  322. /*if (getPartyXpCurveMultiplier() < 1) {
  323. reason.add(PARTY + "." + LEVELING + "." + XP_CURVE_MODIFIER + " should be at least 1!");
  324. }
  325. for (PartyFeature partyFeature : PartyFeature.values()) {
  326. if (PartyManager. < 0) {
  327. reason.add(PARTY + "." + LEVELING + "." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel should be at least 0!");
  328. }
  329. }*/
  330. /* Inspect command distance */
  331. if (getInspectDistance() <= 0) {
  332. reason.add(COMMANDS + "." + INSPECT1 + "." + MAX_DISTANCE + " should be greater than 0!");
  333. }
  334. if (getTreeFellerThreshold() <= 0) {
  335. reason.add(ABILITIES + "." + LIMITS + "." + TREE_FELLER_THRESHOLD + " should be greater than 0!");
  336. }
  337. if (getFishingLureModifier() < 0) {
  338. reason.add(ABILITIES + "." + FISHING + "." + LURE_MODIFIER + " should be at least 0!");
  339. }
  340. if (getDetonatorItem() == null) {
  341. reason.add(SKILLS + "." + MINING + "." + DETONATOR + "Item is invalid!");
  342. }
  343. if (getRepairAnvilMaterial() == null) {
  344. reason.add(SKILLS + "." + REPAIR + "." + ANVIL + "Type is invalid!!");
  345. }
  346. if (getSalvageAnvilMaterial() == null) {
  347. reason.add(SKILLS + "." + REPAIR + "." + SALVAGE + "_" + ANVIL + "Type is invalid!");
  348. }
  349. if (getRepairAnvilMaterial() == getSalvageAnvilMaterial()) {
  350. reason.add("Cannot use the same item for " + REPAIR + " and " + SALVAGE + " anvils!");
  351. }
  352. if (getTamingCOTWMaterial(EntityType.WOLF) == null) {
  353. reason.add(SKILLS + "." + TAMING + "." + CALL_OF_THE_WILD1 + ".Wolf." + ITEM + "Material is invalid!!");
  354. }
  355. if (getTamingCOTWMaterial(EntityType.OCELOT) == null) {
  356. reason.add(SKILLS + "." + TAMING + "." + CALL_OF_THE_WILD1 + ".Ocelot." + ITEM + "Material is invalid!!");
  357. }
  358. if (getTamingCOTWMaterial(EntityType.HORSE) == null) {
  359. reason.add(SKILLS + "." + TAMING + "." + CALL_OF_THE_WILD1 + ".Horse." + ITEM + "Material is invalid!!");
  360. }
  361. if (getTamingCOTWCost(EntityType.WOLF) <= 0) {
  362. reason.add(SKILLS + "." + TAMING + "." + CALL_OF_THE_WILD1 + ".Wolf." + ITEM + "Amount should be greater than 0!");
  363. }
  364. if (getTamingCOTWCost(EntityType.OCELOT) <= 0) {
  365. reason.add(SKILLS + "." + TAMING + "." + CALL_OF_THE_WILD1 + ".Ocelot." + ITEM + "Amount should be greater than 0!");
  366. }
  367. if (getTamingCOTWCost(EntityType.HORSE) <= 0) {
  368. reason.add(SKILLS + "." + TAMING + "." + CALL_OF_THE_WILD1 + ".Horse." + ITEM + "Amount should be greater than 0!");
  369. }
  370. if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
  371. reason.add(SKILLS + "." + TAMING + "." + CALL_OF_THE_WILD1 + ".Wolf." + SUMMON_AMOUNT + " should be greater than 0!");
  372. }
  373. if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
  374. reason.add(SKILLS + "." + TAMING + "." + CALL_OF_THE_WILD1 + ".Ocelot." + SUMMON_AMOUNT + " should be greater than 0!");
  375. }
  376. if (getTamingCOTWAmount(EntityType.HORSE) <= 0) {
  377. reason.add(SKILLS + "." + TAMING + "." + CALL_OF_THE_WILD1 + ".Horse." + SUMMON_AMOUNT + " should be greater than 0!");
  378. }
  379. return reason;
  380. }
  381. /*
  382. * GENERAL SETTINGS
  383. */
  384. /* General Settings */
  385. public String getLocale() {
  386. if(hasNode(GENERAL, LOCALE))
  387. return getStringValue(GENERAL, LOCALE);
  388. else
  389. return "en_US";
  390. }
  391. public boolean getShowProfileLoadedMessage() {
  392. return getBooleanValue(GENERAL, SHOW_PROFILE_LOADED);
  393. }
  394. public boolean getDonateMessageEnabled() {
  395. return getBooleanValue(COMMANDS, MCMMO, DONATE_MESSAGE);
  396. }
  397. public int getSaveInterval() {
  398. return getIntValue(GENERAL, SAVE_INTERVAL);
  399. }
  400. public String getPartyChatPrefix() {
  401. return getStringValue(COMMANDS, PARTYCHAT, CHAT_PREFIX_FORMAT);
  402. }
  403. public boolean getPartyChatColorLeaderName() {
  404. return getBooleanValue(COMMANDS, PARTYCHAT, GOLD_LEADER_NAME);
  405. }
  406. public boolean getPartyDisplayNames() {
  407. return getBooleanValue(COMMANDS, PARTYCHAT, USE_DISPLAY_NAMES);
  408. }
  409. public String getPartyChatPrefixAlly() {
  410. return getStringValue(COMMANDS, PARTYCHAT, CHAT_PREFIX_FORMAT + ALLY);
  411. }
  412. public String getAdminChatPrefix() {
  413. return getStringValue(COMMANDS, ADMINCHAT, CHAT_PREFIX_FORMAT);
  414. }
  415. public boolean getAdminDisplayNames() {
  416. return getBooleanValue(COMMANDS, ADMINCHAT, USE_DISPLAY_NAMES);
  417. }
  418. public boolean getMatchOfflinePlayers() {
  419. return getBooleanValue(COMMANDS, GENERIC, MATCH_OFFLINE_PLAYERS);
  420. }
  421. public long getDatabasePlayerCooldown() {
  422. return getLongValue(COMMANDS, DATABASE, PLAYER_COOLDOWN);
  423. }
  424. public boolean getLevelUpSoundsEnabled() {
  425. return getBooleanValue(GENERAL, LEVEL_UP_SOUNDS);
  426. }
  427. public boolean getRefreshChunksEnabled() {
  428. return getBooleanValue(GENERAL, REFRESH_CHUNKS);
  429. }
  430. public boolean getMobHealthbarEnabled() {
  431. return getBooleanValue(MOB_HEALTHBAR, ENABLED);
  432. }
  433. /* Mob Healthbar */
  434. public MobHealthbarType getMobHealthbarDefault() {
  435. try {
  436. return MobHealthbarType.valueOf(getStringValue(MOB_HEALTHBAR, DISPLAY_TYPE, HEARTS).toUpperCase().trim());
  437. } catch (IllegalArgumentException ex) {
  438. return MobHealthbarType.HEARTS;
  439. }
  440. }
  441. public int getMobHealthbarTime() {
  442. return getIntValue(MOB_HEALTHBAR, DISPLAY_TIME);
  443. }
  444. /* Backups */
  445. public boolean getBackupsEnabled() {
  446. return getBooleanValue(BACKUPS, ENABLED);
  447. }
  448. public boolean getKeepLast24Hours() {
  449. return getBooleanValue(BACKUPS, KEEP_LAST_24_HOURS);
  450. }
  451. public boolean getKeepDailyLastWeek() {
  452. return getBooleanValue(BACKUPS, KEEP, DAILY_LAST_WEEK);
  453. }
  454. public boolean getKeepWeeklyPastMonth() {
  455. return getBooleanValue(BACKUPS, KEEP, WEEKLY_PAST_MONTHS);
  456. }
  457. /* mySQL */
  458. /*public boolean getUseMySQL() {
  459. return getBooleanValue(MY_SQL, ENABLED);
  460. }
  461. public String getMySQLTablePrefix() {
  462. return getStringValue(MY_SQL, DATABASE, TABLE_PREFIX, DATABASE_PREFIX);
  463. }
  464. public String getMySQLDatabaseName() {
  465. return getStringValue(MY_SQL, DATABASE, NAME);
  466. }
  467. public String getMySQLUserName() {
  468. return getStringValue(MY_SQL, DATABASE, USER_NAME);
  469. }
  470. public int getMySQLServerPort() {
  471. return getIntValue(MY_SQL, SERVER, PORT);
  472. }
  473. public String getMySQLServerName() {
  474. return getStringValue(MY_SQL, SERVER, ADDRESS, LOCALHOST);
  475. }
  476. public String getMySQLUserPassword() {
  477. return getStringValue(MY_SQL, DATABASE, USER_PASSWORD);
  478. }
  479. public int getMySQLMaxConnections(SQLDatabaseManager.PoolIdentifier identifier) {
  480. return getIntValue(MY_SQL, DATABASE, MAX_CONNECTIONS, StringUtils.getCapitalized(identifier.toString()));
  481. }
  482. public int getMySQLMaxPoolSize(SQLDatabaseManager.PoolIdentifier identifier) {
  483. return getIntValue(MY_SQL, DATABASE, MAX_POOL_SIZE, StringUtils.getCapitalized(identifier.toString()));
  484. }
  485. public boolean getMySQLSSL() {
  486. return getBooleanValue(MY_SQL, SERVER, SSL);
  487. }*/
  488. //TODO: Legit cannot tell what the point of this method was
  489. /*ssadprivate String getStringIncludingInts(String[] key) {
  490. String str = getStringValue(key);
  491. if (str == null) {
  492. str = String.valueOf(getIntValue(key));
  493. }
  494. if (str.equals("0")) {
  495. str = "No value set for '" + key + "'";
  496. }
  497. return str;
  498. }*/
  499. /* Hardcore Mode */
  500. public boolean getHardcoreStatLossEnabled(PrimarySkillType primarySkillType) {
  501. return getBooleanValue(HARDCORE, DEATH_STAT_LOSS, ENABLED, StringUtils.getCapitalized(primarySkillType.toString()));
  502. }
  503. public double getHardcoreDeathStatPenaltyPercentage() {
  504. return getDoubleValue(HARDCORE, DEATH_STAT_LOSS, PENALTY_PERCENTAGE);
  505. }
  506. public int getHardcoreDeathStatPenaltyLevelThreshold() {
  507. return getIntValue(HARDCORE, DEATH_STAT_LOSS, LEVEL_THRESHOLD);
  508. }
  509. public boolean getHardcoreVampirismEnabled(PrimarySkillType primarySkillType) {
  510. return getBooleanValue(HARDCORE, VAMPIRISM, ENABLED, StringUtils.getCapitalized(primarySkillType.toString()));
  511. }
  512. public double getHardcoreVampirismStatLeechPercentage() {
  513. return getDoubleValue(HARDCORE, VAMPIRISM, LEECH_PERCENTAGE);
  514. }
  515. public int getHardcoreVampirismLevelThreshold() {
  516. return getIntValue(HARDCORE, VAMPIRISM, LEVEL_THRESHOLD);
  517. }
  518. /* Items */
  519. public int getChimaeraUseCost() {
  520. return getIntValue(ITEMS, CHIMAERA_WING, USE_COST);
  521. }
  522. public int getChimaeraRecipeCost() {
  523. return getIntValue(ITEMS, CHIMAERA_WING, RECIPE_COST);
  524. }
  525. public Material getChimaeraItem() {
  526. return Material.matchMaterial(getStringValue(ITEMS, CHIMAERA_WING, ITEM + NAME));
  527. }
  528. public boolean getChimaeraEnabled() {
  529. return getBooleanValue(ITEMS, CHIMAERA_WING, ENABLED);
  530. }
  531. public boolean getChimaeraPreventUseUnderground() {
  532. return getBooleanValue(ITEMS, CHIMAERA_WING, PREVENT_USE_UNDERGROUND);
  533. }
  534. public boolean getChimaeraUseBedSpawn() {
  535. return getBooleanValue(ITEMS, CHIMAERA_WING, USE_BED_SPAWN);
  536. }
  537. public int getChimaeraCooldown() {
  538. return getIntValue(ITEMS, CHIMAERA_WING, COOLDOWN);
  539. }
  540. public int getChimaeraWarmup() {
  541. return getIntValue(ITEMS, CHIMAERA_WING, WARMUP);
  542. }
  543. public int getChimaeraRecentlyHurtCooldown() {
  544. return getIntValue(ITEMS, CHIMAERA_WING, RECENTLY_HURT + COOLDOWN);
  545. }
  546. public boolean getChimaeraSoundEnabled() {
  547. return getBooleanValue(ITEMS, CHIMAERA_WING, SOUND + "_" + ENABLED);
  548. }
  549. public boolean getFluxPickaxeSoundEnabled() {
  550. return getBooleanValue(ITEMS, FLUX + PICKAXE, SOUND + "_" + ENABLED);
  551. }
  552. /* Particles */
  553. public boolean getAbilityActivationEffectEnabled() {
  554. return getBooleanValue(PARTICLES, ABILITY_ACTIVATION);
  555. }
  556. public boolean getAbilityDeactivationEffectEnabled() {
  557. return getBooleanValue(PARTICLES, ABILITY_DEACTIVATION);
  558. }
  559. public boolean getBleedEffectEnabled() {
  560. return getBooleanValue(PARTICLES, BLEED);
  561. }
  562. public boolean getDodgeEffectEnabled() {
  563. return getBooleanValue(PARTICLES, DODGE);
  564. }
  565. public boolean getFluxEffectEnabled() {
  566. return getBooleanValue(PARTICLES, FLUX);
  567. }
  568. public boolean getGreaterImpactEffectEnabled() {
  569. return getBooleanValue(PARTICLES, GREATER_IMPACT);
  570. }
  571. public boolean getCallOfTheWildEffectEnabled() {
  572. return getBooleanValue(PARTICLES, CALL_OF_THE_WILD);
  573. }
  574. public boolean getLevelUpEffectsEnabled() {
  575. return getBooleanValue(PARTICLES, LEVEL_UP + ENABLED);
  576. }
  577. public int getLevelUpEffectsTier() {
  578. return getIntValue(PARTICLES, LEVEL_UP + TIER);
  579. }
  580. public boolean getLargeFireworks() {
  581. return getBooleanValue(PARTICLES, LARGE_FIREWORKS);
  582. }
  583. /* PARTY SETTINGS */
  584. /* Party Teleport Settings */
  585. public int getPTPCommandCooldown() {
  586. return getIntValue(COMMANDS, PTP, COOLDOWN);
  587. }
  588. public int getPTPCommandWarmup() {
  589. return getIntValue(COMMANDS, PTP, WARMUP);
  590. }
  591. public int getPTPCommandRecentlyHurtCooldown() {
  592. return getIntValue(COMMANDS, PTP, RECENTLY_HURT + COOLDOWN);
  593. }
  594. public int getPTPCommandTimeout() {
  595. return getIntValue(COMMANDS, PTP, REQUEST_TIMEOUT);
  596. }
  597. public boolean getPTPCommandConfirmRequired() {
  598. return getBooleanValue(COMMANDS, PTP, ACCEPT_REQUIRED);
  599. }
  600. public boolean getPTPCommandWorldPermissions() {
  601. return getBooleanValue(COMMANDS, PTP, WORLD_BASED_PERMISSIONS);
  602. }
  603. /* Inspect command distance */
  604. public double getInspectDistance() {
  605. return getDoubleValue(COMMANDS, INSPECT1, MAX_DISTANCE);
  606. }
  607. /*
  608. * ABILITY SETTINGS
  609. */
  610. /* General Settings */
  611. public boolean getAbilityMessagesEnabled() {
  612. return getBooleanValue(ABILITIES, MESSAGES);
  613. }
  614. public boolean getAbilitiesEnabled() {
  615. return getBooleanValue(ABILITIES, ENABLED);
  616. }
  617. public boolean getAbilitiesOnlyActivateWhenSneaking() {
  618. return getBooleanValue(ABILITIES, ACTIVATION, ONLY_ACTIVATE_WHEN_SNEAKING);
  619. }
  620. public int getCooldown(SuperAbilityType ability) {
  621. return getIntValue(ABILITIES, COOLDOWNS + ability.toString());
  622. }
  623. public int getMaxLength(SuperAbilityType ability) {
  624. return getIntValue(ABILITIES, MAX_SECONDS, ability.toString());
  625. }
  626. /* Durability Settings */
  627. public int getAbilityToolDamage() {
  628. return getIntValue(ABILITIES, TOOLS, DURABILITY_LOSS);
  629. }
  630. /* Thresholds */
  631. public int getTreeFellerThreshold() {
  632. return getIntValue(ABILITIES, LIMITS, TREE_FELLER_THRESHOLD);
  633. }
  634. /*
  635. * SKILL SETTINGS
  636. */
  637. public boolean getDoubleDropsEnabled(PrimarySkillType skill, Material material) {
  638. return getBooleanValue(DOUBLE_DROPS, StringUtils.getCapitalized(skill.toString()), StringUtils.getPrettyItemString(material).replace(" ", "_"));
  639. }
  640. /* Acrobatics */
  641. public boolean getDodgeLightningDisabled() {
  642. return getBooleanValue(SKILLS, ACROBATICS, PREVENT + DODGE + LIGHTNING);
  643. }
  644. public int getXPAfterTeleportCooldown() {
  645. return getIntValue(SKILLS, ACROBATICS, XP_AFTER_TELEPORT + COOLDOWN);
  646. }
  647. /* Alchemy */
  648. public boolean getEnabledForHoppers() {
  649. return getBooleanValue(SKILLS, ALCHEMY, ENABLED + FOR_HOPPERS);
  650. }
  651. public boolean getPreventHopperTransferIngredients() {
  652. return getBooleanValue(SKILLS, ALCHEMY, PREVENT_HOPPER_TRANSFER_INGREDIENTS);
  653. }
  654. public boolean getPreventHopperTransferBottles() {
  655. return getBooleanValue(SKILLS, ALCHEMY, PREVENT_HOPPER_TRANSFER_BOTTLES);
  656. }
  657. /* Fishing */
  658. public boolean getFishingDropsEnabled() {
  659. return getBooleanValue(SKILLS, FISHING, DROPS + ENABLED);
  660. }
  661. public boolean getFishingOverrideTreasures() {
  662. return getBooleanValue(SKILLS, FISHING, OVERRIDE_VANILLA_TREASURES);
  663. }
  664. public boolean getFishingExtraFish() {
  665. return getBooleanValue(SKILLS, FISHING, EXTRA_FISH);
  666. }
  667. public double getFishingLureModifier() {
  668. return getDoubleValue(SKILLS, FISHING, LURE_MODIFIER);
  669. }
  670. /* Mining */
  671. public Material getDetonatorItem() {
  672. //Flint and steel
  673. return Material.matchMaterial(getStringValue(SKILLS, MINING, DETONATOR + NAME));
  674. }
  675. /* Repair */
  676. public boolean getRepairAnvilMessagesEnabled() {
  677. return getBooleanValue(SKILLS, REPAIR, ANVIL + MESSAGES);
  678. }
  679. public boolean getRepairAnvilPlaceSoundsEnabled() {
  680. return getBooleanValue(SKILLS, REPAIR, ANVIL_PLACED + SOUNDS);
  681. }
  682. public boolean getRepairAnvilUseSoundsEnabled() {
  683. return getBooleanValue(SKILLS, REPAIR, ANVIL_USE + SOUNDS);
  684. }
  685. public Material getRepairAnvilMaterial() {
  686. //Iron block
  687. return Material.matchMaterial(getStringValue(SKILLS, REPAIR, ANVIL_MATERIAL));
  688. }
  689. public boolean getRepairConfirmRequired() {
  690. return getBooleanValue(SKILLS, REPAIR, CONFIRM_REQUIRED);
  691. }
  692. /* Salvage */
  693. public boolean getSalvageAnvilMessagesEnabled() {
  694. return getBooleanValue(SKILLS, SALVAGE, ANVIL + MESSAGES);
  695. }
  696. public boolean getSalvageAnvilPlaceSoundsEnabled() {
  697. return getBooleanValue(SKILLS, SALVAGE, ANVIL_PLACED + SOUNDS);
  698. }
  699. public boolean getSalvageAnvilUseSoundsEnabled() {
  700. return getBooleanValue(SKILLS, SALVAGE, ANVIL_USE + SOUNDS);
  701. }
  702. public Material getSalvageAnvilMaterial() {
  703. //Gold Block
  704. return Material.matchMaterial(getStringValue(SKILLS, SALVAGE, ANVIL_MATERIAL));
  705. }
  706. public boolean getSalvageConfirmRequired() {
  707. return getBooleanValue(SKILLS, SALVAGE, CONFIRM_REQUIRED);
  708. }
  709. /* Unarmed */
  710. public boolean getUnarmedBlockCrackerSmoothbrickToCracked() {
  711. return getBooleanValue(SKILLS, UNARMED, BLOCK_CRACKER, SMOOTH_BRICK_TO_CRACKED_BRICK);
  712. }
  713. public boolean getUnarmedItemPickupDisabled() {
  714. return getBooleanValue(SKILLS, UNARMED, ITEM + PICKUP_DISABLED_FULL_INVENTORY);
  715. }
  716. public boolean getUnarmedItemsAsUnarmed() {
  717. return getBooleanValue(SKILLS, UNARMED, ITEMS + AS + UNARMED);
  718. }
  719. /* Taming */
  720. public Material getTamingCOTWMaterial(EntityType type) {
  721. return Material.matchMaterial(getStringValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), ITEM + MATERIAL));
  722. }
  723. public int getTamingCOTWCost(EntityType type) {
  724. return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), ITEM + AMOUNT);
  725. }
  726. public int getTamingCOTWAmount(EntityType type) {
  727. return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), SUMMON_AMOUNT);
  728. }
  729. public int getTamingCOTWLength(EntityType type) {
  730. return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), SUMMON_LENGTH);
  731. }
  732. public int getTamingCOTWMaxAmount(EntityType type) {
  733. return getIntValue(SKILLS, TAMING, CALL_OF_THE_WILD1, StringUtils.getPrettyEntityTypeString(type), SUMMON_MAX_AMOUNT);
  734. }
  735. public double getTamingCOTWRange() {
  736. return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD1, RANGE);
  737. }
  738. /* Woodcutting */
  739. public boolean getWoodcuttingDoubleDropsEnabled(BlockData material) {
  740. return getBooleanValue(DOUBLE_DROPS, WOODCUTTING, StringUtils.getFriendlyConfigBlockDataString(material));
  741. }
  742. public boolean getTreeFellerSoundsEnabled() {
  743. return getBooleanValue(SKILLS, WOODCUTTING, TREE_FELLER + SOUNDS);
  744. }
  745. /* AFK Leveling */
  746. public boolean getAcrobaticsPreventAFK() {
  747. return getBooleanValue(SKILLS, ACROBATICS, PREVENT_AFK + LEVELING);
  748. }
  749. public int getAcrobaticsAFKMaxTries() {
  750. return getIntValue(SKILLS, ACROBATICS, MAX_TRIES_AT_SAME_LOCATION);
  751. }
  752. public boolean getHerbalismPreventAFK() {
  753. return getBooleanValue(SKILLS, HERBALISM, PREVENT_AFK + LEVELING);
  754. }
  755. /* PVP & PVE Settings */
  756. public boolean getPVPEnabled(PrimarySkillType skill) {
  757. return getBooleanValue(SKILLS, StringUtils.getCapitalized(skill.toString()), ENABLED + FOR_PVP);
  758. }
  759. public boolean getPVEEnabled(PrimarySkillType skill) {
  760. return getBooleanValue(SKILLS, StringUtils.getCapitalized(skill.toString()), ENABLED + FOR_PVE);
  761. }
  762. }