Update code style

This commit is contained in:
nossr50
2019-04-24 22:52:53 -07:00
parent dc758a6dfc
commit 02a69cbb05
334 changed files with 4660 additions and 5158 deletions

View File

@@ -130,16 +130,12 @@ public class AdvancedConfig extends ConfigValidated {
super("advanced", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
}
@Override
public void unload() {
//do nothing
}
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
@@ -147,6 +143,11 @@ public class AdvancedConfig extends ConfigValidated {
return mcMMO.getConfigManager().getAdvancedConfig();
}
@Override
public void unload() {
//do nothing
}
/**
* The version of this config
*
@@ -239,8 +240,7 @@ public class AdvancedConfig extends ConfigValidated {
}
/* AXES */
if(getAxeMasteryRankDamageMultiplier() < 0)
{
if (getAxeMasteryRankDamageMultiplier() < 0) {
reason.add(SKILLS + "." + AXES + "." + AXE_MASTERY + "." + RANK_DAMAGE_MULTIPLIER + " should be at least 0!");
}
@@ -499,10 +499,11 @@ public class AdvancedConfig extends ConfigValidated {
/**
* This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
* It returns a different value depending on whether or not the server is in retro mode
*
* @return the level at which abilities stop increasing in length
*/
public int getAbilityLengthCap() {
if(!mcMMO.isRetroModeEnabled())
if (!mcMMO.isRetroModeEnabled())
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, CAP_LEVEL);
else
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, CAP_LEVEL);
@@ -511,28 +512,32 @@ public class AdvancedConfig extends ConfigValidated {
/**
* This returns the frequency at which abilities will increase in length
* It returns a different value depending on whether or not the server is in retro mode
*
* @return the number of levels required per ability length increase
*/
public int getAbilityLength() {
if(!mcMMO.isRetroModeEnabled())
if (!mcMMO.isRetroModeEnabled())
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, INCREASE_LEVEL);
else
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, INCREASE_LEVEL);
}
public int getEnchantBuff() { return getIntValue(SKILLS, GENERAL, ABILITY, ENCHANT_BUFF); }
public int getEnchantBuff() {
return getIntValue(SKILLS, GENERAL, ABILITY, ENCHANT_BUFF);
}
/**
* Grabs the max bonus level for a skill used in RNG calculations
* All max level values in the config are multiplied by 10 if the server is in retro mode as the values in the config are based around the new 1-100 skill system scaling
* A value of 10 in the file will be returned as 100 for retro mode servers to accommodate the change in scaling
*
* @param subSkillType target subskill
* @return the level at which this skills max benefits will be reached on the curve
*/
public int getMaxBonusLevel(SubSkillType subSkillType) {
String[] category = subSkillType.getAdvConfigAddress();
if(!mcMMO.isRetroModeEnabled())
if (!mcMMO.isRetroModeEnabled())
return getIntValue(category[0], category[1], category[2], MAX_BONUS_LEVEL, STANDARD);
else
return getIntValue(category[0], category[1], category[2], MAX_BONUS_LEVEL, RETRO_MODE);
@@ -544,37 +549,32 @@ public class AdvancedConfig extends ConfigValidated {
public double getMaximumProbability(SubSkillType subSkillType) {
String[] category = subSkillType.getAdvConfigAddress();
double maximumProbability = getDoubleValue(category[0], category[1], category[2], CHANCE_MAX);
return maximumProbability;
}
public double getMaximumProbability(AbstractSubSkill abstractSubSkill)
{
public double getMaximumProbability(AbstractSubSkill abstractSubSkill) {
return getMaximumProbability(abstractSubSkill.getSubSkillType());
}
/* Notification Settings */
public boolean doesSkillCommandSendBlankLines()
{
return getBooleanValue(FEEDBACK, SKILL_COMMAND, BLANK_LINES_ABOVE_HEADER);
public boolean doesSkillCommandSendBlankLines() {
return getBooleanValue(FEEDBACK, SKILL_COMMAND, BLANK_LINES_ABOVE_HEADER);
}
public boolean doesNotificationUseActionBar(NotificationType notificationType)
{
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), ENABLED);
public boolean doesNotificationUseActionBar(NotificationType notificationType) {
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), ENABLED);
}
public boolean doesNotificationSendCopyToChat(NotificationType notificationType)
{
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), SEND_COPY_OF_MESSAGE_TO_CHAT);
public boolean doesNotificationSendCopyToChat(NotificationType notificationType) {
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), SEND_COPY_OF_MESSAGE_TO_CHAT);
}
public boolean useTitlesForXPEvent()
{
return getBooleanValue(FEEDBACK, EVENTS, XP, SEND_TITLES);
public boolean useTitlesForXPEvent() {
return getBooleanValue(FEEDBACK, EVENTS, XP, SEND_TITLES);
}
private ChatColor getChatColorFromKey(String keyLocation) {
@@ -595,57 +595,109 @@ public class AdvancedConfig extends ConfigValidated {
}
/* ACROBATICS */
public double getDodgeDamageModifier() { return getDoubleValue(SKILLS, ACROBATICS, DODGE, DAMAGE_MODIFIER); }
public double getDodgeDamageModifier() {
return getDoubleValue(SKILLS, ACROBATICS, DODGE, DAMAGE_MODIFIER);
}
public double getRollDamageThreshold() { return getDoubleValue(SKILLS, ACROBATICS, ROLL, DAMAGE_THRESHOLD); }
public double getRollDamageThreshold() {
return getDoubleValue(SKILLS, ACROBATICS, ROLL, DAMAGE_THRESHOLD);
}
public double getGracefulRollDamageThreshold() { return getDoubleValue(SKILLS, ACROBATICS, GRACEFUL_ROLL, DAMAGE_THRESHOLD); }
public double getGracefulRollDamageThreshold() {
return getDoubleValue(SKILLS, ACROBATICS, GRACEFUL_ROLL, DAMAGE_THRESHOLD);
}
/* ALCHEMY */
public int getCatalysisMaxBonusLevel() { return getIntValue(SKILLS, ALCHEMY, CATALYSIS, MAX_BONUS_LEVEL); }
public int getCatalysisMaxBonusLevel() {
return getIntValue(SKILLS, ALCHEMY, CATALYSIS, MAX_BONUS_LEVEL);
}
public double getCatalysisMinSpeed() { return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MIN_SPEED); }
public double getCatalysisMaxSpeed() { return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MAX_SPEED); }
public double getCatalysisMinSpeed() {
return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MIN_SPEED);
}
public double getCatalysisMaxSpeed() {
return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MAX_SPEED);
}
/* ARCHERY */
public double getSkillShotRankDamageMultiplier() { return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, RANK_DAMAGE_MULTIPLIER); }
public double getSkillShotDamageMax() { return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, MAX_DAMAGE); }
public double getSkillShotRankDamageMultiplier() {
return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, RANK_DAMAGE_MULTIPLIER);
}
public double getDazeBonusDamage() { return getDoubleValue(SKILLS, ARCHERY, DAZE, BONUS_DAMAGE); }
public double getSkillShotDamageMax() {
return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, MAX_DAMAGE);
}
public double getForceMultiplier() { return getDoubleValue(SKILLS, ARCHERY, FORCE_MULTIPLIER); }
public double getDazeBonusDamage() {
return getDoubleValue(SKILLS, ARCHERY, DAZE, BONUS_DAMAGE);
}
public double getForceMultiplier() {
return getDoubleValue(SKILLS, ARCHERY, FORCE_MULTIPLIER);
}
/* AXES */
public double getAxeMasteryRankDamageMultiplier() { return getDoubleValue(SKILLS, AXES, AXE_MASTERY, RANK_DAMAGE_MULTIPLIER); }
public double getAxeMasteryRankDamageMultiplier() {
return getDoubleValue(SKILLS, AXES, AXE_MASTERY, RANK_DAMAGE_MULTIPLIER);
}
public double getCriticalStrikesPVPModifier() { return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVP_MODIFIER); }
public double getCriticalStrikesPVEModifier() { return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVE_MODIFIER); }
public double getCriticalStrikesPVPModifier() {
return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVP_MODIFIER);
}
public double getGreaterImpactChance() { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, CHANCE); }
public double getGreaterImpactModifier() { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, KNOCKBACK_MODIFIER); }
public double getGreaterImpactBonusDamage() { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, BONUS_DAMAGE); }
public double getCriticalStrikesPVEModifier() {
return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVE_MODIFIER);
}
public double getGreaterImpactChance() {
return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, CHANCE);
}
public double getGreaterImpactModifier() {
return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, KNOCKBACK_MODIFIER);
}
public double getGreaterImpactBonusDamage() {
return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, BONUS_DAMAGE);
}
public int getArmorImpactIncreaseLevel() {
int increaseLevel = getIntValue(SKILLS, AXES, ARMOR_IMPACT, INCREASE_LEVEL);
if(mcMMO.isRetroModeEnabled())
if (mcMMO.isRetroModeEnabled())
return increaseLevel * 10;
return increaseLevel;
}
public double getImpactChance() { return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, CHANCE); }
public double getArmorImpactMaxDurabilityDamage() { return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, MAX_PERCENTAGE_DURABILITY_DAMAGE); }
public double getImpactChance() {
return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, CHANCE);
}
public double getSkullSplitterModifier() { return getDoubleValue(SKILLS, AXES, SKULL_SPLITTER, DAMAGE_MODIFIER); }
public double getArmorImpactMaxDurabilityDamage() {
return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, MAX_PERCENTAGE_DURABILITY_DAMAGE);
}
public double getSkullSplitterModifier() {
return getDoubleValue(SKILLS, AXES, SKULL_SPLITTER, DAMAGE_MODIFIER);
}
/* EXCAVATION */
//Nothing to configure, everything is already configurable in config.yml
/* FISHING */
public double getShakeChance(int rank) { return getDoubleValue(SKILLS, FISHING, SHAKE, CHANCE, RANK, String.valueOf(rank)); }
public double getMasterAnglerBoatModifier() {return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BOAT_MODIFIER); }
public double getMasterAnglerBiomeModifier() {return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER); }
public double getShakeChance(int rank) {
return getDoubleValue(SKILLS, FISHING, SHAKE, CHANCE, RANK, String.valueOf(rank));
}
public double getMasterAnglerBoatModifier() {
return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BOAT_MODIFIER);
}
public double getMasterAnglerBiomeModifier() {
return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER);
}
/* HERBALISM */
//public int getFarmerDietRankChange() { return getIntValue(SKILLS, ".Herbalism.FarmersDiet.RankChange"); }
@@ -653,67 +705,152 @@ public class AdvancedConfig extends ConfigValidated {
//public int getGreenThumbStageChange() { return getIntValue(SKILLS, ".Herbalism.GreenThumb.StageChange"); }
/* MINING */
public boolean getDoubleDropSilkTouchEnabled() { return getBooleanValue(SKILLS, MINING, "DoubleDrops", "SilkTouch"); }
public int getBlastMiningRankLevel(int rank) { return getIntValue(SKILLS, MINING, BLAST_MINING, RANK, LEVELS, RANK, String.valueOf(rank)); }
public double getBlastDamageDecrease(int rank) { return getDoubleValue(SKILLS, MINING, BLAST_MINING, BLAST_DAMAGE_DECREASE, RANK, String.valueOf(rank)); }
public double getOreBonus(int rank) { return getDoubleValue(SKILLS, MINING, BLAST_MINING, ORE_BONUS, RANK, String.valueOf(rank)); }
public double getDebrisReduction(int rank) { return getDoubleValue(SKILLS, MINING, BLAST_MINING, DEBRIS_REDUCTION, RANK, String.valueOf(rank)); }
public int getDropMultiplier(int rank) { return getIntValue(SKILLS, MINING, BLAST_MINING, DROP_MULTIPLIER, RANK, String.valueOf(rank)); }
public double getBlastRadiusModifier(int rank) { return getDoubleValue(SKILLS, MINING, BLAST_MINING, BLAST_RADIUS, MODIFIER, RANK, String.valueOf(rank)); }
public boolean getDoubleDropSilkTouchEnabled() {
return getBooleanValue(SKILLS, MINING, "DoubleDrops", "SilkTouch");
}
public int getBlastMiningRankLevel(int rank) {
return getIntValue(SKILLS, MINING, BLAST_MINING, RANK, LEVELS, RANK, String.valueOf(rank));
}
public double getBlastDamageDecrease(int rank) {
return getDoubleValue(SKILLS, MINING, BLAST_MINING, BLAST_DAMAGE_DECREASE, RANK, String.valueOf(rank));
}
public double getOreBonus(int rank) {
return getDoubleValue(SKILLS, MINING, BLAST_MINING, ORE_BONUS, RANK, String.valueOf(rank));
}
public double getDebrisReduction(int rank) {
return getDoubleValue(SKILLS, MINING, BLAST_MINING, DEBRIS_REDUCTION, RANK, String.valueOf(rank));
}
public int getDropMultiplier(int rank) {
return getIntValue(SKILLS, MINING, BLAST_MINING, DROP_MULTIPLIER, RANK, String.valueOf(rank));
}
public double getBlastRadiusModifier(int rank) {
return getDoubleValue(SKILLS, MINING, BLAST_MINING, BLAST_RADIUS, MODIFIER, RANK, String.valueOf(rank));
}
/* REPAIR */
public double getRepairMasteryMaxBonus() { return getDoubleValue(SKILLS, REPAIR, REPAIR_MASTERY, MAX_BONUS_PERCENTAGE); }
public double getRepairMasteryMaxBonus() {
return getDoubleValue(SKILLS, REPAIR, REPAIR_MASTERY, MAX_BONUS_PERCENTAGE);
}
//public int getRepairMasteryMaxLevel() { return getIntValue(SKILLS, REPAIR, REPAIR_MASTERY, MAX_BONUS_LEVEL); }
/* Arcane Forging */
public boolean getArcaneForgingEnchantLossEnabled() { return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, MAY_LOSE_ENCHANTS); }
public double getArcaneForgingKeepEnchantsChance(int rank) { return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, KEEP_ENCHANTS, CHANCE, RANK, String.valueOf(rank)); }
public boolean getArcaneForgingEnchantLossEnabled() {
return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, MAY_LOSE_ENCHANTS);
}
public boolean getArcaneForgingDowngradeEnabled() { return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES_ENABLED); }
public double getArcaneForgingDowngradeChance(int rank) { return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES, CHANCE, RANK, String.valueOf(rank)); }
public double getArcaneForgingKeepEnchantsChance(int rank) {
return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, KEEP_ENCHANTS, CHANCE, RANK, String.valueOf(rank));
}
public boolean getArcaneForgingDowngradeEnabled() {
return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES_ENABLED);
}
public double getArcaneForgingDowngradeChance(int rank) {
return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES, CHANCE, RANK, String.valueOf(rank));
}
/* SALVAGE */
public boolean getArcaneSalvageEnchantDowngradeEnabled() { return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_DOWNGRADE_ENABLED); }
public boolean getArcaneSalvageEnchantLossEnabled() { return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_LOSS_ENABLED); }
public boolean getArcaneSalvageEnchantDowngradeEnabled() {
return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_DOWNGRADE_ENABLED);
}
public double getArcaneSalvageExtractFullEnchantsChance(int rank) { return getDoubleValue(SKILLS, SALVAGE, ARCANE_SALVAGE, EXTRACT_FULL_ENCHANT, RANK, String.valueOf(rank)); }
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return getDoubleValue(SKILLS, SALVAGE, ARCANE_SALVAGE, EXTRACT_PARTIAL_ENCHANT, RANK, String.valueOf(rank)); }
public boolean getArcaneSalvageEnchantLossEnabled() {
return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_LOSS_ENABLED);
}
public double getArcaneSalvageExtractFullEnchantsChance(int rank) {
return getDoubleValue(SKILLS, SALVAGE, ARCANE_SALVAGE, EXTRACT_FULL_ENCHANT, RANK, String.valueOf(rank));
}
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) {
return getDoubleValue(SKILLS, SALVAGE, ARCANE_SALVAGE, EXTRACT_PARTIAL_ENCHANT, RANK, String.valueOf(rank));
}
/* SMELTING */
//public int getBurnModifierMaxLevel() { return getIntValue(SKILLS, SMELTING, FUEL_EFFICIENCY, MAX_BONUS_LEVEL); }
public double getBurnTimeMultiplier() { return getDoubleValue(SKILLS, SMELTING, FUEL_EFFICIENCY, MULTIPLIER); }
public double getBurnTimeMultiplier() {
return getDoubleValue(SKILLS, SMELTING, FUEL_EFFICIENCY, MULTIPLIER);
}
public int getSmeltingRankLevel(int rank) { return getIntValue(SKILLS, SMELTING, RANK, LEVELS, RANK, String.valueOf(rank)); }
public int getSmeltingRankLevel(int rank) {
return getIntValue(SKILLS, SMELTING, RANK, LEVELS, RANK, String.valueOf(rank));
}
public int getSmeltingVanillaXPBoostMultiplier(int rank) { return getIntValue(SKILLS, SMELTING, VANILLA_XPMULTIPLIER, RANK, String.valueOf(rank)); }
public int getSmeltingVanillaXPBoostMultiplier(int rank) {
return getIntValue(SKILLS, SMELTING, VANILLA_XPMULTIPLIER, RANK, String.valueOf(rank));
}
/* SWORDS */
public double getRuptureDamagePlayer() { return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_PLAYER); }
public double getRuptureDamageMobs() { return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_MOBS); }
public double getRuptureDamagePlayer() {
return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_PLAYER);
}
public int getRuptureMaxTicks() { return getIntValue(SKILLS, SWORDS, RUPTURE, MAX_TICKS); }
public int getRuptureBaseTicks() { return getIntValue(SKILLS, SWORDS, RUPTURE, BASE_TICKS); }
public double getRuptureDamageMobs() {
return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_MOBS);
}
public double getCounterAttackModifier() { return getDoubleValue(SKILLS, SWORDS, COUNTER_ATTACK, DAMAGE_MODIFIER); }
public int getRuptureMaxTicks() {
return getIntValue(SKILLS, SWORDS, RUPTURE, MAX_TICKS);
}
public double getSerratedStrikesModifier() { return getDoubleValue(SKILLS, SWORDS, SERRATED_STRIKES, DAMAGE_MODIFIER); }
public int getRuptureBaseTicks() {
return getIntValue(SKILLS, SWORDS, RUPTURE, BASE_TICKS);
}
public double getCounterAttackModifier() {
return getDoubleValue(SKILLS, SWORDS, COUNTER_ATTACK, DAMAGE_MODIFIER);
}
public double getSerratedStrikesModifier() {
return getDoubleValue(SKILLS, SWORDS, SERRATED_STRIKES, DAMAGE_MODIFIER);
}
//public int getSerratedStrikesTicks() { return getIntValue(SKILLS, SWORDS, SERRATED_STRIKES, RUPTURE, TICKS); }
/* TAMING */
public double getGoreModifier() { return getDoubleValue(SKILLS, TAMING, GORE, MODIFIER); }
public double getFastFoodChance() { return getDoubleValue(SKILLS, TAMING, FAST_FOOD_SERVICE, CHANCE); }
public double getPummelChance() { return getDoubleValue(SKILLS, TAMING, PUMMEL, CHANCE); }
public double getThickFurModifier() { return getDoubleValue(SKILLS, TAMING, THICK_FUR, MODIFIER); }
public double getShockProofModifier() { return getDoubleValue(SKILLS, TAMING, SHOCK_PROOF, MODIFIER); }
public double getGoreModifier() {
return getDoubleValue(SKILLS, TAMING, GORE, MODIFIER);
}
public double getSharpenedClawsBonus() { return getDoubleValue(SKILLS, TAMING, SHARPENED_CLAWS, BONUS); }
public double getFastFoodChance() {
return getDoubleValue(SKILLS, TAMING, FAST_FOOD_SERVICE, CHANCE);
}
public double getMinHorseJumpStrength() { return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MIN_HORSE_JUMP_STRENGTH); }
public double getMaxHorseJumpStrength() { return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MAX_HORSE_JUMP_STRENGTH); }
public double getPummelChance() {
return getDoubleValue(SKILLS, TAMING, PUMMEL, CHANCE);
}
public double getThickFurModifier() {
return getDoubleValue(SKILLS, TAMING, THICK_FUR, MODIFIER);
}
public double getShockProofModifier() {
return getDoubleValue(SKILLS, TAMING, SHOCK_PROOF, MODIFIER);
}
public double getSharpenedClawsBonus() {
return getDoubleValue(SKILLS, TAMING, SHARPENED_CLAWS, BONUS);
}
public double getMinHorseJumpStrength() {
return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MIN_HORSE_JUMP_STRENGTH);
}
public double getMaxHorseJumpStrength() {
return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MAX_HORSE_JUMP_STRENGTH);
}
/* UNARMED */
public boolean getDisarmProtected() { return getBooleanValue(SKILLS, UNARMED, DISARM, ANTI_THEFT); }
public boolean getDisarmProtected() {
return getBooleanValue(SKILLS, UNARMED, DISARM, ANTI_THEFT);
}
/* WOODCUTTING */
}

