Repair Config Pt 2

This commit is contained in:
nossr50 2019-03-20 20:03:11 -07:00
parent e709f04004
commit 121c54b802
13 changed files with 381 additions and 4 deletions

View File

@ -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

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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