From 121c54b80285265d4bd0589b040bba48a12df62e Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 20 Mar 2019 20:03:11 -0700 Subject: [PATCH] Repair Config Pt 2 --- Changelog.txt | 1 + .../hocon/skills/ConfigScalingSubSkill.java | 33 ++++++++++ .../ConfigScalingSubSkillPercentage.java | 26 ++++++++ .../skills/ConfigScalingSubSkillRetro.java | 38 ++++++++++++ .../skills/ConfigScalingSubSkillStandard.java | 37 +++++++++++ .../hocon/skills/repair/ConfigRepair.java | 22 +++++++ .../repair/ConfigRepairArcaneForging.java | 29 +++++++++ .../repair/ConfigRepairSuperRepair.java | 16 +++++ .../repairmastery/ConfigRepairMastery.java | 15 +++++ .../repairmastery/RepairMasteryRetro.java | 38 ++++++++++++ .../repairmastery/RepairMasterySettings.java | 32 ++++++++++ .../repairmastery/RepairMasteryStandard.java | 37 +++++++++++ src/main/java/com/gmail/nossr50/mcMMO.java | 61 +++++++++++++++++-- 13 files changed, 381 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkill.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillPercentage.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillRetro.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillStandard.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepairArcaneForging.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepairSuperRepair.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/ConfigRepairMastery.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasteryRetro.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasterySettings.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasteryStandard.java diff --git a/Changelog.txt b/Changelog.txt index 8eaeb8011..be8b950e7 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -9,6 +9,7 @@ Key: Version 2.2.0 mcMMO's config system has been rewritten + mcMMO will now warn you in the console if it thinks you are running incompatible server software Parties no longer have a cap, you can level them forever for bragging rights Optimizations were made for many anti-exploit behaviours Acrobatic's Dodge will no longer reward XP for a few seconds after a TP diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkill.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkill.java new file mode 100644 index 000000000..2fac211a4 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkill.java @@ -0,0 +1,33 @@ +package com.gmail.nossr50.config.hocon.skills; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigScalingSubSkill { + + @Setting(value = "Standard-Mode-Scaling-Settings", comment = "Standard mode is the new default level scaling for mcMMO" + + "\nMost skills in standard mode scale from 1-100, maxing out at 100." + + "\nStandard scaling is fairly new, and it replaced the previous scaling method which is now known as RetroMode scaling." + + "\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." + + "\nSettings from here are only applied when using Standard mode scaling.") + private ConfigScalingSubSkillStandard standardSettings = new ConfigScalingSubSkillStandard(); + + @Setting(value = "Retro-Mode-Scaling-Settings", comment = "Retro mode is the optional level scaling for mcMMO, which was replaced by Standard scaling." + + "\nMost skills in retro mode scale from 1-1000, maxing out at 1000." + + "\nRetro scaling was the main method of scaling in mcMMO for almost 8 years," + + "\n and it was replaced in 2.1 with the new 1-100 scaling method which is known as Standard mode scaling." + + "\nYou can still use Retro Mode scaling, it will never be removed from mcMMO so do not worry about using it!" + + "\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." + + "\nSettings from here are only applied when using Retro mode scaling.") + private ConfigScalingSubSkillRetro retroSettings = new ConfigScalingSubSkillRetro(); + + + public ConfigScalingSubSkillStandard getStandardSettings() { + return standardSettings; + } + + public ConfigScalingSubSkillRetro getRetroSettings() { + return retroSettings; + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillPercentage.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillPercentage.java new file mode 100644 index 000000000..5724512e3 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillPercentage.java @@ -0,0 +1,26 @@ +package com.gmail.nossr50.config.hocon.skills; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigScalingSubSkillPercentage { + + @Setting(value = "Standard-Mode-Scaling-Settings", comment = "Standard mode is the new default level scaling for mcMMO" + + "\nMost skills in standard mode scale from 1-100, maxing out at 100." + + "\nStandard scaling is fairly new, and it replaced the previous scaling method which is now known as RetroMode scaling." + + "\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." + + "\nSettings from here are only applied when using Standard mode scaling.") + private ConfigScalingSubSkillStandard standardSettings; + + @Setting(value = "Retro-Mode-Scaling-Settings", comment = "Retro mode is the optional level scaling for mcMMO, which was replaced by Standard scaling." + + "\nMost skills in retro mode scale from 1-1000, maxing out at 1000." + + "\nRetro scaling was the main method of scaling in mcMMO for almost 8 years," + + "\n and it was replaced in 2.1 with the new 1-100 scaling method which is known as Standard mode scaling." + + "\nYou can still use Retro Mode scaling, it will never be removed from mcMMO so do not worry about using it!" + + "\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." + + "\nSettings from here are only applied when using Retro mode scaling.") + private ConfigScalingSubSkillRetro retroSettings; + + +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillRetro.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillRetro.java new file mode 100644 index 000000000..b6bd13f94 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillRetro.java @@ -0,0 +1,38 @@ +package com.gmail.nossr50.config.hocon.skills; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigScalingSubSkillRetro { + + public static final String FIFTY_PERCENT_EXAMPLE = "500"; + public static final String MAX_BONUS_LEVEL_EXAMPLE = "1000"; + public static final String ODDS_PERCENTAGE_EXAMPLE = "25%"; + public static final int MAX_BONUS_LEVEL_DEFAULT = 1000; + public static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D; + + @Setting(value = "Retro-Mode-Max-Bonus-Level", comment = "At the max bonus level a player will have full benefits from this scaling skill." + + "\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." + + "\nNote: This is the setting for RETRO MODE!" + + "\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT) + private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT; + + @Setting(value = "Retro-Mode-Success-Rate-Cap-Percentage", comment = "This is the odds for RNG components of this sub-skill to succeed when a player has reached \"Max-Bonus-Level\"." + + "\nMax skill chance is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." + + "\nAs an example, imagine \"Retro-Mode-Success-Rate-Cap-Percentage\" 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." + + "\nNote: This is the setting for RETRO MODE!" + + "\nDefault value: "+CHANCE_AT_MAX_SKILL_DEFAULT) + private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT; + + public int getMaxBonusLevel() { + return maxBonusLevel; + } + + public double getChanceAtMaxSkill() { + return chanceAtMaxSkill; + } + +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillStandard.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillStandard.java new file mode 100644 index 000000000..8d78cefbc --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillStandard.java @@ -0,0 +1,37 @@ +package com.gmail.nossr50.config.hocon.skills; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigScalingSubSkillStandard { + + public static final String FIFTY_PERCENT_EXAMPLE = "50"; + public static final String MAX_BONUS_LEVEL_EXAMPLE = "100"; + public static final String ODDS_PERCENTAGE_EXAMPLE = "25%"; + public static final int MAX_BONUS_LEVEL_DEFAULT = 100; + public static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D; + + @Setting(value = "Standard-Mode-Max-Bonus-Level", comment = "At the max bonus level a player will have full benefits from this scaling skill." + + "\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." + + "\nNote: This is the setting for STANDARD MODE!" + + "\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT) + private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT; + + @Setting(value = "Standard-Mode-Success-Rate-Cap-Percentage", comment = "This is the odds for RNG components of this sub-skill to succeed when a player has reached \"Max-Bonus-Level\"." + + "\nMax skill chance is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." + + "\nAs an example, imagine \"Standard-Mode-Success-Rate-Cap-Percentage\" 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." + + "\nNote: This is the setting for STANDARD MODE!" + + "\nDefault value: "+CHANCE_AT_MAX_SKILL_DEFAULT) + private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT; + + public int getMaxBonusLevel() { + return maxBonusLevel; + } + + public double getChanceAtMaxSkill() { + return chanceAtMaxSkill; + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepair.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepair.java index ab8c5a36c..6475ec0da 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepair.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepair.java @@ -1,8 +1,30 @@ package com.gmail.nossr50.config.hocon.skills.repair; +import com.gmail.nossr50.config.hocon.skills.repair.repairmastery.ConfigRepairMastery; +import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class ConfigRepair { + @Setting(value = "Repair-Mastery", comment = "Settings related to the repair mastery subskill") + private ConfigRepairMastery repairMastery = new ConfigRepairMastery(); + + @Setting(value = "Super-Repair", comment = "Settings related to the super repair subskill") + private ConfigRepairSuperRepair superRepair = new ConfigRepairSuperRepair(); + + @Setting(value = "Arcane-Forging", comment = "Settings related to the arcane forging subskill") + private ConfigRepairArcaneForging arcaneForging = new ConfigRepairArcaneForging(); + + public ConfigRepairMastery getRepairMastery() { + return repairMastery; + } + + public ConfigRepairSuperRepair getSuperRepair() { + return superRepair; + } + + public ConfigRepairArcaneForging getArcaneForging() { + return arcaneForging; + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepairArcaneForging.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepairArcaneForging.java new file mode 100644 index 000000000..13c49af87 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepairArcaneForging.java @@ -0,0 +1,29 @@ +package com.gmail.nossr50.config.hocon.skills.repair; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigRepairArcaneForging { + + public static final boolean LOSE_ENCHANTS_DEFAULT = true; + public static final boolean DOWNGRADES_ENABLED_DEFAULT = true; + @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) + 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) + private boolean downgradesEnabled = DOWNGRADES_ENABLED_DEFAULT; + + public boolean isMayLoseEnchants() { + return mayLoseEnchants; + } + + public boolean isDowngradesEnabled() { + return downgradesEnabled; + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepairSuperRepair.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepairSuperRepair.java new file mode 100644 index 000000000..78f89265b --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepairSuperRepair.java @@ -0,0 +1,16 @@ +package com.gmail.nossr50.config.hocon.skills.repair; + +import com.gmail.nossr50.config.hocon.skills.ConfigScalingSubSkill; +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigRepairSuperRepair { + + @Setting(value = "Settings") + private ConfigScalingSubSkill superRepair = new ConfigScalingSubSkill(); + + public ConfigScalingSubSkill getSuperRepair() { + return superRepair; + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/ConfigRepairMastery.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/ConfigRepairMastery.java new file mode 100644 index 000000000..c59495859 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/ConfigRepairMastery.java @@ -0,0 +1,15 @@ +package com.gmail.nossr50.config.hocon.skills.repair.repairmastery; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigRepairMastery { + + @Setting(value = "Settings") + private RepairMasterySettings settings = new RepairMasterySettings(); + + public RepairMasterySettings getSettings() { + return settings; + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasteryRetro.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasteryRetro.java new file mode 100644 index 000000000..d5adf9706 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasteryRetro.java @@ -0,0 +1,38 @@ +package com.gmail.nossr50.config.hocon.skills.repair.repairmastery; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class RepairMasteryRetro { + + public static final int MAX_BONUS_LEVEL_DEFAULT = 1000; + public static final double MAX_BONUS_PERCENTAGE = 200.0D; + public static final String PLAYER_LEVEL_FIFTY_PERCENT_EXAMPLE = "500"; + public static final String MAX_BONUS_LEVEL_EXAMPLE = "1000"; + public static final String BONUS_PERCENTAGE_EXAMPLE = "100%"; + + @Setting(value = "Standard-Mode-Max-Bonus-Level", comment = "At the max bonus level a player will have full benefits from this scaling skill." + + "\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." + + "\nNote: This is the setting for STANDARD MODE!" + + "\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT) + private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT; + + @Setting(value = "Standard-Mode-Max-Bonus-Percentage", comment = "This is the maximum benefit for additional repair amount from this skill when the player reaches \"Max-Bonus-Level\"." + + "\nRepair Mastery's bonus to repair is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." + + "\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." + + "\nNote: This is the setting for STANDARD MODE!" + + "\nDefault value: "+MAX_BONUS_PERCENTAGE) + private double maxBonusPercentage = MAX_BONUS_PERCENTAGE; + + public int getMaxBonusLevel() { + return maxBonusLevel; + } + + public double getMaxBonusPercentage() { + return maxBonusPercentage; + } + +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasterySettings.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasterySettings.java new file mode 100644 index 000000000..364febca4 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasterySettings.java @@ -0,0 +1,32 @@ +package com.gmail.nossr50.config.hocon.skills.repair.repairmastery; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class RepairMasterySettings { + + @Setting(value = "Standard-Mode-Scaling-Settings", comment = "Standard mode is the new default level scaling for mcMMO" + + "\nMost skills in standard mode scale from 1-100, maxing out at 100." + + "\nStandard scaling is fairly new, and it replaced the previous scaling method which is now known as RetroMode scaling." + + "\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." + + "\nSettings from here are only applied when using Standard mode scaling.") + private RepairMasteryStandard standard = new RepairMasteryStandard(); + + @Setting(value = "Retro-Mode-Scaling-Settings", comment = "Retro mode is the optional level scaling for mcMMO, which was replaced by Standard scaling." + + "\nMost skills in retro mode scale from 1-1000, maxing out at 1000." + + "\nRetro scaling was the main method of scaling in mcMMO for almost 8 years," + + "\n and it was replaced in 2.1 with the new 1-100 scaling method which is known as Standard mode scaling." + + "\nYou can still use Retro Mode scaling, it will never be removed from mcMMO so do not worry about using it!" + + "\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." + + "\nSettings from here are only applied when using Retro mode scaling.") + private RepairMasteryRetro retro = new RepairMasteryRetro(); + + public RepairMasteryStandard getStandard() { + return standard; + } + + public RepairMasteryRetro getRetro() { + return retro; + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasteryStandard.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasteryStandard.java new file mode 100644 index 000000000..ad972a10c --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/repairmastery/RepairMasteryStandard.java @@ -0,0 +1,37 @@ +package com.gmail.nossr50.config.hocon.skills.repair.repairmastery; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class RepairMasteryStandard { + + public static final int MAX_BONUS_LEVEL_DEFAULT = 100; + public static final double MAX_BONUS_PERCENTAGE = 200.0D; + public static final String PLAYER_LEVEL_FIFTY_PERCENT_EXAMPLE = "50"; + public static final String MAX_BONUS_LEVEL_EXAMPLE = "100"; + public static final String BONUS_PERCENTAGE_EXAMPLE = "100%"; + + @Setting(value = "Standard-Mode-Max-Bonus-Level", comment = "At the max bonus level a player will have full benefits from this scaling skill." + + "\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." + + "\nNote: This is the setting for STANDARD MODE!" + + "\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT) + private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT; + + @Setting(value = "Standard-Mode-Max-Bonus-Percentage", comment = "This is the maximum benefit for additional repair amount from this skill when the player reaches \"Max-Bonus-Level\"." + + "\nRepair Mastery's bonus to repair is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." + + "\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." + + "\nNote: This is the setting for STANDARD MODE!" + + "\nDefault value: "+MAX_BONUS_PERCENTAGE) + private double maxBonusPercentage = MAX_BONUS_PERCENTAGE; + + public int getMaxBonusLevel() { + return maxBonusLevel; + } + + public double getMaxBonusPercentage() { + return maxBonusPercentage; + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 9f3844f5d..a1587591f 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -50,6 +50,10 @@ import java.io.File; import java.io.IOException; public class mcMMO extends JavaPlugin { + public static final String COMPATIBLE_SERVER_SOFTWARE = "Spigot, Paper"; + public static final String INCOMPATIBLE_SERVER_SOFTWARE = "CraftBukkit"; + public static final String COMPATIBLE_MINECRAFT_VERSIONS = "1.13.2"; + /* Managers */ private static ChunkManager placeStore; private static ConfigManager configManager; @@ -110,6 +114,11 @@ public class mcMMO extends JavaPlugin { try { p = this; getLogger().setFilter(new LogFilter(this)); + + //DEBUG + /*getLogger().info(Bukkit.getBukkitVersion()); + getLogger().info(Bukkit.getVersion());*/ + metadataValue = new FixedMetadataValue(this, true); PluginManager pluginManager = getServer().getPluginManager(); @@ -175,11 +184,11 @@ public class mcMMO extends JavaPlugin { metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Retro")); //Simplified Server Software Tracking - if(Bukkit.getServer().getBukkitVersion().contains("paper")) + if(Bukkit.getServer().getVersion().contains("paper")) metrics.addCustomChart(new Metrics.SimplePie("Server_software", () -> "Paper")); - else if(Bukkit.getServer().getBukkitVersion().contains("spigot")) + else if(Bukkit.getServer().getVersion().contains("spigot") && !Bukkit.getServer().getVersion().contains("paper")) metrics.addCustomChart(new Metrics.SimplePie("Server_software", () -> "Spigot")); - else if(Bukkit.getServer().getBukkitVersion().contains("bukkit")) + else if(Bukkit.getServer().getVersion().contains("bukkit")) metrics.addCustomChart(new Metrics.SimplePie("Server_software", () -> "CraftBukkit")); else metrics.addCustomChart(new Metrics.SimplePie("Server_software", () -> "Unknown")); @@ -191,8 +200,52 @@ public class mcMMO extends JavaPlugin { getLogger().severe("End of error report for mcMMO"); getLogger().info("Please do not replace the mcMMO jar while the server is running."); - getServer().getPluginManager().disablePlugin(this); + //getServer().getPluginManager().disablePlugin(this); } + + if(isIncompatibleVersion(Bukkit.getVersion(), Bukkit.getBukkitVersion())) + { + getLogger().severe("mcMMO is not supported for your current server software and or Minecraft version"); + + if(isServerSoftwareIncompatible(Bukkit.getVersion())) + { + getLogger().severe("mcMMO does not recognize your server software as being compatible!"); + getLogger().severe("Compatible Server Software: "+ COMPATIBLE_SERVER_SOFTWARE); + getLogger().severe("Incompatible Server Software: "+ INCOMPATIBLE_SERVER_SOFTWARE); + } + + if(isServerMinecraftVersionIncompatible(Bukkit.getBukkitVersion())) + { + getLogger().severe("mcMMO does not recognize your Minecraft Version as being compatible!"); + getLogger().severe("Compatible Minecraft Versions: "+ COMPATIBLE_MINECRAFT_VERSIONS); + getLogger().info("TIP: Paper and Spigot are extensions of CraftBukkit and are completely safe to upgrade to from CraftBukkit, please consider upgrading."); + } + } + } + + private boolean isIncompatibleVersion(String serverSoftwareString, String serverVersionString) + { + if (isServerSoftwareIncompatible(serverSoftwareString)) + return true; + + if (isServerMinecraftVersionIncompatible(serverVersionString)) + return true; + + return false; + } + + private boolean isServerMinecraftVersionIncompatible(String serverVersionString) { + if(!serverVersionString.contains("1.13.2")) + return true; + + return false; + } + + private boolean isServerSoftwareIncompatible(String serverSoftwareString) { + if(!serverSoftwareString.contains("paper") && !serverSoftwareString.contains("spigot")) + return true; + + return false; } @Override