View File

@@ -13,13 +13,11 @@ public class BonusDropManager implements Unload {
private HashMap<Material, Boolean> bonusDropWhitelist;
public BonusDropManager()
{
public BonusDropManager() {
bonusDropWhitelist = new HashMap<>();
//Start by setting all Materials to false to avoid null checks
for(Material material : Material.values())
{
for (Material material : Material.values()) {
registerMaterial(material, false);
}
}
@@ -31,28 +29,25 @@ public class BonusDropManager implements Unload {
/**
* Adds materials to the bonus drop whitelist
*
* @param materials target material list
*/
public void addToWhitelistByMaterial(List<Material> materials)
{
for(Material material : materials)
{
public void addToWhitelistByMaterial(List<Material> materials) {
for (Material material : materials) {
registerMaterial(material, true);
}
}
/**
* Adds materials to the bonus drop whitelist
*
* @param materials target material list
*/
public void addToWhitelistByNameID(List<String> materials)
{
for(String material : materials)
{
public void addToWhitelistByNameID(List<String> materials) {
for (String material : materials) {
Material m = Material.matchMaterial(material);
if(m == null)
{
mcMMO.p.getLogger().severe("Error registering Bonus Drop -- Invalid Minecraft Name ID: "+material);
if (m == null) {
mcMMO.p.getLogger().severe("Error registering Bonus Drop -- Invalid Minecraft Name ID: " + material);
continue;
}
@@ -62,6 +57,7 @@ public class BonusDropManager implements Unload {
/**
* Adds a material to the bonus drop whitelist
*
* @param material target material
*/
private void registerMaterial(Material material, boolean isWhitelisted) {
@@ -70,11 +66,11 @@ public class BonusDropManager implements Unload {
/**
* Check if a material can provide bonus drops
*
* @param material target material
* @return true if the material can provide bonus drops
*/
public boolean isBonusDropWhitelisted(Material material)
{
public boolean isBonusDropWhitelisted(Material material) {
return bonusDropWhitelist.get(material);
}
}

View File

@@ -21,22 +21,20 @@ import java.util.List;
public abstract class Config implements VersionedConfig, Unload {
public static final String HOCON_FILE_EXTENSION = ".conf";
public final File DIRECTORY_DATA_FOLDER; //Directory that the file is in
public final String FILE_RELATIVE_PATH; //Relative Path to the file
protected final String DIRECTORY_DEFAULTS = "defaults";
/* SETTINGS */
//private static final String FILE_EXTENSION = ".conf"; //HOCON
private boolean mergeNewKeys; //Whether or not to merge keys found in the default config
private boolean removeOldKeys; //Whether or not to remove unused keys form the config
/* PATH VARS */
private boolean copyDefaults; //Whether or not to copy the default config when first creating the file
private boolean generateDefaults; //Whether or not we use Configurate to generate a default file, if this is false we copy the file from the JAR
private String fileName; //The file name of the config
/* PATH VARS */
public final File DIRECTORY_DATA_FOLDER; //Directory that the file is in
public final String FILE_RELATIVE_PATH; //Relative Path to the file
protected final String DIRECTORY_DEFAULTS = "defaults";
/* LOADERS */
private HoconConfigurationLoader defaultCopyLoader;
private HoconConfigurationLoader userCopyLoader;
@@ -78,8 +76,7 @@ public abstract class Config implements VersionedConfig, Unload {
FILE_RELATIVE_PATH = relativePath + fileName + HOCON_FILE_EXTENSION; //Relative path to config from a parent folder
}
public void initFullConfig()
{
public void initFullConfig() {
//Attempt IO Operations
try {
//Makes sure we have valid Files corresponding to this config
@@ -106,8 +103,7 @@ public abstract class Config implements VersionedConfig, Unload {
* Registers with the config managers unloader
* The unloader runs when the plugin gets disabled which cleans up registries to make reloading safe
*/
private void registerUnload()
{
private void registerUnload() {
mcMMO.getConfigManager().registerUnloadable(this);
}
@@ -115,13 +111,13 @@ public abstract class Config implements VersionedConfig, Unload {
* Registers with the config managers file list
* Used for backing up configs with our zip library
*/
private void registerFileBackup()
{
private void registerFileBackup() {
mcMMO.getConfigManager().registerUserFile(getUserConfigFile());
}
/**
* Initializes the default copy File and the user config File
*
* @throws IOException
*/
private void initConfigFiles() throws IOException {
@@ -135,8 +131,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Loads the root node for the default config File and user config File
*/
private void loadConfig()
{
private void loadConfig() {
try {
final CommentedConfigurationNode defaultConfig = this.defaultCopyLoader.load();
defaultRootNode = defaultConfig;
@@ -152,20 +147,19 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Initializes the Configuration Loaders for this config
*/
private void initConfigLoaders()
{
private void initConfigLoaders() {
this.defaultCopyLoader = HoconConfigurationLoader.builder().setPath(resourceConfigCopy.toPath()).build();
this.userCopyLoader = HoconConfigurationLoader.builder().setPath(resourceUserCopy.toPath()).build();
}
/**
* Copies a new file from the JAR to the defaults directory and uses that new file to initialize our resourceConfigCopy
* @see Config#resourceConfigCopy
*
* @throws IOException
* @see Config#resourceConfigCopy
*/
private File initDefaultConfig() throws IOException {
if(generateDefaults)
{
if (generateDefaults) {
return generateDefaultFile();
} else
return copyDefaultFromJar(getDefaultConfigCopyRelativePath(), true);
@@ -174,11 +168,11 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Generates a default config file using the Configurate library, makes use of @Setting and @ConfigSerializable annotations in the config file
* Assigns the default root node to the newly loaded default config if successful
*
* @return the File for the newly created config
*/
private File generateDefaultFile()
{
mcMMO.p.getLogger().info("Attempting to create a default config for "+fileName);
private File generateDefaultFile() {
mcMMO.p.getLogger().info("Attempting to create a default config for " + fileName);
//Not sure if this will work properly...
Path potentialFile = Paths.get(getDefaultConfigCopyRelativePath());
@@ -186,9 +180,9 @@ public abstract class Config implements VersionedConfig, Unload {
= HoconConfigurationLoader.builder().setPath(potentialFile).build();
try {
mcMMO.p.getLogger().info("Config File Full Path: "+getDefaultConfigFile().getAbsolutePath());
mcMMO.p.getLogger().info("Config File Full Path: " + getDefaultConfigFile().getAbsolutePath());
//Delete any existing default config
if(getDefaultConfigFile().exists())
if (getDefaultConfigFile().exists())
getDefaultConfigFile().delete();
//Make new file
@@ -200,8 +194,8 @@ public abstract class Config implements VersionedConfig, Unload {
//Save to a new file
generation_loader.save(defaultRootNode);
mcMMO.p.getLogger().info("Generated a default file for "+fileName);
} catch(IOException e) {
mcMMO.p.getLogger().info("Generated a default file for " + fileName);
} catch (IOException e) {
mcMMO.p.getLogger().severe("Error when trying to generate a default configuration file for " + getDefaultConfigCopyRelativePath());
e.printStackTrace();
}
@@ -212,26 +206,23 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Attemps to load the config file if it exists, if it doesn't it copies a new one from within the JAR
*
* @return user config File
* @see Config#resourceUserCopy
* @throws IOException
* @see Config#resourceUserCopy
*/
private File initUserConfig() throws IOException {
File userCopy = new File(DIRECTORY_DATA_FOLDER, FILE_RELATIVE_PATH); //Load the user file;
if(userCopy.exists())
{
if (userCopy.exists()) {
// Yay
return userCopy;
}
else
{
} else {
//If it's gone we copy default files
//Note that we don't copy the values from the default copy put in /defaults/ that file exists only as a reference to admins and is unreliable
if(copyDefaults)
if (copyDefaults)
return copyDefaultFromJar(FILE_RELATIVE_PATH, false);
else
{
else {
//Make a new empty file
userCopy.createNewFile();
return userCopy;
@@ -241,6 +232,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Gets the File representation of the this users config
*
* @return the users config File
*/
public File getUserConfigFile() {
@@ -249,17 +241,17 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Used to make a new config file at a specified relative output path inside the data directory by copying the matching file found in that same relative path within the JAR
*
* @param relativeOutputPath the path to the output file
* @param deleteOld whether or not to delete the existing output file on disk
* @param deleteOld whether or not to delete the existing output file on disk
* @return a copy of the default config within the JAR
* @throws IOException
*/
private File copyDefaultFromJar(String relativeOutputPath, boolean deleteOld) throws IOException
{
private File copyDefaultFromJar(String relativeOutputPath, boolean deleteOld) throws IOException {
/*
* Gen a Default config from inside the JAR
*/
mcMMO.p.getLogger().info("Preparing to copy internal resource file (in JAR) - "+FILE_RELATIVE_PATH);
mcMMO.p.getLogger().info("Preparing to copy internal resource file (in JAR) - " + FILE_RELATIVE_PATH);
//InputStream inputStream = McmmoCore.getResource(FILE_RELATIVE_PATH);
InputStream inputStream = mcMMO.p.getResource(FILE_RELATIVE_PATH);
@@ -270,14 +262,12 @@ public abstract class Config implements VersionedConfig, Unload {
File targetFile = new File(DIRECTORY_DATA_FOLDER, relativeOutputPath);
//Wipe old default file on disk
if (targetFile.exists() && deleteOld)
{
if (targetFile.exists() && deleteOld) {
mcMMO.p.getLogger().info("Updating file " + relativeOutputPath);
targetFile.delete(); //Necessary?
}
if(!targetFile.exists())
{
if (!targetFile.exists()) {
targetFile.getParentFile().mkdirs();
targetFile.createNewFile(); //New File Boys
}
@@ -292,6 +282,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* The path to the defaults directory
*
* @return the path to the defaults directory
*/
private String getDefaultConfigCopyRelativePath() {
@@ -301,6 +292,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Grabs the File representation of the default config, which is stored on disk in a defaults folder
* this file will be overwritten every time mcMMO starts to keep it up to date.
*
* @return the copy of the default config file, stored in the defaults directory
*/
private File getDefaultConfigFile() {
@@ -316,11 +308,11 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Configs are versioned based on when they had significant changes to keys
*
* @return current MainConfig Version String
*/
public String getVersion()
{
return String.valueOf(getConfigVersion());
public String getVersion() {
return String.valueOf(getConfigVersion());
}
/**
@@ -342,13 +334,12 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Compares the users config file to the default and adds any missing nodes and applies any necessary updates
*/
private void updateConfig()
{
mcMMO.p.getLogger().info(defaultRootNode.getChildrenMap().size() +" items in default children map");
mcMMO.p.getLogger().info(userRootNode.getChildrenMap().size() +" items in default root map");
private void updateConfig() {
mcMMO.p.getLogger().info(defaultRootNode.getChildrenMap().size() + " items in default children map");
mcMMO.p.getLogger().info(userRootNode.getChildrenMap().size() + " items in default root map");
// Merge Values from default
if(mergeNewKeys)
if (mergeNewKeys)
userRootNode = userRootNode.mergeValuesFrom(defaultRootNode);
removeOldKeys();
@@ -368,23 +359,21 @@ public abstract class Config implements VersionedConfig, Unload {
* Finds any keys in the users config that are not present in the default config and removes them
*/
//TODO: Finish this
private void removeOldKeys()
{
if(!removeOldKeys)
private void removeOldKeys() {
if (!removeOldKeys)
return;
for(CommentedConfigurationNode CommentedConfigurationNode : defaultRootNode.getChildrenList())
{
for (CommentedConfigurationNode CommentedConfigurationNode : defaultRootNode.getChildrenList()) {
}
}
/**
* Saves the current state information of the config to the users copy (which they may edit)
*
* @throws IOException
*/
private void saveUserCopy() throws IOException
{
private void saveUserCopy() throws IOException {
mcMMO.p.getLogger().info("Saving new node");
userCopyLoader.save(userRootNode);
}
@@ -395,11 +384,12 @@ public abstract class Config implements VersionedConfig, Unload {
private void updateConfigVersion() {
// Set a version for our config
this.userRootNode.getNode("ConfigVersion").setValue(getConfigVersion());
mcMMO.p.getLogger().info("Updated config to ["+getConfigVersion()+"] - " + FILE_RELATIVE_PATH);
mcMMO.p.getLogger().info("Updated config to [" + getConfigVersion() + "] - " + FILE_RELATIVE_PATH);
}
/**
* Returns the root node of this config
*
* @return the root node of this config
*/
protected CommentedConfigurationNode getUserRootNode() {
@@ -408,62 +398,67 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Gets an int from the config and casts it to short before returning
*
* @param path the path to the int
* @return the value of the int after being cast to short at the node, null references will zero initialize
*/
public short getShortValue(String... path) { return (short) userRootNode.getNode(path).getInt();}
public short getShortValue(String... path) {
return (short) userRootNode.getNode(path).getInt();
}
/**
* Grabs an int from the specified node
*
* @param path
* @return the int from the node, null references will zero initialize
*/
public int getIntValue(String... path)
{
public int getIntValue(String... path) {
return userRootNode.getNode(path).getInt();
}
/**
* Grabs a double from the specified node
*
* @param path
* @return the double from the node, null references will zero initialize
*/
public double getDoubleValue(String... path)
{
public double getDoubleValue(String... path) {
return userRootNode.getNode(path).getDouble();
}
/**
* Grabs a long from the specified node
*
* @param path
* @return the long from the node, null references will zero initialize
*/
public long getLongValue(String... path)
{
public long getLongValue(String... path) {
return userRootNode.getNode(path).getLong();
}
/**
* Grabs a boolean from the specified node
*
* @param path
* @return the boolean from the node, null references will zero initialize
*/
public boolean getBooleanValue(String... path)
{
public boolean getBooleanValue(String... path) {
return userRootNode.getNode(path).getBoolean();
}
/**
* Grabs a string from the specified node
*
* @param path
* @return the string from the node, null references will zero initialize
*/
public String getStringValue(String... path)
{
public String getStringValue(String... path) {
return userRootNode.getNode(path).getString();
}
/**
* Checks to see if a node exists in the user's config file
*
* @param path path to the node
* @return true if the node exists
*/
@@ -473,6 +468,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Returns the children of a specific node
*
* @param path the path to the parent node
* @return the list of children for the target parent node
*/
@@ -480,8 +476,7 @@ public abstract class Config implements VersionedConfig, Unload {
return userRootNode.getNode(path).getChildrenList();
}
public List<String> getListFromNode(String... path) throws ObjectMappingException
{
public List<String> getListFromNode(String... path) throws ObjectMappingException {
return userRootNode.getNode(path).getList(TypeToken.of(String.class));
}
}

View File

@@ -14,10 +14,10 @@ public abstract class ConfigCollection<T> extends Config implements Registers, G
/**
* @param pathToParentFolder Path to the "parent" folder on disk
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
* @param removeOldKeys if true, the users config file will have keys not found in the internal default resource file of the same name and path removed
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
* @param removeOldKeys if true, the users config file will have keys not found in the internal default resource file of the same name and path removed
*/
public ConfigCollection(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);

View File

@@ -9,11 +9,19 @@ import java.util.ArrayList;
* Constants relating to config folders and paths
*/
public class ConfigConstants {
private final static String[] EXAMPLE_BLACKLIST_WORLDS = {"Example_15434453", "Example_2324423", "Example_323423465"};
public final static ArrayList<String> EXAMPLE_BLACKLIST_WORLDS_LIST_DEFAULT;
public final static String SKILL_SCALING_BENEFIT_EXPLANATION = "\nSub-Skills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of that sub-skill.";
/* FOLDER NAMES */
public static final String FOLDER_NAME_CONFIG = "config";
public static final String FOLDER_NAME_SKILLS = "skills";
public static final String FOLDER_NAME_EXPERIENCE = "Experience Settings";
public static final String FOLDER_NAME_DEFAULTS = "defaults";
/* RELATIVE PATHS */
public final static String RELATIVE_PATH_CONFIG_DIR = File.separator + FOLDER_NAME_CONFIG + File.separator;
public final static String RELATIVE_PATH_SKILLS_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_SKILLS + File.separator;
public final static String RELATIVE_PATH_XP_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_EXPERIENCE + File.separator;
private final static String[] EXAMPLE_BLACKLIST_WORLDS = {"Example_15434453", "Example_2324423", "Example_323423465"};
//Add the worlds to the list
static {
@@ -23,23 +31,12 @@ public class ConfigConstants {
EXAMPLE_BLACKLIST_WORLDS_LIST_DEFAULT.add(EXAMPLE_BLACKLIST_WORLDS[2]);
}
/* FOLDER NAMES */
public static final String FOLDER_NAME_CONFIG = "config";
public static final String FOLDER_NAME_SKILLS = "skills";
public static final String FOLDER_NAME_EXPERIENCE = "Experience Settings";
public static final String FOLDER_NAME_DEFAULTS = "defaults";
/* RELATIVE PATHS */
public final static String RELATIVE_PATH_CONFIG_DIR = File.separator + FOLDER_NAME_CONFIG + File.separator;
public final static String RELATIVE_PATH_SKILLS_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_SKILLS + File.separator;
public final static String RELATIVE_PATH_XP_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_EXPERIENCE + File.separator;
/**
* Return the data folder for mcMMO
*
* @return the File for the data folder used by mcMMO
*/
public static File getDataFolder()
{
public static File getDataFolder() {
return mcMMO.p.getDataFolder();
}
@@ -74,33 +71,32 @@ public class ConfigConstants {
/**
* Creates all directories used by mcMMO config files
*/
public static void makeAllConfigDirectories()
{
public static void makeAllConfigDirectories() {
/* CONFIG DIRECTORY */
if(!getConfigFolder().exists())
if (!getConfigFolder().exists())
getConfigFolder().mkdirs();
/* DEFAULT DIRECTORIES */
if(!getDefaultsFolder().exists())
if (!getDefaultsFolder().exists())
getDefaultsFolder().mkdirs();
if(!getDefaultsConfigFolder().exists())
if (!getDefaultsConfigFolder().exists())
getDefaultsConfigFolder().mkdirs();
if(!getDefaultsSkillFolder().exists())
if (!getDefaultsSkillFolder().exists())
getDefaultsSkillFolder().mkdirs();
if(!getDefaultsXPFolder().exists())
if (!getDefaultsXPFolder().exists())
getDefaultsXPFolder().mkdirs();
/* CONFIG SUBDIRECTORIES */
if(!getConfigSkillFolder().exists())
if (!getConfigSkillFolder().exists())
getConfigSkillFolder().mkdirs();
if(!getConfigXPFolder().exists())
if (!getConfigXPFolder().exists())
getConfigXPFolder().mkdirs();
}
}

View File

@@ -65,37 +65,32 @@ import java.util.ArrayList;
import java.util.HashMap;
/**
*
* The Config Manager handles initializing, loading, and unloading registers for all configs that mcMMO uses
* This makes sure that mcMMO properly loads and unloads its values on reload
*
* <p>
* Config Manager also holds all of our MultiConfigContainers
*/
public final class ConfigManager {
/* UNLOAD REGISTER */
SkillPropertiesManager skillPropertiesManager;
private ArrayList<Unload> unloadables;
private ArrayList<File> userFiles;
/* COLLECTION MANAGERS */
private ArrayList<File> userFiles;
private RepairableManager repairableManager;
private SalvageableManager salvageableManager;
private BonusDropManager bonusDropManager;
/* CUSTOM SERIALIZERS */
private TypeSerializerCollection customSerializers;
private BonusDropManager bonusDropManager;
/* MOD MANAGERS */
//TODO: Add these back when modded servers become a thing again
/* MISC MANAGERS */
SkillPropertiesManager skillPropertiesManager;
private TypeSerializerCollection customSerializers;
private ExperienceMapManager experienceMapManager;
/* CONFIG INSTANCES */
@@ -163,14 +158,12 @@ public final class ConfigManager {
private ArrayList<String> configErrors; //Collect errors to whine about to server admins
public ConfigManager()
{
public ConfigManager() {
unloadables = new ArrayList<>();
userFiles = new ArrayList<>();
}
public void loadConfigs()
{
public void loadConfigs() {
//Register Custom Serializers
registerCustomTypeSerializers();
@@ -314,9 +307,12 @@ public final class ConfigManager {
customSerializers = TypeSerializers.getDefaultSerializers().newChild();
mcMMO.p.getLogger().info("Registering custom type serializers for Configurate...");
customSerializers.registerType(new TypeToken<Material>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<FormulaType>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<Material>() {
}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<PartyFeature>() {
}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<FormulaType>() {
}, new CustomEnumValueSerializer());
customSerializers.registerType(TypeToken.of(Repairable.class), new RepairableSerializer());
customSerializers.registerType(TypeToken.of(Salvageable.class), new SalvageableSerializer());
customSerializers.registerType(TypeToken.of(MinecraftMaterialWrapper.class), new MinecraftMaterialWrapperSerializer());
@@ -325,22 +321,21 @@ public final class ConfigManager {
/**
* Gets the serializers registered and used by mcMMO
* This includes all default serializers
*
* @return our custom serializers
*/
public TypeSerializerCollection getCustomSerializers() {
return customSerializers;
}
private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz)
{
private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz) {
skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(primarySkillType, clazz));
}
/**
* Misc managers
*/
private void initMiscManagers()
{
private void initMiscManagers() {
experienceMapManager = new ExperienceMapManager();
}
@@ -361,8 +356,7 @@ public final class ConfigManager {
/**
* Initializes any managers related to config collections
*/
private void initCollectionManagers()
{
private void initCollectionManagers() {
// Handles registration of repairables
repairableManager = new RepairableManager(getRepairables());
unloadables.add(repairableManager);
@@ -378,30 +372,28 @@ public final class ConfigManager {
/**
* Get all loaded repairables (loaded from all repairable configs)
*
* @return the currently loaded repairables
*/
public ArrayList<Repairable> getRepairables()
{
public ArrayList<Repairable> getRepairables() {
return getConfigRepair().getConfigRepairablesList();
}
/**
* Get all loaded salvageables (loaded from all salvageable configs)
*
* @return the currently loaded salvageables
*/
public ArrayList<Salvageable> getSalvageables()
{
public ArrayList<Salvageable> getSalvageables() {
return getConfigSalvage().getConfigSalvageablesList();
}
/**
* Unloads all config options (prepares for reload)
*/
public void unloadAllConfigsAndRegisters()
{
public void unloadAllConfigsAndRegisters() {
//Unload
for(Unload unloadable : unloadables)
{
for (Unload unloadable : unloadables) {
unloadable.unload();
}
@@ -414,9 +406,8 @@ public final class ConfigManager {
* Registers an unloadable
* Unloadables call unload() on plugin disable to cleanup registries
*/
public void registerUnloadable(Unload unload)
{
if(!unloadables.contains(unload))
public void registerUnloadable(Unload unload) {
if (!unloadables.contains(unload))
unloadables.add(unload);
}
@@ -424,24 +415,21 @@ public final class ConfigManager {
* Registers an unloadable
* Unloadables call unload() on plugin disable to cleanup registries
*/
public void registerUserFile(File userFile)
{
if(!userFiles.contains(userFile))
public void registerUserFile(File userFile) {
if (!userFiles.contains(userFile))
userFiles.add(userFile);
}
/**
* Registers bonus drops from several skill configs
*/
public void registerBonusDrops()
{
public void registerBonusDrops() {
bonusDropManager.addToWhitelistByNameID(getConfigMining().getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configWoodcutting.getBonusDrops());
}
public void validateConfigs()
{
public void validateConfigs() {
}
@@ -451,10 +439,10 @@ public final class ConfigManager {
/**
* Used to back up our zip files real easily
*
* @return
*/
public ArrayList<File> getConfigFiles()
{
public ArrayList<File> getConfigFiles() {
return userFiles;
}
@@ -510,9 +498,13 @@ public final class ConfigManager {
return experienceMapManager;
}
public ConfigDatabase getConfigDatabase() { return configDatabase.getConfig(); }
public ConfigDatabase getConfigDatabase() {
return configDatabase.getConfig();
}
public ConfigScoreboard getConfigScoreboard() { return configScoreboard.getConfig(); }
public ConfigScoreboard getConfigScoreboard() {
return configScoreboard.getConfig();
}
public ConfigLeveling getConfigLeveling() {
return configLeveling.getConfig();
@@ -658,25 +650,22 @@ public final class ConfigManager {
* Checks if this plugin is using retro mode
* Retro mode is a 0-1000 skill system
* Standard mode is scaled for 1-100
*
* @return true if retro mode is enabled
*/
public boolean isRetroMode()
{
public boolean isRetroMode() {
return getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled();
}
public boolean isBonusDropsEnabled(Material material)
{
public boolean isBonusDropsEnabled(Material material) {
return getBonusDropManager().isBonusDropWhitelisted(material);
}
public double getSkillMaxBonusLevel(SubSkillType subSkillType)
{
public double getSkillMaxBonusLevel(SubSkillType subSkillType) {
return skillPropertiesManager.getMaxBonusLevel(subSkillType);
}
public double getSkillMaxChance(SubSkillType subSkillType)
{
public double getSkillMaxChance(SubSkillType subSkillType) {
return skillPropertiesManager.getMaxChance(subSkillType);
}

View File

@@ -9,12 +9,11 @@ import java.io.File;
public abstract class ConfigValidated extends Config implements UnsafeValueValidation {
/**
* @param pathToParentFolder File for the "parent" folder on disk
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
*/
public ConfigValidated(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys)
{
public ConfigValidated(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
validateEntries();
}

View File

@@ -19,8 +19,9 @@ public class CoreSkillsConfig extends Config {
/**
* This grabs an instance of the class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
@@ -55,7 +56,7 @@ public class CoreSkillsConfig extends Config {
* @return true if subskill is enabled
*/
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill) {
return getBooleanValue(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString()), abstractSubSkill.getConfigKeyName(), ENABLED);
return getBooleanValue(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString()), abstractSubSkill.getConfigKeyName(), ENABLED);
}
/**
@@ -65,6 +66,6 @@ public class CoreSkillsConfig extends Config {
* @return true if enabled
*/
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) {
return getBooleanValue(StringUtils.getCapitalized(primarySkillType.toString()), ENABLED);
return getBooleanValue(StringUtils.getCapitalized(primarySkillType.toString()), ENABLED);
}
}

View File

@@ -4,11 +4,13 @@ import java.util.Collection;
/**
* Represents a class that contains a generic collection
*
* @param <T>
*/
public interface GenericCollectionContainer<T> {
/**
* Grab the collection held by this class
*
* @return the collection held by this class
*/
Collection<T> getLoadedCollection();

View File

@@ -208,8 +208,9 @@ public class MainConfig extends ConfigValidated {
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated

View File

@@ -23,8 +23,9 @@ public class RankConfig extends ConfigValidated {
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated

View File

@@ -6,11 +6,10 @@ import com.gmail.nossr50.util.StringUtils;
public class SkillConfigFactory {
protected static SerializedConfigLoader initSkillConfig(PrimarySkillType primarySkillType, Class<?> clazz)
{
protected static SerializedConfigLoader initSkillConfig(PrimarySkillType primarySkillType, Class<?> clazz) {
return new SerializedConfigLoader(clazz,
primarySkillType.toString().toLowerCase() + ".conf",
StringUtils.getCapitalized(primarySkillType.toString()),
null);
primarySkillType.toString().toLowerCase() + ".conf",
StringUtils.getCapitalized(primarySkillType.toString()),
null);
}
}

View File

@@ -14,37 +14,31 @@ public class SkillPropertiesManager {
private HashMap<SubSkillType, Double> maxBonusLevelMap;
private HashMap<SubSkillType, Double> maxBonusPercentage;
public SkillPropertiesManager()
{
public SkillPropertiesManager() {
maxChanceMap = new HashMap<>();
maxBonusLevelMap = new HashMap<>();
maxBonusPercentage = new HashMap<>();
}
public void registerRNG(SubSkillType subSkillType, ConfigSubSkillScalingRNG config)
{
public void registerRNG(SubSkillType subSkillType, ConfigSubSkillScalingRNG config) {
maxChanceMap.put(subSkillType, config.getMaxChance());
maxBonusLevelMap.put(subSkillType, config.getMaxBonusLevel());
}
public double getMaxChance(SubSkillType subSkillType)
{
public double getMaxChance(SubSkillType subSkillType) {
return maxChanceMap.get(subSkillType);
}
public double getMaxBonusLevel(SubSkillType subSkillType)
{
public double getMaxBonusLevel(SubSkillType subSkillType) {
return maxBonusLevelMap.get(subSkillType);
}
public void fillRegisters()
{
public void fillRegisters() {
fillRNGRegisters();
}
private void fillRNGRegisters()
{
private void fillRNGRegisters() {
//Acrobatics
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getDodge().getRNGSettings());
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getRoll().getRNGSettings());

View File

@@ -24,8 +24,9 @@ public class SoundConfig extends ConfigValidated {
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated

View File

@@ -13,18 +13,15 @@ public interface UnsafeValueValidation {
/**
* Prints all errors found when validating the config
*/
default void validateEntries()
{
default void validateEntries() {
/*
* Print Errors about Keys
*/
List<String> validKeyErrors = validateKeys(); // Validate Keys
if(validKeyErrors != null && validKeyErrors.size() > 0)
{
for(String error : validKeyErrors)
{
if (validKeyErrors != null && validKeyErrors.size() > 0) {
for (String error : validKeyErrors) {
mcMMO.p.getLogger().severe(error);
}
}

View File

@@ -6,6 +6,7 @@ package com.gmail.nossr50.config;
public interface VersionedConfig {
/**
* The version of this config
*
* @return
*/
double getConfigVersion();

View File

@@ -86,8 +86,9 @@ public class ExperienceConfig extends ConfigValidated {
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
@@ -168,9 +169,6 @@ public class ExperienceConfig extends ConfigValidated {
return reason;
}
/*
* FORMULA SETTINGS
*/
@@ -185,8 +183,7 @@ public class ExperienceConfig extends ConfigValidated {
return getDoubleValue(EXPERIENCE_FORMULA, MULTIPLIER, GLOBAL);
}
public void setGlobalXPMultiplier(double newXpMultiplier)
{
public void setGlobalXPMultiplier(double newXpMultiplier) {
getUserRootNode().getNode(EXPERIENCE_FORMULA, MULTIPLIER, GLOBAL).setValue(newXpMultiplier);
}
@@ -266,14 +263,15 @@ public class ExperienceConfig extends ConfigValidated {
/**
* Gets the raw XP given for breaking this block, this does not include modifiers
* @param skill The skill to give XP for
*
* @param skill The skill to give XP for
* @param blockType the type of block
* @return the raw amount of XP for this block before modifiers
*/
//public int getXp(PrimarySkillType skill, BlockType blockType) {
public int getXp(PrimarySkillType skill, Material blockType) {
//TODO: This is going to need to be changed, this code here is only placeholder
String[] path = new String[]{ EXPERIENCE, StringUtils.getCapitalized(skill.toString()), blockType.toString()};
String[] path = new String[]{EXPERIENCE, StringUtils.getCapitalized(skill.toString()), blockType.toString()};
return getIntValue(path);
}

View File

@@ -4,14 +4,12 @@ import com.gmail.nossr50.util.StringUtils;
public final class HOCONUtil {
public static String serializeENUMName(String hyphenedString)
{
public static String serializeENUMName(String hyphenedString) {
String[] split = hyphenedString.split("_");
StringBuilder formattedString = new StringBuilder();
for(int x = 0; x < split.length; x++)
{
if(x + 1 >= split.length)
for (int x = 0; x < split.length; x++) {
if (x + 1 >= split.length)
formattedString.append(StringUtils.getCapitalized(split[x]));
else
formattedString.append(StringUtils.getCapitalized(split[x])).append('-');
@@ -20,14 +18,12 @@ public final class HOCONUtil {
return formattedString.toString();
}
public static String deserializeENUMName(String serializedName)
{
public static String deserializeENUMName(String serializedName) {
String[] split = serializedName.split("-");
StringBuilder formattedString = new StringBuilder();
for(int x = 0; x < split.length; x++)
{
if(x + 1 >= split.length)
for (int x = 0; x < split.length; x++) {
if (x + 1 >= split.length)
formattedString.append(split[x].toUpperCase());
else
formattedString.append(split[x]).append('_');

View File

@@ -46,7 +46,8 @@ public class RepairableSerializer implements TypeSerializer<Repairable> {
/* Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) */
String item = value.getNode(ITEM).getValue(TypeToken.of(String.class));
List<String> repairItems = value.getNode(ITEMS_USED_TO_REPAIR).getValue(new TypeToken<List<String>>() {});
List<String> repairItems = value.getNode(ITEMS_USED_TO_REPAIR).getValue(new TypeToken<List<String>>() {
});
/*String itemConstant = HOCONUtil.deserializeENUMName(value.getNode("Item").getString());
@@ -74,8 +75,7 @@ public class RepairableSerializer implements TypeSerializer<Repairable> {
value.getNode(XP_MULTIPLIER).setValue(obj.getXpMultiplier());
}
private Enum getEnum(String enumConstant, TypeToken<?> type) throws ObjectMappingException
{
private Enum getEnum(String enumConstant, TypeToken<?> type) throws ObjectMappingException {
//noinspection RedundantCast
Optional<Enum> ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class),
enumConstant); // XXX: intellij says this cast is optional but it isnt

View File

@@ -61,8 +61,7 @@ public class SalvageableSerializer implements TypeSerializer<Salvageable> {
value.getNode(OVERRIDE_LEVEL_REQUIREMENT).setValue(obj.getMinimumLevel());
}
private Enum getEnum(String enumConstant, TypeToken<?> type) throws ObjectMappingException
{
private Enum getEnum(String enumConstant, TypeToken<?> type) throws ObjectMappingException {
//noinspection RedundantCast
Optional<Enum> ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class),
enumConstant); // XXX: intellij says this cast is optional but it isnt

View File

@@ -49,6 +49,7 @@ import java.util.Objects;
/**
* Handles loading serialized configs with configurate
*
* @param <T> the class type of the config
*/
public class SerializedConfigLoader<T> {
@@ -61,20 +62,15 @@ public class SerializedConfigLoader<T> {
"\nOfficial mcMMO Discord - https://discord.gg/bJ7pFS9\n" +
"\nYou can also consult the new official wiki" +
"\nhttps://mcmmo.org/wiki - Keep in mind the wiki is a WIP and may not have information about everything in mcMMO!";
private ConfigurationOptions configurationOptions;
private CommentedConfigurationNode data;
private CommentedConfigurationNode fileData;
private final String ROOT_NODE_ADDRESS;
private final Path path;
/**
* The parent configuration - values are inherited from this
*/
private final SerializedConfigLoader parent;
private ConfigurationOptions configurationOptions;
private CommentedConfigurationNode data;
private CommentedConfigurationNode fileData;
/**
* The loader (mapped to a file) used to read/write the config to disk
*/
@@ -110,13 +106,12 @@ public class SerializedConfigLoader<T> {
reload();
save();
} catch (Exception e) {
mcMMO.p.getLogger().severe("Failed to initialize config - "+path.toString());
mcMMO.p.getLogger().severe("Failed to initialize config - " + path.toString());
e.printStackTrace();
}
}
private Path getPathFromFileName(String fileName)
{
private Path getPathFromFileName(String fileName) {
File configFile = new File(ConfigConstants.getConfigFolder(), fileName);
return configFile.toPath();
}
@@ -143,7 +138,7 @@ public class SerializedConfigLoader<T> {
this.loader.save(saveNode);
return true;
} catch (IOException | ObjectMappingException e) {
mcMMO.p.getLogger().severe("Failed to save configuration - "+path.toString());
mcMMO.p.getLogger().severe("Failed to save configuration - " + path.toString());
e.printStackTrace();
return false;
}
@@ -169,7 +164,7 @@ public class SerializedConfigLoader<T> {
// populate the config object
populateInstance();
} catch (Exception e) {
mcMMO.p.getLogger().severe("Failed to load configuration - "+path.toString());
mcMMO.p.getLogger().severe("Failed to load configuration - " + path.toString());
e.printStackTrace();
}
}

View File

@@ -5,18 +5,17 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class AntiExploit {
public static final boolean SPAWNED_MOBS_DEFAULT = true;
private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true;
private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true;
public static final boolean SPAWNED_MOBS_DEFAULT = true;
/*
* CONFIG NODES
*/
@Setting(value = "Endermen-Endermite-Fix",
comment = "Removes XP from Endermen that target endermite, this is a common exploit in The End because of how rapidly they can spawn." +
"\nIt is recommended that you leave this on as it allows players to easily gain massive amounts of combat XP" +
"\nDefault value: "+ENDERMEN_ENDERMITE_DEFAULT)
"\nDefault value: " + ENDERMEN_ENDERMITE_DEFAULT)
private boolean endermenEndermiteFix = ENDERMEN_ENDERMITE_DEFAULT;
@Setting(value = "Pistons-Mark-Blocks-As-Unnatural",
@@ -26,7 +25,7 @@ public class AntiExploit {
@Setting(value = "Spawned-Mobs-Give-No-XP",
comment = "Spawned mobs will not give players combat XP." +
"\nThis includes mobs spawned from a nether portal, mob spawner, or eggs." +
"\nThis will not include mobs spawned from commands, typically.")
"\nThis includes mobs spawned from a nether portal, mob spawner, or eggs." +
"\nThis will not include mobs spawned from commands, typically.")
private boolean spawnedMobsGiveNoXP = SPAWNED_MOBS_DEFAULT;
}

View File

@@ -18,7 +18,7 @@ public class ConfigSectionExploitAcrobatics {
"\nPlayers cannot gain XP from falling in the same location twice." +
"\nIt's best you do not raise this number unless you have some kind of god computer," +
"\n mcMMO processes the entire tracked location list anytime a player takes fall damage so the bigger this is the more expensive that calculation is." +
"\nDefault value: "+ACROBATIC_LOCATION_LIMIT_DEFAULT)
"\nDefault value: " + ACROBATIC_LOCATION_LIMIT_DEFAULT)
private int acrobaticLocationLimit = ACROBATIC_LOCATION_LIMIT_DEFAULT;
@Setting(value = "Prevent-Acrobatics-Farming",
@@ -26,16 +26,16 @@ public class ConfigSectionExploitAcrobatics {
"\nEnabled tracking player fall locations" +
"\nEnables tracking when a player last teleported" +
"\nEnables tracking when a player last respawned" +
"\nDefault value: "+PREVENT_ACROBATICS_ABUSE_DEFAULT)
"\nDefault value: " + PREVENT_ACROBATICS_ABUSE_DEFAULT)
private boolean preventAcrobaticsAbuse = PREVENT_ACROBATICS_ABUSE_DEFAULT;
@Setting(value = "No-XP-After-Teleporting-Cooldown-In-Seconds", comment = "Prevents XP gains for Acrobatics for a set period of time after teleporting." +
"\nDefault value: "+TELEPORT_COOLDOWN_DEFAULT)
"\nDefault value: " + TELEPORT_COOLDOWN_DEFAULT)
private int teleportCooldownSeconds = TELEPORT_COOLDOWN_DEFAULT;
@Setting(value = "Fall-Damage-XP-Gain-Cooldown-In-Seconds", comment = "Prevent players from gaining XP from fall damage if they had gained XP recently." +
"\nWhen players take fall damage again within this cooldown period the length of the cooldown is increased to discourage automated Roll XP farming." +
"\nDefault value: "+ROLL_XP_GAIN_CD_DEFAULT)
"\nDefault value: " + ROLL_XP_GAIN_CD_DEFAULT)
private int rollXPGainCooldownSeconds = ROLL_XP_GAIN_CD_DEFAULT;
public int getRollXPGainCooldownSeconds() {

View File

@@ -6,24 +6,23 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionExploitFishing {
private static final boolean PREVENT_FISHING_EXPLOITS_DEFAULT = true;
public static final int OVER_FISHING_LIMIT_DEFAULT = 3;
public static final boolean ADMINS_OVER_FISHING_DEFAULT = true;
public static final float OVER_FISHING_SIZE = 1.0F;
public static final int FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT = 200;
private static final boolean PREVENT_FISHING_EXPLOITS_DEFAULT = true;
@Setting(value = "Prevent-Fishing-AFK-Farming",
comment = "Prevents many methods for automatically farming Fishing XP." +
"\nSuch as farming in the same spot more than once." +
"\nSpam-click fishing." +
"\nDefault value: "+PREVENT_FISHING_EXPLOITS_DEFAULT)
"\nDefault value: " + PREVENT_FISHING_EXPLOITS_DEFAULT)
private boolean preventFishingExploits = PREVENT_FISHING_EXPLOITS_DEFAULT;
@Setting(value = "Overfishing-Limit", comment = "How many times a player can fish in the same spot before it becomes over-fished" +
"\nOver fishing is in place to prevent 99% of AFK fishing from working." +
"\nFishing in a new spot is all it takes to remove over-fishing from your previous location." +
"\nOver-fishing is based on where your fishing bobber actually lands and catches fish, it has nothing to do with where you are standing." +
"\nDefault value: "+OVER_FISHING_LIMIT_DEFAULT)
"\nDefault value: " + OVER_FISHING_LIMIT_DEFAULT)
private int overfishingLimit = OVER_FISHING_LIMIT_DEFAULT;
@Setting(value = "Overfishing-Area-Size-Radius", comment = "Over-Fishing tracks where you've caught fish from by making a bounding box around where your fishing rod's bobber lands." +
@@ -32,18 +31,18 @@ public class ConfigSectionExploitFishing {
"\nA value of 1.0 would result in a bounding box that is 2.0 units (blocks) in size" +
"\nWhen you catch a new fish it makes a new bounding box at that location and checks to see if it overlaps with the bounding box of the last place you caught a fish," +
"\n if they intersect then that increases your fish counter, if you are at your fishing limit then you get nothing." +
"\nDefault value: "+OVER_FISHING_SIZE)
"\nDefault value: " + OVER_FISHING_SIZE)
private float overFishingAreaSize = OVER_FISHING_SIZE;
@Setting(value = "Alert-Admins-To-Overfishing-Abuse", comment = "If someone is triggering over-fishing exploit detection too often, alert admins." +
"\nThis will send a message to ops in game and to the console, and to anyone with the admin chat permission node." +
"\nDefault value: "+ADMINS_OVER_FISHING_DEFAULT)
"\nDefault value: " + ADMINS_OVER_FISHING_DEFAULT)
private boolean alertAdminsOnOverFishing = ADMINS_OVER_FISHING_DEFAULT;
@Setting(value = "Fishing-Rod-Spam-Threshold-In-Milliseconds", comment = "How many milliseconds in between casting the fishing rod before a player suffers from fatigue." +
"\nFatigue causes a loss of 1 hunger and 5 durability damage to the currently held fishing rod." +
"\nThis is to prevent exploits for fishing that involve rapid fire auto clickers." +
"\nDefault value: "+FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT)
"\nDefault value: " + FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT)
private long fishingRodSpamMilliseconds = FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT;
public long getFishingRodSpamMilliseconds() {

View File

@@ -6,39 +6,38 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionGeneral {
private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true;
private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true;
public static final boolean SPAWNED_MOBS_DEFAULT = true;
public static final boolean TAMED_MOB_DEFAULT = true;
private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true;
private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true;
@Setting(value = "Endermen-Endermite-Fix",
comment = "Removes XP from Endermen that target endermite, this is a common exploit in The End because of how rapidly they can spawn." +
"\nIt is recommended that you leave this on as it allows players to easily gain massive amounts of combat XP" +
"\nDefault value: "+ENDERMEN_ENDERMITE_DEFAULT)
"\nDefault value: " + ENDERMEN_ENDERMITE_DEFAULT)
private boolean endermenEndermiteFix = ENDERMEN_ENDERMITE_DEFAULT;
@Setting(value = "Pistons-Mark-Blocks-As-Unnatural",
comment = "Unnatural blocks give no XP." +
"This helps prevent complex automated stone farms that enable auto clickers to gain XP passively." +
"\nDefault value: "+PISTONS_MARK_BLOCKS_DEFAULT)
"\nDefault value: " + PISTONS_MARK_BLOCKS_DEFAULT)
private boolean pistonsMarkBlocksUnnatural = PISTONS_MARK_BLOCKS_DEFAULT;
@Setting(value = "Spawned-Mobs-Have-Modified-XP-Values",
comment =
"Spawned mobs will give different XP values than their naturally spawning counterparts" +
"\nBy default, spawned mob XP is reduced to zero, but you could change it in the experience config to whatever you want." +
"\nSpawned mobs include mobs spawned from a nether portal, mob spawner, or eggs." +
"\nThis will not include mobs spawned from commands, typically." +
"\nDefault value: "+SPAWNED_MOBS_DEFAULT)
"\nBy default, spawned mob XP is reduced to zero, but you could change it in the experience config to whatever you want." +
"\nSpawned mobs include mobs spawned from a nether portal, mob spawner, or eggs." +
"\nThis will not include mobs spawned from commands, typically." +
"\nDefault value: " + SPAWNED_MOBS_DEFAULT)
private boolean markSpawnedMobs = SPAWNED_MOBS_DEFAULT;
@Setting(value = "Tamed-Entities-Have-Modified-XP-Values",
comment =
"Prevents tamed entities from giving normal combat XP when struck by players" +
"\nBy default, combat XP from tamed mobs is reduced to zero, but you could change it in the experience config to whatever you want." +
"\nIt's hard to imagine this being abused, but we disable it anyways." +
"\nTamed entities get marked in the same way that spawned mobs do, so they are affected by the same XP modifiers." +
"\nDefault value: "+TAMED_MOB_DEFAULT)
"\nBy default, combat XP from tamed mobs is reduced to zero, but you could change it in the experience config to whatever you want." +
"\nIt's hard to imagine this being abused, but we disable it anyways." +
"\nTamed entities get marked in the same way that spawned mobs do, so they are affected by the same XP modifiers." +
"\nDefault value: " + TAMED_MOB_DEFAULT)
private boolean preventTamedMobXp = TAMED_MOB_DEFAULT;
public boolean getEndermenEndermiteFix() {

View File

@@ -14,12 +14,12 @@ public class ConfigAutomatedBackups {
"\nYou can find the backups in the following directory inside your mcMMO folder - \\mcMMO\\backup" +
"\nAutomated backups are deleted regularly once they reach a certain age, see the other options in this config to change this." +
"\nBackups are made whenever you start your server for the first time and on each reload of the mcMMO plugin" +
"\nDefault value: "+ZIP_BACKUPS_ENABLED_DEFAULT)
"\nDefault value: " + ZIP_BACKUPS_ENABLED_DEFAULT)
private boolean zipBackupsEnabled = ZIP_BACKUPS_ENABLED_DEFAULT;
@Setting(value = "Old-File-Age-Limit-In-Days", comment = "How many days should backups be kept in days?" +
"\nBackups older than this are removed if the number of file backups is greater than \"Minimum-Backups\"." +
"\nDefault value: "+ BACKUP_DAY_LIMIT_DEFAULT)
"\nDefault value: " + BACKUP_DAY_LIMIT_DEFAULT)
private int backupDayLimit = BACKUP_DAY_LIMIT_DEFAULT;
public boolean isZipBackupsEnabled() {

View File

@@ -8,18 +8,16 @@ public class ConfigCommandsAdminChat {
private static final String ADMIN_CHAT_PREFIX_DEFAULT = "&b[&f{0}&b]";
private static final boolean USE_DISPLAY_NAMES_DEFAULT = true;
@Setting(value = "Admin-Chat-Prefix", comment = "Formatting use at the beginning of an admin chat message." +
"\nYou can use & color codes here or type stuff like [[RED]]." +
"\nDefault value: "+ADMIN_CHAT_PREFIX_DEFAULT)
private String adminChatPrefix = ADMIN_CHAT_PREFIX_DEFAULT;
@Setting(value = "Whether or not to use Display Names for admin chat." +
"\nDisplay names are the current visible name of a player in the scoreboard, chat, and so on." +
"\nThese names are modified by mods and are not necessarily the same nickname that a player has associated with their account." +
"\nIf you turn this off, mcMMO will use a players registered nickname with their Minecraft account instead." +
"\nDefault value: "+USE_DISPLAY_NAMES_DEFAULT)
"\nDefault value: " + USE_DISPLAY_NAMES_DEFAULT)
public boolean useDisplayNames = USE_DISPLAY_NAMES_DEFAULT;
@Setting(value = "Admin-Chat-Prefix", comment = "Formatting use at the beginning of an admin chat message." +
"\nYou can use & color codes here or type stuff like [[RED]]." +
"\nDefault value: " + ADMIN_CHAT_PREFIX_DEFAULT)
private String adminChatPrefix = ADMIN_CHAT_PREFIX_DEFAULT;
public String getAdminChatPrefix() {
return adminChatPrefix;

View File

@@ -13,17 +13,17 @@ public class ConfigCommandsInspect {
@Setting(value = "Inspect-Max-Distance", comment = "The maximum range at which players can inspect one another." +
"\nIs only used if limit inspect range is turned on." +
"\nDefault value: "+INSPECT_MAX_DISTANCE_DEFAULT)
"\nDefault value: " + INSPECT_MAX_DISTANCE_DEFAULT)
private double inspectCommandMaxDistance = INSPECT_MAX_DISTANCE_DEFAULT;
@Setting(value = "Limit-Inspect-Range", comment = "Inspection is limited by the distance between players instead of always being usable." +
"Permission to bypass this limit - " + BYPASS_PERMISSION
+"\nDefault value: "+LIMIT_INSPECT_RANGE_DEFAULT)
+ "\nDefault value: " + LIMIT_INSPECT_RANGE_DEFAULT)
private boolean limitInspectRange = LIMIT_INSPECT_RANGE_DEFAULT;
@Setting(value = "Allow-Offline-Inspection", comment = "If set to true players will be able to look at the profiles of anyone on the server whether they are connected or not." +
"\nAdmins and the console can always check the profiles of offline players." +
"\nDefault value: "+ALLOW_OFFLINE_INSPECTION_DEFAULT)
"\nDefault value: " + ALLOW_OFFLINE_INSPECTION_DEFAULT)
private boolean allowInspectOnOfflinePlayers = ALLOW_OFFLINE_INSPECTION_DEFAULT;
public double getInspectCommandMaxDistance() {

View File

@@ -10,7 +10,7 @@ public class ConfigDatabaseFlatFile {
@Setting(value = "Scoreboard-Leaderboard-Update-Interval", comment = "How often the scoreboard leaderboards will update." +
"\nThis is an expensive operation, it is highly recommended to avoid doing this often." +
"\nDefault value: "+LEADERBOARD_SCOREBOARD_UPDATE_INTERVAL_MINUTES_DEFAULT)
"\nDefault value: " + LEADERBOARD_SCOREBOARD_UPDATE_INTERVAL_MINUTES_DEFAULT)
private int leaderboardUpdateIntervalMinutes = LEADERBOARD_SCOREBOARD_UPDATE_INTERVAL_MINUTES_DEFAULT;
public int getLeaderboardUpdateIntervalMinutes() {

View File

@@ -19,26 +19,26 @@ public class ConfigSectionCleaning {
@Setting(value = "Purge-Old-Users",
comment = "Turn this on to enable automatic database pruning of old users." +
"\nDefault value: "+PURGE_OLD_USERS)
"\nDefault value: " + PURGE_OLD_USERS)
private boolean purgeOldUsers = PURGE_OLD_USERS;
@Setting(value = "Purge-Powerless-Users", comment = "Powerless users are players who have not" +
" leveled up in a single skill." +
"\nDefault value: "+PURGE_POWERLESS_USERS)
"\nDefault value: " + PURGE_POWERLESS_USERS)
private boolean purgePowerlessUsers = PURGE_POWERLESS_USERS;
@Setting(value = "Only-Purge-At-Plugin-Startup",
comment = "If set to true, then purging will only happen when the plugin first loads." +
"\nKeep in mind, this will trigger on reload as well." +
"\nThis purge is on a 2 second delay from plugin start-up and runs in an ASYNC thread." +
"\nDefault value: "+ONLY_PURGE_AT_STARTUP)
"\nDefault value: " + ONLY_PURGE_AT_STARTUP)
private boolean onlyPurgeAtStartup = ONLY_PURGE_AT_STARTUP;
@Setting(value = "Purge-Interval-In-Hours", comment = "How many hours between automatic purging?")
private int purgeInterval = PURGE_INTERVAL_DEFAULT;
@Setting(value = "Old-User-Cutoff-In-Months", comment = "Users who haven't connected in this many months will be purged" +
"\nDefault value: "+OLD_USER_CUTOFF_IN_MONTHS)
"\nDefault value: " + OLD_USER_CUTOFF_IN_MONTHS)
private int oldUserCutoffMonths = OLD_USER_CUTOFF_IN_MONTHS;
/*

View File

@@ -12,7 +12,7 @@ public class ConfigSectionDatabaseGeneral {
"\nSaving the database is an expensive operation although it is done in an ASYNC thread." +
"\nI wouldn't recommend setting this value lower than 10 minutes" +
"\nKeep in mind if you properly shut down your server with a stop command mcMMO saves before your server shuts down." +
"\nDefault value: "+SAVE_INTERVAL_MINUTES_DEFAULT)
"\nDefault value: " + SAVE_INTERVAL_MINUTES_DEFAULT)
private int saveIntervalMinutes = SAVE_INTERVAL_MINUTES_DEFAULT;
public int getSaveIntervalMinutes() {

View File

@@ -15,13 +15,13 @@ public class ConfigSectionMaxConnections {
* CONFIG NODES
*/
@Setting(value = "Misc-Connection-Limit", comment = "Default value: "+MISC_DEFAULT)
@Setting(value = "Misc-Connection-Limit", comment = "Default value: " + MISC_DEFAULT)
private int misc = 30;
@Setting(value = "Load-Connection-Limit", comment = "Default value: "+LOAD_DEFAULT)
@Setting(value = "Load-Connection-Limit", comment = "Default value: " + LOAD_DEFAULT)
private int load = 30;
@Setting(value = "Save-Connection-Limit", comment = "Default value: "+SAVE_DEFAULT)
@Setting(value = "Save-Connection-Limit", comment = "Default value: " + SAVE_DEFAULT)
private int save = 30;
/*

View File

@@ -15,13 +15,13 @@ public class ConfigSectionMaxPoolSize {
* CONFIG NODES
*/
@Setting(value = "Misc-Pool", comment = "Default value: "+MISC_DEFAULT)
@Setting(value = "Misc-Pool", comment = "Default value: " + MISC_DEFAULT)
private int misc = 10;
@Setting(value = "Load-Pool", comment = "Default value: "+LOAD_DEFAULT)
@Setting(value = "Load-Pool", comment = "Default value: " + LOAD_DEFAULT)
private int load = 20;
@Setting(value = "Save-Pool", comment = "Default value: "+SAVE_DEFAULT)
@Setting(value = "Save-Pool", comment = "Default value: " + SAVE_DEFAULT)
private int save = 20;
/*

View File

@@ -17,7 +17,7 @@ public class ConfigSectionMySQL {
@Setting(value = "Use-MySQL", comment = "If set to true, mcMMO will use MySQL/MariaDB instead of FlatFile storage" +
"\nIt is highly recommended to use a MySQL/MariaDB server over FlatFile," +
" especially if the number of players on your Minecraft server is fairly high." +
"\nDefault value: "+USE_MYSQL_DEFAULT)
"\nDefault value: " + USE_MYSQL_DEFAULT)
private boolean useMySQL = USE_MYSQL_DEFAULT;
@Setting(value = "User", comment = "Your MySQL User Settings")
@@ -53,10 +53,8 @@ public class ConfigSectionMySQL {
* HELPER METHODS
*/
public int getMaxPoolSize(PoolIdentifier poolIdentifier)
{
switch (poolIdentifier)
{
public int getMaxPoolSize(PoolIdentifier poolIdentifier) {
switch (poolIdentifier) {
case LOAD:
return userConfigSectionServer.getConfigSectionMaxPoolSize().getLoad();
case SAVE:
@@ -68,10 +66,8 @@ public class ConfigSectionMySQL {
}
}
public int getMaxConnections(PoolIdentifier poolIdentifier)
{
switch (poolIdentifier)
{
public int getMaxConnections(PoolIdentifier poolIdentifier) {
switch (poolIdentifier) {
case LOAD:
return userConfigSectionServer.getConfigSectionMaxConnections().getLoad();
case SAVE:

View File

@@ -15,20 +15,20 @@ public class UserConfigSectionServer {
* CONFIG NODES
*/
@Setting(value = "Use-SSL", comment = "Enables SSL for MySQL/MariaDB connections." +
"\nIf your SQL server supports SSL, it is recommended to have it on but not necessary." +
"\nIf you run into any issues involving SSL, its best to just turn this off." +
"\nDefault value: "+USE_SSL_DEFAULT)
@Setting(value = "Use-SSL", comment = "Enables SSL for MySQL/MariaDB connections." +
"\nIf your SQL server supports SSL, it is recommended to have it on but not necessary." +
"\nIf you run into any issues involving SSL, its best to just turn this off." +
"\nDefault value: " + USE_SSL_DEFAULT)
private boolean useSSL = USE_SSL_DEFAULT;
@Setting(value = "Server-Port", comment = "Your MySQL/MariaDB server port" +
"\nThe default port is typically 3306 for MySQL, but every server configuration is different!" +
"\nDefault value: "+SERVER_PORT_DEFAULT)
"\nDefault value: " + SERVER_PORT_DEFAULT)
private int serverPort = SERVER_PORT_DEFAULT;
@Setting(value = "Server-Address", comment = "The address for your MySQL/MariaDB server" +
"If the MySQL server is hosted on the same machine, you can use the localhost alias" +
"\nDefault value: "+SERVER_ADDRESS_DEFAULT)
"\nDefault value: " + SERVER_ADDRESS_DEFAULT)
private String serverAddress = SERVER_ADDRESS_DEFAULT;
@Setting(value = "Max-Connections", comment = "This setting is the max simultaneous MySQL/MariaDB connections allowed at a time." +

View File

@@ -14,13 +14,13 @@ public class ConfigAuthorAdvertisements {
comment = "Shows donation info in various mcMMO commands." +
"\nSuch as a paypal link for the author on the /mcmmo command" +
"\nSupport through donations helps keep mcMMO development going." +
"\nDefault value: "+ SHOW_DONATION_DEFAULT)
"\nDefault value: " + SHOW_DONATION_DEFAULT)
private boolean showDonationInfo = SHOW_DONATION_DEFAULT;
@Setting(value = "Show-Patreon-Links",
comment = "Shows patreon links for the mcMMO author in various mcMMO commands." +
"\nSupport through Patreon helps keep mcMMO development going" +
"\nDefault value: "+SHOW_PATREON_DEFAULT)
"\nDefault value: " + SHOW_PATREON_DEFAULT)
private boolean showPatreonInfo = SHOW_PATREON_DEFAULT;
@Setting(value = "Show-Website-Links", comment = "Allows links to various affiliated websites for mcMMO." +
@@ -31,7 +31,7 @@ public class ConfigAuthorAdvertisements {
"\nThe mcMMO authors Patreon" +
"\nThe Official mcMMO Spigot Listing" +
"\nThe Official translation website for mcMMO" +
"\nDefault value: "+SHOW_WEBSITE_LINKS_DEFAULT)
"\nDefault value: " + SHOW_WEBSITE_LINKS_DEFAULT)
private boolean showWebsiteLinks = SHOW_WEBSITE_LINKS_DEFAULT;
public boolean isShowDonationInfo() {

View File

@@ -23,7 +23,7 @@ public class ConfigExperienceAcrobatics {
@Setting(value = "Feather-Fall-XP-Multiplier", comment = "Feather Fall grants bonus XP to fall related XP gains." +
"\nThis value is multiplied against your XP to give the bonus." +
"\nDefault value: "+FEATHER_FALL_MULTIPLIER_DEFAULT)
"\nDefault value: " + FEATHER_FALL_MULTIPLIER_DEFAULT)
private Double featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT;
public HashMap<String, Integer> getAcrobaticsXPMap() {
@@ -34,15 +34,15 @@ public class ConfigExperienceAcrobatics {
return featherFallMultiplier;
}
public int getDodgeXP(){
public int getDodgeXP() {
return acrobaticsXPMap.get("Dodge");
}
public int getRollXP(){
public int getRollXP() {
return acrobaticsXPMap.get("Roll");
}
public int getFallXP(){
public int getFallXP() {
return acrobaticsXPMap.get("Fall");
}

View File

@@ -11,11 +11,11 @@ public class ConfigExperienceAlchemy {
private final static HashMap<String, Integer> ALCHEMY_DEFAULT_XP_MAP;
static {
ALCHEMY_DEFAULT_XP_MAP = new HashMap<>();
ALCHEMY_DEFAULT_XP_MAP.put("Stage-One-Potion", 15);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Two-Potion", 30);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Three-Potion", 60);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Four-Potion", 120);
ALCHEMY_DEFAULT_XP_MAP = new HashMap<>();
ALCHEMY_DEFAULT_XP_MAP.put("Stage-One-Potion", 15);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Two-Potion", 30);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Three-Potion", 60);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Four-Potion", 120);
}
@Setting(value = "Alchemy-Experience-Values", comment = "Experience values for alchemy.")
@@ -26,23 +26,19 @@ public class ConfigExperienceAlchemy {
return alchemyXPMap;
}
public int getStageOnePotionXP()
{
public int getStageOnePotionXP() {
return alchemyXPMap.get("Stage-One-Potion");
}
public int getStageTwoPotionXP()
{
public int getStageTwoPotionXP() {
return alchemyXPMap.get("Stage-Two-Potion");
}
public int getStageThreePotionXP()
{
public int getStageThreePotionXP() {
return alchemyXPMap.get("Stage-Three-Potion");
}
public int getStageFourPotionXP()
{
public int getStageFourPotionXP() {
return alchemyXPMap.get("Stage-Four-Potion");
}
@@ -52,10 +48,8 @@ public class ConfigExperienceAlchemy {
return 0;
}*/
public int getPotionXPByStage(int potionStage)
{
switch(potionStage)
{
public int getPotionXPByStage(int potionStage) {
switch (potionStage) {
case 1:
return getStageOnePotionXP();
case 2:

View File

@@ -13,7 +13,7 @@ public class ConfigExperienceArchery {
"\nThe maximum distance bonus is 50, so expect this multiplier to peak at being multiplied against 50." +
"\nDistance is in blocks traveled." +
"\nThis value is added on to normal XP gains from damage for Archery." +
"\nDefault value: "+DISTANCE_MULTIPLIER_DEFAULT)
"\nDefault value: " + DISTANCE_MULTIPLIER_DEFAULT)
private double distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT;
public double getDistanceMultiplier() {

View File

@@ -9,6 +9,7 @@ import java.util.HashMap;
public class ConfigExperienceCombat {
private static final HashMap<String, Double> COMBAT_EXPERIENCE_DEFAULT;
private static final boolean PVP_XP_ENABLED_DEFAULT = false;
static {
COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();
@@ -73,14 +74,12 @@ public class ConfigExperienceCombat {
COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0D);
}
private static final boolean PVP_XP_ENABLED_DEFAULT = false;
@Setting(value = "Combat-XP-Multipliers")
private HashMap<String, Double> combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT;
@Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." +
"\nBe careful turning this on as this can potentially allow for unwanted behaviour from players." +
"\nDefault value: "+PVP_XP_ENABLED_DEFAULT)
"\nDefault value: " + PVP_XP_ENABLED_DEFAULT)
private boolean pvpXPEnabled = PVP_XP_ENABLED_DEFAULT;
public boolean isPvpXPEnabled() {

View File

@@ -8,8 +8,8 @@ import java.util.HashMap;
@ConfigSerializable
public class ConfigExperienceFishing {
private final static HashMap<String, Integer> FISHING_DEFAULT_XP_MAP;
public static final int SHAKE_XP_DEFAULT = 50;
private final static HashMap<String, Integer> FISHING_DEFAULT_XP_MAP;
static {
FISHING_DEFAULT_XP_MAP = new HashMap<>();

View File

@@ -36,7 +36,7 @@ public class ConfigExperienceRepair {
"\nThe Item XP multiplier defined in the Repair config (not this config)" +
"\nThe Base Repair XP defined here (default 1000.0)" +
"\nAnd finally, the XP multiplier of the item material category defined in this config." +
"\nDefault value: "+REPAIR_XP_BASE_DEFAULT)
"\nDefault value: " + REPAIR_XP_BASE_DEFAULT)
private double repairXPBase = REPAIR_XP_BASE_DEFAULT;
public HashMap<String, Double> getItemMaterialXPMultiplier() {

View File

@@ -8,14 +8,14 @@ public class ConfigLanguage {
public static final String TARGET_LANGUAGE_DEFAULT = "en_US";
public static final String AVAILABLE_LANGUAGE_LIST = "cs_CZ, cy, da, de, en_US, es, fi, fr, hu_HU, it, ja_JP, ko," +
"\n nl, pl, pt_BR, ru, sv, th_TH, zh_CN, zh_TW";
"\n nl, pl, pt_BR, ru, sv, th_TH, zh_CN, zh_TW";
@Setting(value = "Language", comment = "Which language mcMMO will use." +
"\nThe default language for mcMMO will be used for languages that do not have complete translations." +
"\nIf you'd wish to contribute to available languages please submit a pull request on our github" +
"\nhttps://github.com/mcMMO-Dev/mcMMO" +
"\nAvailable Languages: " + AVAILABLE_LANGUAGE_LIST +
"\n\nDefault value: "+TARGET_LANGUAGE_DEFAULT)
"\nAvailable Languages: " + AVAILABLE_LANGUAGE_LIST +
"\n\nDefault value: " + TARGET_LANGUAGE_DEFAULT)
private String targetLanguage = TARGET_LANGUAGE_DEFAULT;
public String getTargetLanguage() {

View File

@@ -11,7 +11,7 @@ public class ConfigMetrics {
@Setting(value = "Allow-Anonymous-Statistic-Collection", comment = "Collects info about what version of mcMMO you are using and other information" +
"\nAll information is completely anonymous, and that info is reported to bstats for data processing." +
"\nThis setting should have no affect on your server whatsoever, so I'd like to discourage you from turning it off." +
"\nDefault value: "+ALLOW_STAT_TRACKING_DEFAULT)
"\nDefault value: " + ALLOW_STAT_TRACKING_DEFAULT)
private boolean allowAnonymousUsageStatistics = ALLOW_STAT_TRACKING_DEFAULT;
public boolean isAllowAnonymousUsageStatistics() {

View File

@@ -13,16 +13,16 @@ public class ConfigSectionHealthBars {
public static final String displayTypesList = "\nYou can use the following MobHealthBarType values: HEARTS, BAR";
@Setting(value = "Enable-Health-Bars", comment = "Turn this off to disable health bars appearing above mobs when damaged." +
"\nDefault value: "+MOB_HEALTH_BARS_DEFAULT)
"\nDefault value: " + MOB_HEALTH_BARS_DEFAULT)
private boolean enableHealthBars = MOB_HEALTH_BARS_DEFAULT;
@Setting(value = "Display-Bar-Type", comment = "The type of display to use for the mobs health bar." +
displayTypesList +
"\nDefault value: "+HEARTS)
"\nDefault value: " + HEARTS)
private MobHealthbarType displayBarType = MobHealthbarType.HEARTS;
@Setting(value = "Display-Time-In-Seconds", comment = "How many seconds mob health bars should be displayed before being hidden." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
"\nDefault value: " + DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
public boolean isEnableHealthBars() {

View File

@@ -11,7 +11,7 @@ public class ConfigMOTD {
"\nHistorically this message is literally just telling players that the server runs mcMMO." +
"\nSometimes the MOTD includes warnings about build stability if using a volatile dev build." +
"\nIf you wish to edit the MOTD, that is done in the locale files inside the JAR." +
"\nDefault value: "+ENABLE_MOTD_DEFAULT)
"\nDefault value: " + ENABLE_MOTD_DEFAULT)
private boolean enableMOTD = ENABLE_MOTD_DEFAULT;
public boolean isEnableMOTD() {

View File

@@ -2,12 +2,10 @@ package com.gmail.nossr50.config.hocon.notifications;
public class ActionBarNotificationSetting {
public ActionBarNotificationSetting(boolean enabled, boolean sendCopyOfMessageToChat)
{
public boolean enabled;
public boolean sendCopyOfMessageToChat;
public ActionBarNotificationSetting(boolean enabled, boolean sendCopyOfMessageToChat) {
this.enabled = enabled;
this.sendCopyOfMessageToChat = sendCopyOfMessageToChat;
}
public boolean enabled;
public boolean sendCopyOfMessageToChat;
}

View File

@@ -8,7 +8,7 @@ public class ConfigNotificationGeneral {
public static final boolean PLAYER_TIPS_DEFAULT = true;
@Setting(value = "Player-Tips", comment = "Allows mcMMO to send players automated helpful tips." +
"\n Default value: "+PLAYER_TIPS_DEFAULT)
"\n Default value: " + PLAYER_TIPS_DEFAULT)
public boolean playerTips = PLAYER_TIPS_DEFAULT;
public boolean isPlayerTips() {

View File

@@ -7,7 +7,11 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
public class ConfigNotifications {
public static final boolean SUPER_ABILITY_TOOL_NOTIFICATION_DEFAULT = true;
@Setting(value = "Action-Bar-Notifications", comment = "Settings related to action bar messages." +
"\nThe action bar is the area above your health and armor.")
public ConfigActionBarNotifications actionBarNotifications = new ConfigActionBarNotifications();
@Setting(value = "General", comment = "General settings for Notifications")
public ConfigNotificationGeneral configNotificationGeneral = new ConfigNotificationGeneral();
@Setting(value = "Super-Ability-Tool-Raising-Lowering-Notification",
comment = "Notifies the player when they go into the tool readying state for super abilities.")
private boolean superAbilityToolMessage = SUPER_ABILITY_TOOL_NOTIFICATION_DEFAULT;
@@ -16,13 +20,6 @@ public class ConfigNotifications {
return superAbilityToolMessage;
}
@Setting(value = "Action-Bar-Notifications", comment = "Settings related to action bar messages." +
"\nThe action bar is the area above your health and armor.")
public ConfigActionBarNotifications actionBarNotifications = new ConfigActionBarNotifications();
@Setting(value = "General", comment = "General settings for Notifications")
public ConfigNotificationGeneral configNotificationGeneral = new ConfigNotificationGeneral();
public ConfigActionBarNotifications getActionBarNotifications() {
return actionBarNotifications;
}

View File

@@ -91,6 +91,8 @@ public class ConfigParty {
return partyCombat.isPartyFriendlyFire();
}
public boolean isPartySystemEnabled() { return partyGeneral.isEnablePartySystem(); }
public boolean isPartySystemEnabled() {
return partyGeneral.isEnablePartySystem();
}
}

View File

@@ -14,24 +14,24 @@ public class ConfigSectionPartyChat {
@Setting(value = "Prefix-Party-Members",
comment = "This is the formatting used for the prefix at the beginning of a party chat message." +
"Default value: "+PARTY_CHAT_PREFIX_FORMAT_DEFAULT)
"Default value: " + PARTY_CHAT_PREFIX_FORMAT_DEFAULT)
private String partyChatPrefixFormat = PARTY_CHAT_PREFIX_FORMAT_DEFAULT;
@Setting(value = "Prefix-Ally",
comment = "This is the formatting used for the prefix at the beginning of a party chat message from an ally." +
"\nDefault value: "+PARTY_CHAT_PREFIX_ALLY_DEFAULT)
"\nDefault value: " + PARTY_CHAT_PREFIX_ALLY_DEFAULT)
private String partyChatPrefixAlly = PARTY_CHAT_PREFIX_ALLY_DEFAULT;
@Setting(value = "Party-Leaders-Name-Uses-Gold-Coloring",
comment = "Changes the party leader to use a gold coloring for their name." +
"\nDefault value: "+PARTY_LEADER_GOLD_DEFAULT)
"\nDefault value: " + PARTY_LEADER_GOLD_DEFAULT)
private boolean isPartyLeaderColoredGold = PARTY_LEADER_GOLD_DEFAULT;
@Setting(value = "Use-Display-Names", comment = "Party chat will use formatted display names instead of the players raw nickname." +
"\nDisplay names are often colored, modified, or styled differently from a players regular name." +
"\nDisplay names are typically modified by chat plugins and the like." +
"\nIf you'd rather player names were just their current Minecraft username, turn this off." +
"\nDefault value: "+PARTY_USE_DISPLAY_NAMES_DEFAULT)
"\nDefault value: " + PARTY_USE_DISPLAY_NAMES_DEFAULT)
private boolean partyDisplayNamesEnabled = PARTY_USE_DISPLAY_NAMES_DEFAULT;
public String getPartyChatPrefixFormat() {

View File

@@ -6,17 +6,16 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionPartyCleanup {
private static final int AUTO_KICK_HOURS_DEFAULT = 12;
public static final int AUTO_KICK_CUTOFF_DAYS_DEFAULT = 7;
private static final int AUTO_KICK_HOURS_DEFAULT = 12;
@Setting(value = "Hours-Between-Cleanup-Operations",
comment = "How many hours between checking parties for members that meet auto kick requirements." +
"\nDefault value: "+AUTO_KICK_HOURS_DEFAULT)
"\nDefault value: " + AUTO_KICK_HOURS_DEFAULT)
private int partyAutoKickHoursInterval = AUTO_KICK_HOURS_DEFAULT;
@Setting(value = "Offline-Day-Limit",
comment = "How many days must pass before a player qualifies to be kicked from a party automatically." +
"\nDefault value: "+AUTO_KICK_CUTOFF_DAYS_DEFAULT)
"\nDefault value: " + AUTO_KICK_CUTOFF_DAYS_DEFAULT)
private int partyAutoKickDaysCutoff = AUTO_KICK_CUTOFF_DAYS_DEFAULT;
public int getPartyAutoKickHoursInterval() {

View File

@@ -10,7 +10,7 @@ public class ConfigSectionPartyCombat {
@Setting(value = "Friendly-Fire", comment = "When friendly fire is enabled, players in the same party can injure each other." +
"\nThis also allows Party alliances to hurt each other." +
"\nDefault value: "+PARTY_FRIENDLY_FIRE_DEFAULT)
"\nDefault value: " + PARTY_FRIENDLY_FIRE_DEFAULT)
private boolean partyFriendlyFire = PARTY_FRIENDLY_FIRE_DEFAULT;
public boolean isPartyFriendlyFire() {

View File

@@ -12,7 +12,7 @@ public class ConfigSectionPartyGeneral {
private ConfigSectionPartyLimit configSectionPartyLimit = new ConfigSectionPartyLimit();
@Setting(value = "Enable-Party-System", comment = "Turn this off to completely disable the mcMMO party system." +
"\nDefault value: "+PARTY_SYSTEM_DEFAULT)
"\nDefault value: " + PARTY_SYSTEM_DEFAULT)
private boolean enablePartySystem = PARTY_SYSTEM_DEFAULT;
public int getPartySizeLimit() {

View File

@@ -13,6 +13,6 @@ public class ConfigSectionPartyItemShareSettings {
"\nEQUAL: Party members have weighted dice rolls based on the quality of the loot they have recently received." +
"\nRANDOM: Party members do a fair dice roll for every item dropped." +
"\nNONE: Do not use item sharing" +
"\nDefault Value: "+"NONE")
"\nDefault Value: " + "NONE")
private ShareMode shareMode = SHARE_MODE_DEFAULT;
}

View File

@@ -10,20 +10,14 @@ import java.util.Map;
@ConfigSerializable
public class ConfigSectionPartyLevel {
private static final HashMap<PartyFeature, Integer> PARTY_FEATURE_MAP_DEFAULT;
public static final boolean INFORM_PARTY_ON_LEVELUP_DEFAULT = true;
public static final boolean PARTY_LEVELING_NEEDS_NERBY_MEMBERS_DEFAULT = true;
public static final int TELEPORT_DEFAULT = 2;
public static final int ALLIANCE_DEFAULT = 5;
public static final int ITEM_SHARE_DEFAULT = 8;
public static final int XP_SHARE_DEFAULT = 10;
public static final int PARTY_CHAT_DEFAULT = 1;
private static final HashMap<PartyFeature, Integer> PARTY_FEATURE_MAP_DEFAULT;
static {
PARTY_FEATURE_MAP_DEFAULT = new HashMap<>();
@@ -47,35 +41,34 @@ public class ConfigSectionPartyLevel {
*/
@Setting(value = "Party-XP-Formula-Parameters",
comment = "The Party XP Formula is borrowed from the Player XP formula to help determine the amount of XP needed to level the party." +
"\nThe Party XP Formula used to be based on your settings for player XP formula but I have separated it from those settings." +
"\nThe Party XP Curve Multiplier takes the final result of calculating one level of XP and multiplies it by this value to get the amount of XP needed to level the party." +
"\nParty Leveling used to have a level cap, I have removed this level cap as part of a feature request. It seems fun to level up parties indefinitely." +
"\nParty Leveling is now using exponential level scaling by default.")
comment = "The Party XP Formula is borrowed from the Player XP formula to help determine the amount of XP needed to level the party." +
"\nThe Party XP Formula used to be based on your settings for player XP formula but I have separated it from those settings." +
"\nThe Party XP Curve Multiplier takes the final result of calculating one level of XP and multiplies it by this value to get the amount of XP needed to level the party." +
"\nParty Leveling used to have a level cap, I have removed this level cap as part of a feature request. It seems fun to level up parties indefinitely." +
"\nParty Leveling is now using exponential level scaling by default.")
private ConfigSectionPartyXPFormula partyXPFormula = new ConfigSectionPartyXPFormula();
@Setting(value = "Party-Leveling-Requires-Nearby-Party-Members",
comment = "If leveling your Party requires being near another party member." +
"\nDefault value: "+PARTY_LEVELING_NEEDS_NERBY_MEMBERS_DEFAULT)
"\nDefault value: " + PARTY_LEVELING_NEEDS_NERBY_MEMBERS_DEFAULT)
private boolean partyLevelingNeedsNearbyMembers = PARTY_LEVELING_NEEDS_NERBY_MEMBERS_DEFAULT;
@Setting(value = "Send-Levelup-Notifications-To-Party",
comment = "Sends level up notifications to nearby party members." +
"\nDefault value: "+INFORM_PARTY_ON_LEVELUP_DEFAULT)
"\nDefault value: " + INFORM_PARTY_ON_LEVELUP_DEFAULT)
private boolean informPartyMembersOnLevelup = INFORM_PARTY_ON_LEVELUP_DEFAULT;
@Setting(value = "Party-Feature-Unlock-Level-Requirements", comment = "What level your Party needs to be to unlock certain features." +
"\nKeep in mind, parties no longer have a level cap." +
"\n\nDefault values: " +
"\nCHAT: "+PARTY_CHAT_DEFAULT +
"\nTELEPORT: "+TELEPORT_DEFAULT +
"\nALIANCE: "+ALLIANCE_DEFAULT +
"\nITEM SHARE: "+ITEM_SHARE_DEFAULT +
"\nXP SHARE: "+XP_SHARE_DEFAULT)
"\nCHAT: " + PARTY_CHAT_DEFAULT +
"\nTELEPORT: " + TELEPORT_DEFAULT +
"\nALIANCE: " + ALLIANCE_DEFAULT +
"\nITEM SHARE: " + ITEM_SHARE_DEFAULT +
"\nXP SHARE: " + XP_SHARE_DEFAULT)
private Map<PartyFeature, Integer> partyFeatureUnlockMap = PARTY_FEATURE_MAP_DEFAULT;
public int getPartyXpCurveMultiplier() {
return partyXPFormula.getPartyXpCurveMultiplier();
}
@@ -88,5 +81,7 @@ public class ConfigSectionPartyLevel {
return informPartyMembersOnLevelup;
}
public Map<PartyFeature, Integer> getPartyFeatureUnlockMap() { return partyFeatureUnlockMap; }
public Map<PartyFeature, Integer> getPartyFeatureUnlockMap() {
return partyFeatureUnlockMap;
}
}

View File

@@ -10,17 +10,17 @@ public class ConfigSectionPartyLimit {
public static final int PARTY_SIZE_LIMIT_DEFAULT = 5;
@Setting(value = "Max-Party-Size",
comment = "The maximum size for parties, parties bigger than this size will be dismantled." +
comment = "The maximum size for parties, parties bigger than this size will be dismantled." +
"\nThis setting is only used if \"Enforce-Size-Limit\" is true." +
"\nPlayers can bypass this limit with the following permission node \"mcmmo.bypass.partylimit\"" +
"\nDefault value: "+PARTY_SIZE_LIMIT_DEFAULT)
"\nDefault value: " + PARTY_SIZE_LIMIT_DEFAULT)
public int partyMaxSize = PARTY_SIZE_LIMIT_DEFAULT;
@Setting(value = "Enforce-Size-Limit",
comment = "Limits parties to a maximum size defined by \"Max-Party-Size\"" +
comment = "Limits parties to a maximum size defined by \"Max-Party-Size\"" +
"\nParties over the current limit will be dismantled" +
"\nPlayers can bypass this limit with the following permission node \"mcmmo.bypass.partylimit\"" +
"\nDefault value: "+USE_LIMIT_DEFAULT)
"\nDefault value: " + USE_LIMIT_DEFAULT)
public boolean useCap = USE_LIMIT_DEFAULT;
}

View File

@@ -14,24 +14,24 @@ public class ConfigSectionPartyTeleportCommand {
public static final boolean PTP_WORLD_BASED_PERMISSIONS_DEFAULT = false;
@Setting(value = "PTP-Cooldown", comment = "How many seconds a player must wait between usages of PTP." +
"\nDefault value: "+PTP_COOLDOWN_DEFAULT)
"\nDefault value: " + PTP_COOLDOWN_DEFAULT)
private int ptpCooldown = PTP_COOLDOWN_DEFAULT;
@Setting(value = "PTP-Warmup", comment = "How many seconds a player must stand still for a PTP to be successful." +
"\nDefault value: "+PTP_WARMUP_DEFAULT)
"\nDefault value: " + PTP_WARMUP_DEFAULT)
private int ptpWarmup = PTP_WARMUP_DEFAULT;
@Setting(value = "PTP-Hurt-Cooldown", comment = "How many seconds a player must wait from last taking damage in order to use PTP." +
"\nDefault value: "+PTP_RECENTLY_HURT_COOLDOWN_DEFAULT)
"\nDefault value: " + PTP_RECENTLY_HURT_COOLDOWN_DEFAULT)
private int ptpRecentlyHurtCooldown = PTP_RECENTLY_HURT_COOLDOWN_DEFAULT;
@Setting(value = "PTP-Requires-Accept", comment = "If a player tries to use PTP to another party member," +
" that party member must then accept his request or the PTP will not execute." +
"\nDefault value: "+PTP_ACCEPT_REQUIRED_DEFAULT)
"\nDefault value: " + PTP_ACCEPT_REQUIRED_DEFAULT)
private boolean ptpAcceptRequired = PTP_ACCEPT_REQUIRED_DEFAULT;
@Setting(value = "PTP-Request-Timeout", comment = "How many seconds before a PTP request will become invalid." +
"\nDefault value: "+PTP_REQUEST_TIMEOUT)
"\nDefault value: " + PTP_REQUEST_TIMEOUT)
private int ptpRequestTimeout = PTP_REQUEST_TIMEOUT;
@Setting(value = "PTP-Require-World-Based-Permissions", comment = "If true, players need to use a special permission node in order to use PTP on that world or to that world." +

View File

@@ -10,7 +10,7 @@ public class ConfigSectionPartyXPFormula {
@Setting(value = "Party-XP-Formula-Multiplier",
comment = "Crank this up to make it harder to level parties" +
"\nDefault value: "+PARTY_XP_CURVE_MULTIPLIER_DEFAULT)
"\nDefault value: " + PARTY_XP_CURVE_MULTIPLIER_DEFAULT)
private int partyXpCurveMultiplier = PARTY_XP_CURVE_MULTIPLIER_DEFAULT;
public int getPartyXpCurveMultiplier() {

View File

@@ -31,10 +31,8 @@ public class ConfigExperienceFormula {
return configExperienceFormulaExponential;
}
public double getMultiplier(FormulaType formulaType)
{
switch(formulaType)
{
public double getMultiplier(FormulaType formulaType) {
switch (formulaType) {
case LINEAR:
return getLinearMultiplier();
case EXPONENTIAL:
@@ -44,10 +42,8 @@ public class ConfigExperienceFormula {
}
}
public int getBase(FormulaType formulaType)
{
switch(formulaType)
{
public int getBase(FormulaType formulaType) {
switch (formulaType) {
case LINEAR:
return getLinearBaseModifier();
case EXPONENTIAL:

View File

@@ -10,13 +10,13 @@ public class ConfigExperienceFormulaExponential {
private static final double MULTIPLIER_DEFAULT = 0.1;
private static final double EXPONENT_DEFAULT = 1.80;
@Setting(value = "Base-Amount", comment = "Default value: "+BASE_DEFAULT)
@Setting(value = "Base-Amount", comment = "Default value: " + BASE_DEFAULT)
private int baseModifier = BASE_DEFAULT;
@Setting(value = "Multiplier", comment = "Default value: "+MULTIPLIER_DEFAULT)
@Setting(value = "Multiplier", comment = "Default value: " + MULTIPLIER_DEFAULT)
private double multiplier = MULTIPLIER_DEFAULT;
@Setting(value = "Exponent", comment = "Default value: "+EXPONENT_DEFAULT)
@Setting(value = "Exponent", comment = "Default value: " + EXPONENT_DEFAULT)
private double exponent = EXPONENT_DEFAULT;
public int getExponentialBaseModifier() {

View File

@@ -9,10 +9,10 @@ public class ConfigExperienceFormulaLinear {
private static final int BASE_DEFAULT = 1020;
private static final double MULTIPLIER_DEFAULT = 20.0D;
@Setting(value = "Base-Amount", comment = "Default value: "+BASE_DEFAULT)
@Setting(value = "Base-Amount", comment = "Default value: " + BASE_DEFAULT)
private int baseModifier = BASE_DEFAULT;
@Setting(value = "Multiplier", comment = "Default value: "+MULTIPLIER_DEFAULT)
@Setting(value = "Multiplier", comment = "Default value: " + MULTIPLIER_DEFAULT)
private double multiplier = MULTIPLIER_DEFAULT;
public int getLinearBaseModifier() {

View File

@@ -95,10 +95,8 @@ public class ConfigLeveling {
* HELPER METHODS
*/
public int getLevelCap(PrimarySkillType primarySkillType)
{
switch(primarySkillType)
{
public int getLevelCap(PrimarySkillType primarySkillType) {
switch (primarySkillType) {
case ACROBATICS:
return configSectionLevelCaps.getConfigSectionSkills().getAcrobatics().getLevelCap();
case ALCHEMY:
@@ -134,10 +132,8 @@ public class ConfigLeveling {
}
}
public boolean isLevelCapEnabled(PrimarySkillType primarySkillType)
{
switch(primarySkillType)
{
public boolean isLevelCapEnabled(PrimarySkillType primarySkillType) {
switch (primarySkillType) {
case ACROBATICS:
return configSectionLevelCaps.getConfigSectionSkills().getAcrobatics().isLevelCapEnabled();
case ALCHEMY:

View File

@@ -14,7 +14,7 @@ public class ConfigSectionLevelCaps {
@Setting(value = "Reduce-Player-Skills-Above-Cap",
comment = "Players with skills above the cap will have those skills reduced to the cap" +
"\nDefault value: "+TRUNCATE_SKILLS_ABOVE_CAP_DEFAULT)
"\nDefault value: " + TRUNCATE_SKILLS_ABOVE_CAP_DEFAULT)
private boolean truncateSkillsAboveCap = TRUNCATE_SKILLS_ABOVE_CAP_DEFAULT;
@Setting(value = "Power-Level",

View File

@@ -30,7 +30,7 @@ public class ConfigSectionLevelingGeneral {
@Setting(value = "Player-Starting-Level",
comment = "\nPlayers will start at this level in all skills if they aren't already saved in the database." +
"\nHistorically this number has been 0, but this was changed in 2.1.X to 1 as I felt it was better to start from 1 than 0." +
"\nDefault value: "+STARTING_LEVEL_DEFAULT)
"\nDefault value: " + STARTING_LEVEL_DEFAULT)
private int startingLevel = STARTING_LEVEL_DEFAULT;
/*

View File

@@ -19,7 +19,7 @@ public class ConfigSectionSkillLevelCap {
@Setting(value = "Level-Cap",
comment = "Players will be unable to level past this value" +
"\nThe cap is the same for both Retro and Standard, " +
"\nThe cap is the same for both Retro and Standard, " +
"so a cap of 50 will be the same value in either mode.")
private int levelCap = LEVEL_CAP_DEFAULT;

View File

@@ -57,10 +57,8 @@ public class ConfigScoreboard {
return configSectionGeneral.isUseAbilityNameInsteadOfGeneric();
}
public boolean isScoreboardEnabled(ScoreboardManager.SidebarType sidebarType)
{
switch(sidebarType)
{
public boolean isScoreboardEnabled(ScoreboardManager.SidebarType sidebarType) {
switch (sidebarType) {
case TOP_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionTopBoard().isUseThisBoard();
case RANK_BOARD:
@@ -76,10 +74,8 @@ public class ConfigScoreboard {
}
}
public boolean isScoreboardPrinting(ScoreboardManager.SidebarType sidebarType)
{
switch(sidebarType)
{
public boolean isScoreboardPrinting(ScoreboardManager.SidebarType sidebarType) {
switch (sidebarType) {
case TOP_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionTopBoard().isPrintToChat();
case RANK_BOARD:
@@ -94,10 +90,8 @@ public class ConfigScoreboard {
}
}
public int getScoreboardDisplayTime(ScoreboardManager.SidebarType sidebarType)
{
switch(sidebarType)
{
public int getScoreboardDisplayTime(ScoreboardManager.SidebarType sidebarType) {
switch (sidebarType) {
case TOP_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionTopBoard().getDisplayTimeInSeconds();
case RANK_BOARD:

View File

@@ -19,20 +19,20 @@ public class ConfigSectionCooldownBoard {
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
"\nDefault value: " + PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show-Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
"\nDefault value: " + USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display-Time-In-Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
"\nDefault value: " + DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*

View File

@@ -24,7 +24,7 @@ public class ConfigSectionGeneral {
"\nMost of their functionality has been replaced by the new XP bars (Boss Bars)" +
"\nIf you still wish to use scoreboards, you still can, just turn this setting on." +
"\nScoreboards can be used alongside XP bars, so don't worry about that!" +
"\nDefault value: "+ USE_SCOREBOARDS_DEFAULT)
"\nDefault value: " + USE_SCOREBOARDS_DEFAULT)
private boolean useScoreboards = USE_SCOREBOARDS_DEFAULT;
@Setting(value = "Display-Power-Levels-Below-Player-Names",
@@ -34,23 +34,23 @@ public class ConfigSectionGeneral {
" through the use of scoreboards." +
"\nThis is off by default because a lot of Plugins for Minecraft make use of editing" +
" a players \"nameplate\" and that can cause compatibility issues" +
"\nDefault value: "+ POWER_LEVEL_DISPLAY_DEFAULT)
"\nDefault value: " + POWER_LEVEL_DISPLAY_DEFAULT)
private boolean powerLevelTags = POWER_LEVEL_DISPLAY_DEFAULT;
@Setting(value = "Show-Stats-Scoreboard-On-Player-Login", comment = "Shows the player the /mcstats scoreboard" +
" display after they login." +
"\nDefault value: "+ SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT)
"\nDefault value: " + SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT)
private boolean showStatsAfterLogin = SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT;
@Setting(value = "Show-Scoreboard-Tips-Only-This-Many-Times", comment = "This determines how many times players are" +
" given tips about how to use the scoreboard system before they are never tipped again." +
"\nPlayers are given tips once per login session." +
"\nDefault value: "+ SHOW_TIPS_LIMIT_DEFAULT)
"\nDefault value: " + SHOW_TIPS_LIMIT_DEFAULT)
private int tipsAmount = SHOW_TIPS_LIMIT_DEFAULT;
@Setting(value ="Use-Rainbow-Styling-For-Skill-Names", comment = "If true, skills names will use rainbow style" +
@Setting(value = "Use-Rainbow-Styling-For-Skill-Names", comment = "If true, skills names will use rainbow style" +
" colorings instead of having the same color" +
"\nDefault value: "+ USE_RAINBOW_SKILL_COLORING_DEFAULT)
"\nDefault value: " + USE_RAINBOW_SKILL_COLORING_DEFAULT)
private boolean useRainbows = USE_RAINBOW_SKILL_COLORING_DEFAULT;
@Setting(value = "Use-Super-Ability-Name-Instead-Of-Generic-Name",
@@ -58,7 +58,7 @@ public class ConfigSectionGeneral {
"instead of using a generic word from the locale, which by default in the locale is defined as " +
"\"Ability\". The locale key for this entry is - Scoreboard.Misc.Ability " +
"\nExample: If true Tree Feller will be shown instead of Super Ability with default en_us locale entries" +
"\nDefault value: "+ USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC)
"\nDefault value: " + USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC)
private boolean useAbilityNameInsteadOfGeneric = USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC;
public boolean isUseScoreboards() {

View File

@@ -19,20 +19,20 @@ public class ConfigSectionInspectBoard {
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
"\nDefault value: " + PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show-Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
"\nDefault value: " + USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display-Time-In-Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
"\nDefault value: " + DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*

View File

@@ -17,22 +17,22 @@ public class ConfigSectionRankBoard {
@Setting(value = "Show-Command-Output-In-Chat",
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: " + PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show-Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: " + USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display-Time-In-Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
"\nDefault value: " + DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*

View File

@@ -21,23 +21,23 @@ public class ConfigSectionSkillBoard {
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true," +
" which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
"\nDefault value: " + USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display-Time-In-Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
"\nDefault value: " + DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
@Setting(value = "Show-Board-On-Player-Level-Up",
comment = "Show a skill scoreboard when the player levels up in that skill" +
"\nDefault value: "+SHOW_BOARD_ON_PLAYER_LEVELUP)
"\nDefault value: " + SHOW_BOARD_ON_PLAYER_LEVELUP)
private boolean showBoardOnPlayerLevelUp = SHOW_BOARD_ON_PLAYER_LEVELUP;
@Setting(value = "Level-Up-Display-Time", comment = "How long to show a skill scoreboard when a player levels up?" +
"\nIs only shown if Show_Board_On_Player_Level_Up is true" +
"\nDefault value: "+SHOW_BOARD_ON_LEVELUP_TIME)
"\nDefault value: " + SHOW_BOARD_ON_LEVELUP_TIME)
private int showBoardOnPlayerLevelUpTime = SHOW_BOARD_ON_LEVELUP_TIME;
/*

View File

@@ -19,20 +19,20 @@ public class ConfigSectionStatsBoard {
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
"\nDefault value: " + PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show-Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
"\nDefault value: " + USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display-Time-In-Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
"\nDefault value: " + DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*

View File

@@ -19,20 +19,20 @@ public class ConfigSectionTopBoard {
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
"\nDefault value: " + PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show-Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
"\nDefault value: " + USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display-Time-In-Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
"\nDefault value: " + DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*

View File

@@ -16,7 +16,7 @@ public class ConfigScalingSubSkillRetro {
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill." +
"\n\n-- NOTE: This setting is only valid for retro level scaling. --" +
"\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT)
"\nDefault value: " + MAX_BONUS_LEVEL_DEFAULT)
private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
@Setting(value = "Max-Success-Chance", comment = "The maximum success chance for this Sub-Skill." +
@@ -26,7 +26,7 @@ public class ConfigScalingSubSkillRetro {
"\nAs an example, imagine \"Max-Success-Chance\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill." +
"\n\n-- NOTE: This setting is only valid for retro level scaling. --" +
"\nDefault value: "+CHANCE_AT_MAX_SKILL_DEFAULT)
"\nDefault value: " + CHANCE_AT_MAX_SKILL_DEFAULT)
private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT;
public int getMaxBonusLevel() {

View File

@@ -16,7 +16,7 @@ public class ConfigScalingSubSkillStandard {
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill." +
"\n\n-- NOTE: This setting is only valid for standard level scaling. --" +
"\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT)
"\nDefault value: " + MAX_BONUS_LEVEL_DEFAULT)
private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
@Setting(value = "Max-Success-Chance", comment = "The maximum success chance for this Sub-Skill." +
@@ -26,7 +26,7 @@ public class ConfigScalingSubSkillStandard {
"\nAs an example, imagine \"Max-Success-Chance\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill." +
"\n\n-- NOTE: This setting is only valid for standard level scaling. --" +
"\nDefault value: "+CHANCE_AT_MAX_SKILL_DEFAULT)
"\nDefault value: " + CHANCE_AT_MAX_SKILL_DEFAULT)
private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT;
public int getMaxBonusLevel() {

View File

@@ -34,17 +34,18 @@ public class ConfigSubSkillScalingRNG {
/**
* The max chance for the RNG component of a subskill from the user config
*
* @return the max chance for the RNG component of a subskill
*/
public double getMaxChance() {
if(mcMMO.getConfigManager().getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled())
if (mcMMO.getConfigManager().getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled())
return getRetroSettings().getChanceAtMaxSkill();
else
return getStandardSettings().getChanceAtMaxSkill();
}
public double getMaxBonusLevel() {
if(mcMMO.getConfigManager().getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled())
if (mcMMO.getConfigManager().getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled())
return getRetroSettings().getMaxBonusLevel();
else
return getStandardSettings().getMaxBonusLevel();

View File

@@ -13,7 +13,7 @@ public class ConfigDodge {
"\nPlayers can dodge almost all types of damage from other entities, such as player damage, monster damage, etc." +
"\nAs an example, a value of 2.0 for this setting would result in the player taking half damage." +
"\nHigher values would further decrease the amount of damage the player takes after a successful dodge." +
"\nDefault value: "+DAMAGE_REDUCTION_DIVISOR_DEFAULT)
"\nDefault value: " + DAMAGE_REDUCTION_DIVISOR_DEFAULT)
private double damageReductionDivisor = DAMAGE_REDUCTION_DIVISOR_DEFAULT;
@Setting(value = "RNG-Settings", comment = "Settings related to random chance elements for this Sub-Skill.")

View File

@@ -11,7 +11,7 @@ public class ConfigRoll {
@Setting(value = "Damage-Threshold", comment = "Rolling will reduce up to this much damage." +
"\nGraceful Rolls will reduce twice this value." +
"\nDefault value: "+ROLL_DAMAGE_THRESHOLD_DEFAULT)
"\nDefault value: " + ROLL_DAMAGE_THRESHOLD_DEFAULT)
private double damageTheshold = ROLL_DAMAGE_THRESHOLD_DEFAULT;
@Setting(value = "RNG-Settings", comment = "Settings related to random chance elements for this Sub-Skill.")

View File

@@ -8,7 +8,7 @@ import java.util.ArrayList;
/**
* This class is used to generate a table that can be referenced to compare Bukkit Material names
* to full qualified names used in internal registers for Minecraft
* to full qualified names used in internal registers for Minecraft
*/
@ConfigSerializable
public class ConfigNameRegisterDefaults {
@@ -17,8 +17,7 @@ public class ConfigNameRegisterDefaults {
static {
BUKKIT_MATERIAL_NAME_LOOKUP_EXAMPLE = new ArrayList<>();
for(Material m : Material.values())
{
for (Material m : Material.values()) {
BUKKIT_MATERIAL_NAME_LOOKUP_EXAMPLE.add(new MinecraftMaterialWrapper((m)));
}
}

View File

@@ -7,8 +7,7 @@ public class MinecraftMaterialWrapper {
private String fullyQualifiedName;
private String bukkitMaterialName;
public MinecraftMaterialWrapper(Material material)
{
public MinecraftMaterialWrapper(Material material) {
this.name = material.getKey().getKey();
this.fullyQualifiedName = material.getKey().toString();
this.bukkitMaterialName = material.toString();

View File

@@ -8,11 +8,10 @@ import java.util.HashMap;
@ConfigSerializable
public class ConfigFishing {
@Setting(value = "General")
private ConfigFishingGeneral fishingGeneral = new ConfigFishingGeneral();
@Setting(value = "Sub-Skills")
public ConfigFishingSubskills fishingSubskills = new ConfigFishingSubskills();
@Setting(value = "General")
private ConfigFishingGeneral fishingGeneral = new ConfigFishingGeneral();
/*
* GETTERS BOILERPLATE
@@ -50,8 +49,7 @@ public class ConfigFishing {
return getInnerPeace().getInnerPeaceVanillaXPMultiplier();
}
public int getVanillaXPMultInnerPeace(int rank)
{
public int getVanillaXPMultInnerPeace(int rank) {
return getInnerPeaceVanillaXPMultiplier().get(rank);
}
}

View File

@@ -6,27 +6,27 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigFishingGeneral {
public static final double LURE_MODIFIER_DEFAULT = 4.0D;
private static final boolean ALWAYS_CATCH_FISH_DEFAULT = true;
private static final boolean OVERRIDE_VANILLA_TREASURES = true;
public static final double LURE_MODIFIER_DEFAULT = 4.0D;
private static final boolean ALLOW_MCMMO_FISHING_REWARDS = true;
@Setting(value = "Always-Catch-Fish", comment = "Enables fish to be caught alongside treasure." +
"\nDefault value: "+ALWAYS_CATCH_FISH_DEFAULT)
"\nDefault value: " + ALWAYS_CATCH_FISH_DEFAULT)
private boolean alwaysCatchFish = ALWAYS_CATCH_FISH_DEFAULT;
@Setting(value = "Override-Vanilla-Fishing-Treasures", comment = "When set to true, mcMMO fishing loot tables will be used instead of vanilla." +
"\nIt is recommended you use vanilla mcMMO fishing tables, as they are configurable." +
"\nDefault value: "+OVERRIDE_VANILLA_TREASURES)
"\nDefault value: " + OVERRIDE_VANILLA_TREASURES)
private boolean overrideVanillaTreasures = OVERRIDE_VANILLA_TREASURES;
@Setting(value = "Lure-Luck-Modifier", comment = "Lure luck modifier is used to determine how much to" +
" increase drop chance by for fishing rods with the Luck enchantment." +
"\nDefault value: "+LURE_MODIFIER_DEFAULT)
"\nDefault value: " + LURE_MODIFIER_DEFAULT)
private double lureLuckModifier = LURE_MODIFIER_DEFAULT;
@Setting(value = "Allow-Custom-Fishing-Drops", comment = "If set to true, allows mcMMO fishing treasures to be found while fishing." +
"\nDefault value: "+ALLOW_MCMMO_FISHING_REWARDS)
"\nDefault value: " + ALLOW_MCMMO_FISHING_REWARDS)
private boolean allowCustomDrops = ALLOW_MCMMO_FISHING_REWARDS;
public boolean isAllowCustomDrops() {

View File

@@ -16,8 +16,8 @@ import static org.bukkit.Material.*;
@ConfigSerializable
public class ConfigRepair {
public static final ArrayList<Repairable> CONFIG_REPAIRABLES_DEFAULTS;
public static final Material[] PLANKS = new Material[] { OAK_PLANKS, BIRCH_PLANKS, DARK_OAK_PLANKS, ACACIA_PLANKS, JUNGLE_PLANKS, SPRUCE_PLANKS};
public static final ArrayList<Repairable> CONFIG_REPAIRABLES_DEFAULTS;
public static final Material[] PLANKS = new Material[]{OAK_PLANKS, BIRCH_PLANKS, DARK_OAK_PLANKS, ACACIA_PLANKS, JUNGLE_PLANKS, SPRUCE_PLANKS};
static {
CONFIG_REPAIRABLES_DEFAULTS = new ArrayList<>();

View File

@@ -39,12 +39,12 @@ public class ConfigRepairArcaneForging {
@Setting(value = "May-Lose-Enchants", comment = "With this on, players have a chance to have enchantments stripped from" +
"\n their item when repairing." +
"\nThe odds to lose your enchants decrease with higher levels of skill." +
"\nDefault value: "+LOSE_ENCHANTS_DEFAULT)
"\nDefault value: " + LOSE_ENCHANTS_DEFAULT)
private boolean mayLoseEnchants = LOSE_ENCHANTS_DEFAULT;
@Setting(value = "Chance-To-Downgrade-Enchants", comment = "With this on, players have a chance to have enchants downgraded when repairing." +
"\nThe chance to downgrade decreases with higher levels of skill." +
"\nDefault value: "+DOWNGRADES_ENABLED_DEFAULT)
"\nDefault value: " + DOWNGRADES_ENABLED_DEFAULT)
private boolean downgradesEnabled = DOWNGRADES_ENABLED_DEFAULT;
@Setting(value = "Downgrade-Chance-Per-Rank", comment = "Chance to downgrade enchants per rank in this Sub-Skill.")

View File

@@ -12,24 +12,24 @@ public class ConfigRepairGeneral {
public static final boolean ENCHANTED_ITEMS_REQUIRE_CONFIRM = true;
@Setting(value = "Anvil-Block-Material", comment = "The block used for mcMMO repairs." +
"\nDefault value: "+"minecraft:iron_block")
"\nDefault value: " + "minecraft:iron_block")
private String repairAnvilMaterial = Material.IRON_BLOCK.getKey().toString();
@Setting(value = "Anvil-Use-Sounds", comment = "If true, mcMMO will play a sound when a player uses an anvil." +
"\nDefault value: "+ANVIL_USE_SOUNDS_DEFAULT)
"\nDefault value: " + ANVIL_USE_SOUNDS_DEFAULT)
private boolean anvilUseSounds = ANVIL_USE_SOUNDS_DEFAULT;
@Setting(value = "Anvil-Notifications", comment = "Allows helpful messages to help players understand how to use the anvil." +
"\nDefault value: "+ANVIL_MESSAGES_DEFAULT)
"\nDefault value: " + ANVIL_MESSAGES_DEFAULT)
private boolean anvilMessages = ANVIL_MESSAGES_DEFAULT;
@Setting(value = "Anvil-Placed-Sounds", comment = "Placing an anvil in the world will play a sound effect." +
"\nDefault value: "+ANVIL_PLACED_SOUNDS_DEFAULT)
"\nDefault value: " + ANVIL_PLACED_SOUNDS_DEFAULT)
private boolean anvilPlacedSounds = ANVIL_PLACED_SOUNDS_DEFAULT;
@Setting(value = "Enchanted-Items-Require-Confirm", comment = "Warns players that using the anvil with an enchanted item is dangerous." +
"\nPlayers will have to use the anvil twice in a row with an enchanted item." +
"\nDefault value: "+ENCHANTED_ITEMS_REQUIRE_CONFIRM)
"\nDefault value: " + ENCHANTED_ITEMS_REQUIRE_CONFIRM)
private boolean enchantedItemsRequireConfirm = ENCHANTED_ITEMS_REQUIRE_CONFIRM;
public Material getRepairAnvilMaterial() {

View File

@@ -16,7 +16,7 @@ public class RepairMasteryRetro {
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill." +
"\n-- NOTE: This setting is only valid for retro level scaling. --" +
"\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT)
"\nDefault value: " + MAX_BONUS_LEVEL_DEFAULT)
private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
@Setting(value = "Max-Bonus-Percentage", comment = "This is the maximum benefit for additional repair amount from this skill when the player reaches \"Max-Bonus-Level\"." +
@@ -24,7 +24,7 @@ public class RepairMasteryRetro {
"\nAs an example, imagine \"Standard-Mode-Max-Bonus-Percentage\" was set to " + MAX_BONUS_PERCENTAGE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + PLAYER_LEVEL_FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + BONUS_PERCENTAGE_EXAMPLE + "% added to the repair amount on the item before other bonuses." +
"\n-- NOTE: This setting is only valid for retro level scaling. --" +
"\nDefault value: "+MAX_BONUS_PERCENTAGE)
"\nDefault value: " + MAX_BONUS_PERCENTAGE)
private double maxBonusPercentage = MAX_BONUS_PERCENTAGE;
public int getMaxBonusLevel() {

View File

@@ -16,7 +16,7 @@ public class RepairMasteryStandard {
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill." +
"\n-- NOTE: This setting is only valid for standard level scaling. --" +
"\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT)
"\nDefault value: " + MAX_BONUS_LEVEL_DEFAULT)
public int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
@Setting(value = "Max-Bonus-Percentage", comment = "This is the maximum benefit for additional repair amount from this skill when the player reaches \"Max-Bonus-Level\"." +
@@ -24,6 +24,6 @@ public class RepairMasteryStandard {
"\nAs an example, imagine \"Standard-Mode-Max-Bonus-Percentage\" was set to " + MAX_BONUS_PERCENTAGE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + PLAYER_LEVEL_FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + BONUS_PERCENTAGE_EXAMPLE + "% added to the repair amount on the item before other bonuses." +
"\n-- NOTE: This setting is only valid for standard level scaling. --" +
"\nDefault value: "+MAX_BONUS_PERCENTAGE)
"\nDefault value: " + MAX_BONUS_PERCENTAGE)
public double maxBonusPercentage = MAX_BONUS_PERCENTAGE;
}

View File

@@ -46,12 +46,12 @@ public class ConfigArcaneSalvage {
@Setting(value = "May-Lose-Enchants", comment = "With this on, players have a chance to not receive the enchantments from the item they are salvaging." +
"\nThe odds to lose your enchants decrease with higher levels of skill." +
"\nDefault value: "+LOSE_ENCHANTS_DEFAULT)
"\nDefault value: " + LOSE_ENCHANTS_DEFAULT)
private boolean mayLoseEnchants = LOSE_ENCHANTS_DEFAULT;
@Setting(value = "Chance-To-Downgrade-Enchants", comment = "With this on, players have a chance to have salvaged enchantments downgrade when salvaging." +
"\nThe chance to downgrade decreases with higher levels of skill." +
"\nDefault value: "+DOWNGRADES_ENABLED_DEFAULT)
"\nDefault value: " + DOWNGRADES_ENABLED_DEFAULT)
private boolean downgradesEnabled = DOWNGRADES_ENABLED_DEFAULT;
public boolean isMayLoseEnchants() {

View File

@@ -13,24 +13,24 @@ public class ConfigSalvageGeneral {
public static final boolean ENCHANTED_ITEMS_REQUIRE_CONFIRM = true;
@Setting(value = "Anvil-Block-Material", comment = "The block used for mcMMO repairs." +
"Default value: "+"minecraft:gold_block")
"Default value: " + "minecraft:gold_block")
private String salvageAnvilMaterial = Material.GOLD_BLOCK.getKey().toString();
@Setting(value = "Anvil-Use-Sounds", comment = "If true, mcMMO will play a sound when a player uses an anvil." +
"\nDefault value: "+ANVIL_USE_SOUNDS_DEFAULT)
"\nDefault value: " + ANVIL_USE_SOUNDS_DEFAULT)
private boolean anvilUseSounds = ANVIL_USE_SOUNDS_DEFAULT;
@Setting(value = "Anvil-Notifications", comment = "Allows helpful messages to help players understand how to use the anvil." +
"\nDefault value: "+ANVIL_MESSAGES_DEFAULT)
"\nDefault value: " + ANVIL_MESSAGES_DEFAULT)
private boolean anvilMessages = ANVIL_MESSAGES_DEFAULT;
@Setting(value = "Anvil-Placed-Sounds", comment = "Placing an anvil in the world will play a sound effect." +
"\nDefault value: "+ANVIL_PLACED_SOUNDS_DEFAULT)
"\nDefault value: " + ANVIL_PLACED_SOUNDS_DEFAULT)
private boolean anvilPlacedSounds = ANVIL_PLACED_SOUNDS_DEFAULT;
@Setting(value = "Enchanted-Items-Require-Confirm", comment = "Warns players that using the anvil with an enchanted item is dangerous." +
"\nPlayers will have to use the anvil twice in a row with an enchanted item." +
"\nDefault value: "+ENCHANTED_ITEMS_REQUIRE_CONFIRM)
"\nDefault value: " + ENCHANTED_ITEMS_REQUIRE_CONFIRM)
private boolean enchantedItemsRequireConfirm = ENCHANTED_ITEMS_REQUIRE_CONFIRM;
public Material getSalvageAnvilMaterial() {

View File

@@ -10,7 +10,7 @@ public class ConfigSectionSuperAbilityLimits {
private ConfigSectionTreeFeller treeFeller = new ConfigSectionTreeFeller();
@Setting(value = "Tool-Durability-Damage", comment = "Increase this number to cause more durability loss for tools when using super abilities." +
"\nDefault value: "+TOOL_DURABILITY_DAMAGE_DEFAULT)
"\nDefault value: " + TOOL_DURABILITY_DAMAGE_DEFAULT)
private int toolDurabilityDamage = TOOL_DURABILITY_DAMAGE_DEFAULT;
public ConfigSectionTreeFeller getTreeFeller() {

View File

@@ -10,7 +10,7 @@ public class ConfigSectionTreeFeller {
@Setting(value = "Tree-Size-Limit", comment = "Trees over this many blocks in size will not activate" +
"\nLower this number to improve performance." +
"\nDefault value: "+TREE_FELLER_LIMIT_DEFAULT)
"\nDefault value: " + TREE_FELLER_LIMIT_DEFAULT)
private int treeFellerLimit = TREE_FELLER_LIMIT_DEFAULT;
public int getTreeFellerLimit() {

View File

@@ -13,12 +13,12 @@ public class ConfigSuperAbilities {
@Setting(value = "Enable-Super-Abilities",
comment = "Turn this off to disable all super abilities." +
"\nDefault value: "+SUPER_ABILITY_DEFAULT)
"\nDefault value: " + SUPER_ABILITY_DEFAULT)
private boolean superAbilitiesEnabled = SUPER_ABILITY_DEFAULT;
@Setting(value = "Require-Sneaking",
comment = "Players must be sneaking in order to activate super abilities." +
"\nDefault value: "+MUST_SNEAK_TO_ACTIVATE_DEFAULT)
"\nDefault value: " + MUST_SNEAK_TO_ACTIVATE_DEFAULT)
private boolean mustSneakToActivate = MUST_SNEAK_TO_ACTIVATE_DEFAULT;
@Setting(value = "Super-Ability-Cooldowns",
@@ -27,7 +27,7 @@ public class ConfigSuperAbilities {
@Setting(value = "Super-Ability-Max-Length",
comment = "The maximum amount of time in seconds that a super ability can last." +
"\nMost super abilities get longer as a player grows in skill.")
"\nMost super abilities get longer as a player grows in skill.")
private ConfigSectionSuperAbilityMaxLength superAbilityMaxLength = new ConfigSectionSuperAbilityMaxLength();
@Setting(value = "Super-Ability-Settings", comment = "Change specific parameters for super abilities.")
@@ -53,10 +53,8 @@ public class ConfigSuperAbilities {
return superAbilityLimits;
}
public int getCooldownForSuper(SuperAbilityType superAbilityType)
{
switch(superAbilityType)
{
public int getCooldownForSuper(SuperAbilityType superAbilityType) {
switch (superAbilityType) {
case BERSERK:
return superAbilityCooldowns.getBerserk();
case GREEN_TERRA:
@@ -74,15 +72,13 @@ public class ConfigSuperAbilities {
case GIGA_DRILL_BREAKER:
return superAbilityCooldowns.getGigaDrillBreaker();
default:
mcMMO.p.getLogger().severe("Cooldown Parameter not found for "+superAbilityType.toString());
mcMMO.p.getLogger().severe("Cooldown Parameter not found for " + superAbilityType.toString());
return 240;
}
}
public int getMaxLengthForSuper(SuperAbilityType superAbilityType)
{
switch(superAbilityType)
{
public int getMaxLengthForSuper(SuperAbilityType superAbilityType) {
switch (superAbilityType) {
case BERSERK:
return superAbilityMaxLength.getBerserk();
case GREEN_TERRA:
@@ -98,7 +94,7 @@ public class ConfigSuperAbilities {
case GIGA_DRILL_BREAKER:
return superAbilityMaxLength.getGigaDrillBreaker();
default:
mcMMO.p.getLogger().severe("Max Length Parameter not found for "+superAbilityType.toString());
mcMMO.p.getLogger().severe("Max Length Parameter not found for " + superAbilityType.toString());
return 60;
}
}

View File

@@ -71,13 +71,25 @@ public class PotionConfig extends ConfigCollection {
register();
}
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
public static PotionConfig getInstance() {
return mcMMO.getConfigManager().getPotionConfig();
}
@Override
public void unload() {
potionMap.clear();
}
private void initIngredientLists()
{
private void initIngredientLists() {
concoctionsIngredientsTierOne = new ArrayList<>();
concoctionsIngredientsTierTwo = new ArrayList<>();
concoctionsIngredientsTierThree = new ArrayList<>();
@@ -88,18 +100,6 @@ public class PotionConfig extends ConfigCollection {
concoctionsIngredientsTierEight = new ArrayList<>();
}
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
* @return the instance of this config
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
public static PotionConfig getInstance() {
return mcMMO.getConfigManager().getPotionConfig();
}
/**
* The version of this config
*

View File

@@ -33,8 +33,9 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
@@ -49,8 +50,7 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
public void register() {
ConfigurationNode excavationTreasureNode = getUserRootNode().getNode(EXCAVATION);
if(excavationTreasureNode == null)
{
if (excavationTreasureNode == null) {
mcMMO.p.getLogger().info("Excavation treasures in treasures config not defined");
return;
}
@@ -62,8 +62,7 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
//Treasure Material Definition
Material treasureMaterial = Material.matchMaterial(treasureName.toUpperCase());
if(treasureMaterial != null)
{
if (treasureMaterial != null) {
ConfigurationNode currentTreasure = excavationTreasureNode.getNode(treasureName);
//TODO: Rewrite the entire treasure system because it sucks
@@ -84,40 +83,35 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
ArrayList<String> dropsFrom = new ArrayList(currentTreasure.getNode("Drops_From").getList(TypeToken.of(String.class)));
//VALIDATE AMOUNT
if(amount <= 0)
{
mcMMO.p.getLogger().severe("Excavation Treasure named "+treasureName+" in the config has an amount of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (amount <= 0) {
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has an amount of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
//VALIDATE XP
if(xp <= 0)
{
mcMMO.p.getLogger().info("Excavation Treasure named "+treasureName+" in the config has xp set to 0 or below, is this intentional?");
if (xp <= 0) {
mcMMO.p.getLogger().info("Excavation Treasure named " + treasureName + " in the config has xp set to 0 or below, is this intentional?");
xp = 0;
}
//VALIDATE DROP CHANCE
if(dropChance <= 0)
{
mcMMO.p.getLogger().severe("Excavation Treasure named "+treasureName+" in the config has a drop chance of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (dropChance <= 0) {
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has a drop chance of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
//VALIDATE DROP LEVEL
if(dropLevel < 0)
{
mcMMO.p.getLogger().info("Excavation Treasure named "+treasureName+" in the config has a drop level below 0, is this intentional?");
if (dropLevel < 0) {
mcMMO.p.getLogger().info("Excavation Treasure named " + treasureName + " in the config has a drop level below 0, is this intentional?");
dropLevel = 0;
}
//VALIDATE DROP SOURCES
if(dropsFrom == null || dropsFrom.isEmpty())
{
mcMMO.p.getLogger().severe("Excavation Treasure named "+treasureName+" in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (dropsFrom == null || dropsFrom.isEmpty()) {
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
@@ -125,8 +119,7 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
//Custom Name
if(currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe"))
{
if (currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe")) {
customName = currentTreasure.getNode(CUSTOM_NAME).getString();
}
@@ -139,15 +132,14 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
/*
* Add to map
*/
for(String dropBlock : dropsFrom)
{
for (String dropBlock : dropsFrom) {
excavationMap.computeIfAbsent(dropBlock, k -> new ArrayList<>());
excavationMap.get(dropBlock).add(excavationTreasure);
}
} else {
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named "+treasureName+" does not match any known material.");
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named " + treasureName + " does not match any known material.");
}
}
} catch (ObjectMappingException e) {

View File

@@ -44,11 +44,17 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<>();
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<>();
public FishingTreasureConfig() {
super("fishing_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
register();
}
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
@@ -56,11 +62,6 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
return mcMMO.getConfigManager().getFishingTreasureConfig();
}
public FishingTreasureConfig() {
super("fishing_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
register();
}
/**
* Register stuff
*/
@@ -70,14 +71,12 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
ConfigurationNode fishingTreasureNode = getUserRootNode().getNode(FISHING);
if(fishingTreasureNode == null)
{
if (fishingTreasureNode == null) {
mcMMO.p.getLogger().info("Fishing treasures in treasures config not defined");
return;
}
// Initialize fishing HashMap
for (Rarity rarity : Rarity.values()) {
if (!fishingRewards.containsKey(rarity)) {
@@ -92,8 +91,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
//Treasure Material Definition
Material treasureMaterial = Material.matchMaterial(treasureName.toUpperCase());
if(treasureMaterial != null)
{
if (treasureMaterial != null) {
ConfigurationNode currentTreasure = fishingTreasureNode.getNode(treasureName);
//TODO: Rewrite the entire treasure system because it sucks
@@ -112,25 +110,22 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
ArrayList<String> dropsFrom = new ArrayList(currentTreasure.getNode(DROPS_FROM).getList(TypeToken.of(String.class)));
//VALIDATE AMOUNT
if(amount <= 0)
{
mcMMO.p.getLogger().severe("Excavation Treasure named "+treasureName+" in the config has an amount of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (amount <= 0) {
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has an amount of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
//VALIDATE XP
if(xp <= 0)
{
mcMMO.p.getLogger().info("Excavation Treasure named "+treasureName+" in the config has xp set to 0 or below, is this intentional?");
if (xp <= 0) {
mcMMO.p.getLogger().info("Excavation Treasure named " + treasureName + " in the config has xp set to 0 or below, is this intentional?");
xp = 0;
}
//VALIDATE DROP SOURCES
if(dropsFrom == null || dropsFrom.isEmpty())
{
mcMMO.p.getLogger().severe("Excavation Treasure named "+treasureName+" in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (dropsFrom == null || dropsFrom.isEmpty()) {
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
@@ -138,8 +133,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
//Custom Name
if(currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe"))
{
if (currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe")) {
customName = currentTreasure.getNode(CUSTOM_NAME).getString();
}
@@ -155,10 +149,8 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
String configRarity = currentTreasure.getNode(RARITY).getString();
for(Rarity rarity : Rarity.values())
{
if(rarity.toString().equalsIgnoreCase(configRarity))
{
for (Rarity rarity : Rarity.values()) {
if (rarity.toString().equalsIgnoreCase(configRarity)) {
/*if(fishingRewards.get(rarity) == null)
fishingRewards.put(rarity, new ArrayList<>());*/
@@ -167,7 +159,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
}
} else {
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named "+treasureName+" does not match any known material.");
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named " + treasureName + " does not match any known material.");
}
}
} catch (ObjectMappingException e) {
@@ -185,11 +177,10 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
loadEnchantments();
}
private void loadShake(EntityType entityType)
{
private void loadShake(EntityType entityType) {
ConfigurationNode shakeTreasureNode = getUserRootNode().getNode(SHAKE, entityType.toString());
if(shakeTreasureNode != null)
if (shakeTreasureNode != null)
return;
try {
@@ -199,8 +190,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
//Treasure Material Definition
Material treasureMaterial = Material.matchMaterial(treasureName.toUpperCase());
if(treasureMaterial != null)
{
if (treasureMaterial != null) {
ConfigurationNode currentTreasure = shakeTreasureNode.getNode(treasureName);
//TODO: Rewrite the entire treasure system because it sucks
@@ -221,40 +211,35 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
ArrayList<String> dropsFrom = new ArrayList(currentTreasure.getNode(DROPS_FROM).getList(TypeToken.of(String.class)));
//VALIDATE AMOUNT
if(amount <= 0)
{
mcMMO.p.getLogger().severe("Excavation Treasure named "+treasureName+" in the config has an amount of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (amount <= 0) {
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has an amount of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
//VALIDATE XP
if(xp <= 0)
{
mcMMO.p.getLogger().info("Excavation Treasure named "+treasureName+" in the config has xp set to 0 or below, is this intentional?");
if (xp <= 0) {
mcMMO.p.getLogger().info("Excavation Treasure named " + treasureName + " in the config has xp set to 0 or below, is this intentional?");
xp = 0;
}
//VALIDATE DROP CHANCE
if(dropChance <= 0)
{
mcMMO.p.getLogger().severe("Excavation Treasure named "+treasureName+" in the config has a drop chance of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (dropChance <= 0) {
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has a drop chance of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
//VALIDATE DROP LEVEL
if(dropLevel < 0)
{
mcMMO.p.getLogger().info("Excavation Treasure named "+treasureName+" in the config has a drop level below 0, is this intentional?");
if (dropLevel < 0) {
mcMMO.p.getLogger().info("Excavation Treasure named " + treasureName + " in the config has a drop level below 0, is this intentional?");
dropLevel = 0;
}
//VALIDATE DROP SOURCES
if(dropsFrom == null || dropsFrom.isEmpty())
{
mcMMO.p.getLogger().severe("Excavation Treasure named "+treasureName+" in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (dropsFrom == null || dropsFrom.isEmpty()) {
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
@@ -262,8 +247,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
//Custom Name
if(currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe"))
{
if (currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe")) {
customName = currentTreasure.getNode(CUSTOM_NAME).getString();
}
@@ -281,7 +265,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
shakeMap.get(entityType).add(shakeTreasure);
} else {
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named "+treasureName+" does not match any known material.");
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named " + treasureName + " does not match any known material.");
}
}
} catch (ObjectMappingException e) {

View File

@@ -36,8 +36,9 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
@@ -52,8 +53,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
public void register() {
ConfigurationNode herbalismTreasureNode = getUserRootNode().getNode(HYLIAN_LUCK);
if(herbalismTreasureNode == null)
{
if (herbalismTreasureNode == null) {
mcMMO.p.getLogger().info("Excavation treasures in treasures config not defined");
return;
}
@@ -65,8 +65,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
//Treasure Material Definition
Material treasureMaterial = Material.matchMaterial(treasureName.toUpperCase());
if(treasureMaterial != null)
{
if (treasureMaterial != null) {
ConfigurationNode currentTreasure = herbalismTreasureNode.getNode(treasureName);
//TODO: Rewrite the entire treasure system because it sucks
@@ -87,40 +86,35 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
ArrayList<String> dropsFrom = new ArrayList(currentTreasure.getNode("Drops_From").getList(TypeToken.of(String.class)));
//VALIDATE AMOUNT
if(amount <= 0)
{
mcMMO.p.getLogger().severe("Herbalism Hylian Luck Treasure named "+treasureName+" in the config has an amount of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (amount <= 0) {
mcMMO.p.getLogger().severe("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has an amount of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
//VALIDATE XP
if(xp <= 0)
{
mcMMO.p.getLogger().info("Herbalism Hylian Luck Treasure named "+treasureName+" in the config has xp set to 0 or below, is this intentional?");
if (xp <= 0) {
mcMMO.p.getLogger().info("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has xp set to 0 or below, is this intentional?");
xp = 0;
}
//VALIDATE DROP CHANCE
if(dropChance <= 0)
{
mcMMO.p.getLogger().severe("Herbalism Hylian Luck Treasure named "+treasureName+" in the config has a drop chance of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (dropChance <= 0) {
mcMMO.p.getLogger().severe("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has a drop chance of 0 or below, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
//VALIDATE DROP LEVEL
if(dropLevel < 0)
{
mcMMO.p.getLogger().info("Herbalism Hylian Luck Treasure named "+treasureName+" in the config has a drop level below 0, is this intentional?");
if (dropLevel < 0) {
mcMMO.p.getLogger().info("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has a drop level below 0, is this intentional?");
dropLevel = 0;
}
//VALIDATE DROP SOURCES
if(dropsFrom == null || dropsFrom.isEmpty())
{
mcMMO.p.getLogger().severe("Herbalism Hylian Luck Treasure named "+treasureName+" in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
mcMMO.p.getLogger().severe("Skipping "+treasureName+" for being invalid");
if (dropsFrom == null || dropsFrom.isEmpty()) {
mcMMO.p.getLogger().severe("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
continue;
}
@@ -128,8 +122,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
//Custom Name
if(currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe"))
{
if (currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe")) {
customName = currentTreasure.getNode(CUSTOM_NAME).getString();
}
@@ -142,8 +135,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
/*
* Add to map
*/
for(String dropBlock : dropsFrom)
{
for (String dropBlock : dropsFrom) {
if (dropBlock.equals("Bushes")) {
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.FERN), hylianTreasure);
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.TALL_GRASS), hylianTreasure);
@@ -176,7 +168,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
}
} else {
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named "+treasureName+" does not match any known material.");
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named " + treasureName + " does not match any known material.");
}
}
} catch (ObjectMappingException e) {

View File

@@ -24,6 +24,7 @@ public class TreasureFactory {
/**
* Make a new ExcavationTreasure
*
* @param material
* @param dropAmount
* @param xpReward
@@ -33,29 +34,25 @@ public class TreasureFactory {
* @param customLore
* @return
*/
public static ExcavationTreasure makeExcavationTreasure(Material material, int dropAmount, int xpReward, double dropChance, int dropLevel, String customName, ConfigurationNode customLore)
{
public static ExcavationTreasure makeExcavationTreasure(Material material, int dropAmount, int xpReward, double dropChance, int dropLevel, String customName, ConfigurationNode customLore) {
ItemStack treasure = makeItemStack(material, dropAmount, customName, customLore);
return new ExcavationTreasure(treasure, xpReward, dropChance, dropLevel);
}
public static ShakeTreasure makeShakeTreasure(Material material, int dropAmount, int xpReward, double dropChance, int dropLevel, String customName, ConfigurationNode customLore)
{
public static ShakeTreasure makeShakeTreasure(Material material, int dropAmount, int xpReward, double dropChance, int dropLevel, String customName, ConfigurationNode customLore) {
ItemStack treasure = makeItemStack(material, dropAmount, customName, customLore);
return new ShakeTreasure(treasure, xpReward, dropChance, dropLevel);
}
public static FishingTreasure makeFishingTreasure(Material material, int dropAmount, int xpReward, String customName, ConfigurationNode customLore)
{
public static FishingTreasure makeFishingTreasure(Material material, int dropAmount, int xpReward, String customName, ConfigurationNode customLore) {
ItemStack treasure = makeItemStack(material, dropAmount, customName, customLore);
return new FishingTreasure(treasure, xpReward);
}
public static HylianTreasure makeHylianTreasure(Material material, int dropAmount, int xpReward, double dropChance, int dropLevel, String customName, ConfigurationNode customLore)
{
public static HylianTreasure makeHylianTreasure(Material material, int dropAmount, int xpReward, double dropChance, int dropLevel, String customName, ConfigurationNode customLore) {
ItemStack treasure = makeItemStack(material, dropAmount, customName, customLore);
return new HylianTreasure(treasure, xpReward, dropChance, dropLevel);
@@ -70,16 +67,14 @@ public class TreasureFactory {
treasure = makePotionItemStack(material, dropAmount, customName, customLore);*/
/* ADD CUSTOM NAME */
if(customName != null)
{
if (customName != null) {
ItemMeta itemMeta = treasure.getItemMeta();
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', customName));
treasure.setItemMeta(itemMeta);
}
/* ADD CUSTOM LORE */
if(customLore != null && !customLore.getString().equalsIgnoreCase(CHANGE_ME))
{
if (customLore != null && !customLore.getString().equalsIgnoreCase(CHANGE_ME)) {
ItemMeta itemMeta = treasure.getItemMeta();
List<String> lore = new ArrayList<>();
@@ -97,16 +92,13 @@ public class TreasureFactory {
}
//TODO: Do this later
return treasure;
}
private static boolean isPotion(Material material)
{
switch(material)
{
private static boolean isPotion(Material material) {
switch (material) {
case POTION:
case SPLASH_POTION:
case LINGERING_POTION: