Move experience related settings from config.yml to experience.yml

This commit is contained in:
TfT_02 2013-08-23 10:16:22 +02:00
parent 490bc195d8
commit 964b2636fb
21 changed files with 347 additions and 253 deletions

View File

@ -8,7 +8,8 @@ Key:
- Removal
Version 1.4.07-dev
+ Added new experienceFormula config file! Has support for EXPONENTIAL formula curves.
+ Added new experience.yml config file! Moved all experience related settings from config.yml to experience.yml
+ Added support for EXPONENTIAL formula curves to experience.yml
+ Added new /mcconvert command to convert players levels and experience from one formula curve to another.
+ Added snow to excavation
+ Added new experience curve option. Cumulative curve, calculates experience needed for next level using power level.
@ -30,7 +31,6 @@ Version 1.4.07-dev
! Vampirism can now be enabled without having Skill Death Penalty enabled
! Admin and Party chat prefixes are now customizable
! Changed the color of party leader names in Party chat
! Moved all experience formula related settings from config.yml to experienceFormula.yml (This includes skill modifiers and curve modifiers)
! Improved profile saving
! Improved partial name matcher
! Slightly improved update checker feedback

View File

@ -8,6 +8,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.api.exceptions.InvalidPlayerException;
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.child.FamilyTree;
@ -90,7 +91,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
*/
public static void addMultipliedXP(Player player, String skillType, int XP) {
UserManager.getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
UserManager.getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
@ -106,7 +107,7 @@ public final class ExperienceAPI {
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static void addMultipliedXPOffline(String playerName, String skillType, int XP) {
addOfflineXP(playerName, getSkillType(skillType), (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
addOfflineXP(playerName, getSkillType(skillType), (int) (XP * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
@ -123,7 +124,7 @@ public final class ExperienceAPI {
public static void addModifiedXP(Player player, String skillType, int XP) {
SkillType skill = getSkillType(skillType);
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier()));
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
@ -141,7 +142,7 @@ public final class ExperienceAPI {
public static void addModifiedXPOffline(String playerName, String skillType, int XP) {
SkillType skill = getSkillType(skillType);
addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier()));
addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**

View File

@ -9,7 +9,7 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
@ -21,7 +21,7 @@ public class XprateCommand implements TabExecutor {
private double originalRate;
public XprateCommand() {
originalRate = Config.getInstance().getExperienceGainsGlobalMultiplier();
originalRate = ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier();
}
@Override
@ -42,7 +42,7 @@ public class XprateCommand implements TabExecutor {
mcMMO.p.toggleXpEventEnabled();
}
Config.getInstance().setExperienceGainsGlobalMultiplier(originalRate);
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(originalRate);
return true;
case 2:
@ -66,7 +66,7 @@ public class XprateCommand implements TabExecutor {
}
int newXpRate = Integer.parseInt(args[0]);
Config.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
if (mcMMO.p.isXPEventEnabled()) {
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.started.0"));

View File

@ -11,7 +11,6 @@ import org.bukkit.entity.EntityType;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.repair.RepairMaterialType;
import com.gmail.nossr50.util.StringUtils;
public class Config extends AutoUpdateConfigLoader {
@ -136,9 +135,6 @@ public class Config extends AutoUpdateConfigLoader {
reason.add("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!");
}
if (getFishingBaseXP() <= 0) {
reason.add("Experience.Fishing.Base should be greater than 0!");
}
if (getDetonatorItemID() < 1) {
reason.add("Skills.Mining.Detonator_ID should be at least 1!");
@ -172,26 +168,6 @@ public class Config extends AutoUpdateConfigLoader {
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf_Amount should be greater than 0!");
}
if (getExperienceGainsGlobalMultiplier() <= 0) {
reason.add("Experience.Gains.Multiplier.Global should be greater than 0!");
}
if (getPlayerVersusPlayerXP() < 0) {
reason.add("Experience.Gains.Multiplier.PVP should be at least 0!");
}
if (getAnimalsXP() < 0) {
reason.add("Experience.Gains.Multiplier.Animals should be at least 0!");
}
if (getWitherSkeletonXP() < 0) {
reason.add("Experience.Gains.Multiplier.Wither_Skeleton should be at least 0!");
}
if (getSpawnedMobXpMultiplier() < 0) {
reason.add("Experience.Gains.Mobspawners.Multiplier should be at least 0!");
}
return noErrorsInConfig(reason);
}
@ -366,8 +342,6 @@ public class Config extends AutoUpdateConfigLoader {
/*
* SKILL SETTINGS
*/
public int getXp(SkillType skill, Material material) { return config.getInt("Experience." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
public boolean getDoubleDropsEnabled(SkillType skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
public boolean getDoubleDropsDisabled(SkillType skill) {
@ -391,16 +365,12 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getPreventXPAfterTeleport() { return config.getBoolean("Skills.Acrobatics.Prevent_XP_After_Teleport", true); }
/* Fishing */
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
/* Mining */
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
/* Repair */
public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
public double getRepairXP(RepairMaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
public int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); }
public int getSalvageAnvilId() { return config.getInt("Skills.Repair.Salvage_Anvil_ID", 41); }
@ -412,8 +382,6 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
/* Taming */
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40); }
@ -431,13 +399,6 @@ public class Config extends AutoUpdateConfigLoader {
}
/* Woodcutting */
public int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); }
public int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); }
public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }
public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
public boolean getSpruceDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Spruce", true); }
@ -461,23 +422,4 @@ public class Config extends AutoUpdateConfigLoader {
/* PVP & PVE Settings */
public boolean getPVPEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
public boolean getPVEEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
/*
* XP SETTINGS
*/
/* General Settings */
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); }
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience.Gains.Multiplier.Global", 1.0); }
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience.Gains.Multiplier.Global", value); }
/* Combat XP Multipliers */
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); }
public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); }
public double getSpawnedMobXpMultiplier() { return config.getDouble("Experience.Gains.Mobspawners.Multiplier", 0.0); }
}

View File

@ -3,16 +3,20 @@ package com.gmail.nossr50.config.experience;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.repair.RepairMaterialType;
import com.gmail.nossr50.util.StringUtils;
public class ExperienceConfig extends AutoUpdateConfigLoader {
private static ExperienceConfig instance;
private ExperienceConfig() {
super("experienceFormula.yml");
super("experience.yml");
validate();
}
@ -31,10 +35,11 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
protected boolean validateKeys() {
List<String> reason = new ArrayList<String>();
if (getExpModifier() <= 0) {
reason.add("Conversion.Exp_Modifier should be greater than 0!");
}
/*
* FORMULA SETTINGS
*/
/* Curve values */
if (getMultiplier(FormulaType.EXPONENTIAL) <= 0) {
reason.add("Experience_Formula.Exponential_Values.multiplier should be greater than 0!");
}
@ -47,10 +52,91 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
reason.add("Experience_Formula.Exponential_Values.exponent should be greater than 0!");
}
/* Global modifier */
if (getExperienceGainsGlobalMultiplier() <= 0) {
reason.add("Experience_Formula.Multiplier.Global should be greater than 0!");
}
/* PVP modifier */
if (getPlayerVersusPlayerXP() < 0) {
reason.add("Experience_Formula.Multiplier.PVP should be at least 0!");
}
/* Spawned Mob modifier */
if (getSpawnedMobXpMultiplier() < 0) {
reason.add("Experience_Formula.Mobspawners.Multiplier should be at least 0!");
}
/* Conversion */
if (getExpModifier() <= 0) {
reason.add("Conversion.Exp_Modifier should be greater than 0!");
}
/*
* XP SETTINGS
*/
/* Combat XP Multipliers */
if (getAnimalsXP() < 0) {
reason.add("Experience.Combat.Multiplier.Animals should be at least 0!");
}
if (getWitherSkeletonXP() < 0) {
reason.add("Experience.Combat.Multiplier.Wither_Skeleton should be at least 0!");
}
/* Fishing */
if (getFishingBaseXP() <= 0) {
reason.add("Experience.Fishing.Base should be greater than 0!");
}
/* Repair */
if (getRepairXPBase() <= 0) {
reason.add("Experience.Repair.Base should be greater than 0!");
}
/* Taming */
if (getTamingXPWolf() <= 0) {
reason.add("Experience.Taming.Animal_Taming.Wolf should be greater than 0!");
}
if (getTamingXPOcelot() <= 0) {
reason.add("Experience.Taming.Animal_Taming.Ocelot should be greater than 0!");
}
/* Woodcutting */
if (getWoodcuttingXPOak() <= 0) {
reason.add("Experience.Woodcutting.Oak should be greater than 0!");
}
if (getWoodcuttingXPBirch() <= 0) {
reason.add("Experience.Woodcutting.Birch should be greater than 0!");
}
if (getWoodcuttingXPSpruce() <= 0) {
reason.add("Experience.Woodcutting.Spruce should be greater than 0!");
}
if (getWoodcuttingXPJungle() <= 0) {
reason.add("Experience.Woodcutting.Jungle should be greater than 0!");
}
if (getWoodcuttingXPHugeBrownMushroom() <= 0) {
reason.add("Experience.Woodcutting.Huge_Mushroom_Brown should be greater than 0!");
}
if (getWoodcuttingXPHugeRedMushroom() <= 0) {
reason.add("Experience.Woodcutting.Huge_Mushroom_Red should be greater than 0!");
}
return noErrorsInConfig(reason);
}
/* XP Formula Multiplier */
/*
* FORMULA SETTINGS
*/
/* Curve settings */
public FormulaType getFormulaType() { return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve")); }
public boolean getCumulativeCurveEnabled() { return config.getBoolean("Experience_Formula.Cumulative_Curve", false); }
@ -59,9 +145,53 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public int getBase(FormulaType type) { return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base"); }
public double getExponent(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) +"_Values.exponent"); }
/* Global modifier */
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience_Formula.Multiplier.Global", 1.0); }
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience_Formula.Multiplier.Global", value); }
/* PVP modifier */
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0); }
/* Spawned Mob modifier */
public double getSpawnedMobXpMultiplier() { return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0); }
/* Skill modifiers */
public double getFormulaSkillModifier(SkillType skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); }
/* Conversion */
public double getExpModifier() { return config.getDouble("Conversion.Exp_Modifier", 1); }
/*
* XP SETTINGS
*/
/* General Settings */
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); }
/* Combat XP Multipliers */
public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); }
/* Materials */
public int getXp(SkillType skill, Material material) { return config.getInt("Experience." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
/* Fishing */
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
/* Repair */
public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
public double getRepairXP(RepairMaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
/* Taming */
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
/* Woodcutting */
public int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); }
public int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); }
public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
}

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.mods.CustomTool;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.skills.AbilityType;
@ -695,7 +696,7 @@ public class McMMOPlayer {
return 0;
}
xp = (float) (xp / skillType.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier());
xp = (float) (xp / skillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
if (Config.getInstance().getToolModsEnabled()) {
CustomTool tool = ModUtils.getToolFromItemStack(player.getItemInHand());

View File

@ -31,6 +31,7 @@ import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatManagerFactory;
import com.gmail.nossr50.chat.PartyChatManager;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@ -365,7 +366,7 @@ public class PlayerListener implements Listener {
}
if (plugin.isXPEventEnabled()) {
player.sendMessage(LocaleLoader.getString("XPRate.Event", Config.getInstance().getExperienceGainsGlobalMultiplier()));
player.sendMessage(LocaleLoader.getString("XPRate.Event", ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
if (Permissions.updateNotifications(player) && plugin.isUpdateAvailable()) {

View File

@ -191,7 +191,7 @@ public class MetricsManager {
// GlobalMultiplier Graph
Graph globalMultiplierGraph = metrics.createGraph("Global Multiplier Graph");
globalMultiplierGraph.addPlotter(new Metrics.Plotter(Config.getInstance().getExperienceGainsGlobalMultiplier() + "") {
globalMultiplierGraph.addPlotter(new Metrics.Plotter(ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier() + "") {
@Override
public int getValue() {
return 1;
@ -211,7 +211,7 @@ public class MetricsManager {
// GlobalMultiplierGraph Fuzzy Logic Numbers
Graph globalMultiplierGraphFuzzy = metrics.createGraph("Global Multiplier Fuzz");
if (Config.getInstance().getExperienceGainsGlobalMultiplier() > 1.0) {
if (ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier() > 1.0) {
globalMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Higher") {
@Override
public int getValue() {
@ -219,7 +219,7 @@ public class MetricsManager {
}
});
}
else if (Config.getInstance().getExperienceGainsGlobalMultiplier() < 1.0) {
else if (ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier() < 1.0) {
globalMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Lower") {
@Override
public int getValue() {

View File

@ -5,7 +5,7 @@ import java.util.List;
import org.bukkit.block.BlockState;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
@ -47,7 +47,7 @@ public class Excavation {
}
protected static int getBlockXP(BlockState blockState) {
int xp = Config.getInstance().getXp(SkillType.EXCAVATION, blockState.getType());
int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getType());
if (xp == 0 && ModUtils.isCustomExcavationBlock(blockState)) {
xp = ModUtils.getCustomBlock(blockState).getXpGain();

View File

@ -33,6 +33,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType;
@ -340,7 +341,7 @@ public class FishingManager extends SkillManager {
}
}
applyXpGain(Config.getInstance().getFishingBaseXP() + treasureXp);
applyXpGain(ExperienceConfig.getInstance().getFishingBaseXP() + treasureXp);
}
/**

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.Permissions;
import com.google.common.collect.Maps;
@ -58,7 +59,7 @@ public enum HerbalismBlock {
}
public int getXpGain() {
return Config.getInstance().getXp(SkillType.HERBALISM, blockType);
return ExperienceConfig.getInstance().getXp(SkillType.HERBALISM, blockType);
}
public boolean canDoubleDrop() {

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.Misc;
@ -23,10 +24,10 @@ public class Mining {
*/
protected static int getBlockXp(BlockState blockState) {
Material blockType = blockState.getType();
int xp = Config.getInstance().getXp(SkillType.MINING, blockType);
int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockType);
if (blockType == Material.GLOWING_REDSTONE_ORE) {
xp = Config.getInstance().getXp(SkillType.MINING, Material.REDSTONE_ORE);
xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, Material.REDSTONE_ORE);
}
else if (xp == 0 && ModUtils.isCustomMiningBlock(blockState)) {
xp = ModUtils.getCustomBlock(blockState).getXpGain();

View File

@ -13,6 +13,7 @@ import org.bukkit.inventory.PlayerInventory;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
@ -155,7 +156,7 @@ public class RepairManager extends SkillManager {
Repair.removeOneFrom(inventory, repairItemLocation);
// Give out XP like candy
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * Config.getInstance().getRepairXPBase() * Config.getInstance().getRepairXP(repairable.getRepairMaterialType())));
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * ExperienceConfig.getInstance().getRepairXPBase() * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())));
// BWONG BWONG BWONG
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);

View File

@ -3,7 +3,7 @@ package com.gmail.nossr50.skills.smelting;
import org.bukkit.Material;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.SkillType;
public class Smelting {
@ -49,10 +49,10 @@ public class Smelting {
public static double fluxMiningChance = AdvancedConfig.getInstance().getFluxMiningChance();
protected static int getResourceXp(Material resourceType) {
int xp = Config.getInstance().getXp(SkillType.SMELTING, resourceType);
int xp = ExperienceConfig.getInstance().getXp(SkillType.SMELTING, resourceType);
if (resourceType == Material.GLOWING_REDSTONE_ORE) {
xp = Config.getInstance().getXp(SkillType.SMELTING, Material.REDSTONE_ORE);
xp = ExperienceConfig.getInstance().getXp(SkillType.SMELTING, Material.REDSTONE_ORE);
}
return xp;

View File

@ -8,7 +8,7 @@ import org.bukkit.entity.Tameable;
import org.bukkit.entity.Wolf;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.locale.LocaleLoader;
public class Taming {
@ -32,8 +32,8 @@ public class Taming {
public static int thickFurUnlockLevel = AdvancedConfig.getInstance().getThickFurUnlock();
public static int thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
public static int wolfXp = Config.getInstance().getTamingXPWolf();
public static int ocelotXp = Config.getInstance().getTamingXPOcelot();
public static int wolfXp = ExperienceConfig.getInstance().getTamingXPWolf();
public static int ocelotXp = ExperienceConfig.getInstance().getTamingXPOcelot();
public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
return pet.isTamed() && owner instanceof Player && pet instanceof Wolf;

View File

@ -13,6 +13,7 @@ import org.bukkit.material.Tree;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Misc;
@ -43,10 +44,10 @@ public final class Woodcutting {
// Mushrooms aren't trees so we could never get species data from them
switch (blockState.getType()) {
case HUGE_MUSHROOM_1:
return Config.getInstance().getWoodcuttingXPHugeBrownMushroom();
return ExperienceConfig.getInstance().getWoodcuttingXPHugeBrownMushroom();
case HUGE_MUSHROOM_2:
return Config.getInstance().getWoodcuttingXPHugeRedMushroom();
return ExperienceConfig.getInstance().getWoodcuttingXPHugeRedMushroom();
default:
break;
@ -58,16 +59,16 @@ public final class Woodcutting {
switch (((Tree) blockState.getData()).getSpecies()) {
case GENERIC:
return Config.getInstance().getWoodcuttingXPOak();
return ExperienceConfig.getInstance().getWoodcuttingXPOak();
case REDWOOD:
return Config.getInstance().getWoodcuttingXPSpruce();
return ExperienceConfig.getInstance().getWoodcuttingXPSpruce();
case BIRCH:
return Config.getInstance().getWoodcuttingXPBirch();
return ExperienceConfig.getInstance().getWoodcuttingXPBirch();
case JUNGLE:
int xp = Config.getInstance().getWoodcuttingXPJungle();
int xp = ExperienceConfig.getInstance().getWoodcuttingXPJungle();
if (experienceGainMethod == ExperienceGainMethod.TREE_FELLER) {
xp *= 0.5;

View File

@ -19,6 +19,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
@ -460,14 +461,14 @@ public final class CombatUtils {
double baseXP = 0;
if (target instanceof Player) {
if (!Config.getInstance().getExperienceGainsPlayerVersusPlayerEnabled()) {
if (!ExperienceConfig.getInstance().getExperienceGainsPlayerVersusPlayerEnabled()) {
return;
}
Player defender = (Player) target;
if (defender.isOnline() && System.currentTimeMillis() >= UserManager.getPlayer(defender).getRespawnATS() + 5) {
baseXP = 20 * Config.getInstance().getPlayerVersusPlayerXP();
baseXP = 20 * ExperienceConfig.getInstance().getPlayerVersusPlayerXP();
}
}
else {
@ -476,7 +477,7 @@ public final class CombatUtils {
baseXP = ModUtils.getCustomEntity(target).getXpMultiplier();
}
else {
baseXP = Config.getInstance().getAnimalsXP();
baseXP = ExperienceConfig.getInstance().getAnimalsXP();
}
}
else {
@ -484,7 +485,7 @@ public final class CombatUtils {
switch (type) {
case BAT:
baseXP = Config.getInstance().getAnimalsXP();
baseXP = ExperienceConfig.getInstance().getAnimalsXP();
break;
case BLAZE:
@ -499,7 +500,7 @@ public final class CombatUtils {
case SLIME:
case SPIDER:
case ZOMBIE:
baseXP = Config.getInstance().getCombatXP(type);
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
break;
// Temporary workaround for custom entities
@ -510,17 +511,17 @@ public final class CombatUtils {
case SKELETON:
switch (((Skeleton) target).getSkeletonType()) {
case WITHER:
baseXP = Config.getInstance().getWitherSkeletonXP();
baseXP = ExperienceConfig.getInstance().getWitherSkeletonXP();
break;
default:
baseXP = Config.getInstance().getCombatXP(type);
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
break;
}
break;
case IRON_GOLEM:
if (!((IronGolem) target).isPlayerCreated()) {
baseXP = Config.getInstance().getCombatXP(type);
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
}
break;
@ -533,7 +534,7 @@ public final class CombatUtils {
}
if (target.hasMetadata(mcMMO.entityMetadataKey)) {
baseXP *= Config.getInstance().getSpawnedMobXpMultiplier();
baseXP *= ExperienceConfig.getInstance().getSpawnedMobXpMultiplier();
}
baseXP *= 10;

View File

@ -4,7 +4,7 @@
# For advanced users only! There is no need to change anything here.
#
# You can customize almost every aspect of every skill here.
# Its mainly here if you've changed "Experience.Formula.Curve_Modifier"
# Its mainly here if you've customized the experience formula.
# Configure at what level you get better with certain abilities.
#
#####

View File

@ -303,114 +303,6 @@ Double_Drops:
Spruce: true
Jungle: true
#
# Settings for XP distribution
###
Experience:
Gains:
# Experience gained from mobs not naturally spawned will get multiplied by this value. 0 by default.
Mobspawners:
Multiplier: 0
# Experience gained in every skill will get multiplied by this value. 1.0 by default, 2.0 means two times as much
Multiplier:
PVP: 1.0
Global: 1.0
PVP:
Rewards: true
Fishing:
Base: 800
Excavation:
Clay: 40
Dirt: 40
Grass: 40
Gravel: 40
Mycel: 40
Sand: 40
Snow: 20
Snow_Block: 40
Soul_Sand: 40
Woodcutting:
Oak: 70
Spruce: 80
Birch: 90
Jungle: 100
Huge_Mushroom_Red: 70
Huge_Mushroom_Brown: 70
Herbalism:
Brown_Mushroom: 150
Cactus: 30
Carrot: 50
Cocoa: 30
Crops: 50
Melon_Block: 20
Nether_Warts: 50
Potato: 50
Pumpkin: 20
Red_Mushroom: 150
Red_Rose: 100
Sugar_Cane_Block: 30
Vine: 10
Water_Lily: 100
Yellow_Flower: 100
Mining:
Coal_Ore: 100
Diamond_Ore: 750
Emerald_Ore: 1000
Ender_Stone: 150
Glowstone: 30
Gold_Ore: 350
Iron_Ore: 250
Lapis_Ore: 400
Mossy_Cobblestone: 30
Netherrack: 30
Obsidian: 150
Quartz_Ore: 250
Redstone_Ore: 150
Sandstone: 30
Stone: 30
Repair:
Base: 1000.0
Wood: 0.6
Stone: 1.3
Iron: 2.5
Gold: 0.3
Diamond: 5.0
Leather: 1.6
String: 1.8
Other: 1.5
Smelting:
Coal_Ore: 10
Diamond_Ore: 75
Emerald_Ore: 100
Gold_Ore: 35
Iron_Ore: 25
Lapis_Ore: 40
Quartz_Ore: 25
Redstone_Ore: 15
Taming:
Animal_Taming:
Wolf: 250
Ocelot: 500
Combat:
Multiplier:
Animals: 1.0
Creeper: 4.0
Skeleton: 3.0
Spider: 2.0
Giant: 4.0
Zombie: 2.0
Slime: 2.0
Ghast: 3.0
Pig_Zombie: 3.0
Enderman: 1.0
Cave_Spider: 3.0
Silverfish: 3.0
Blaze: 3.0
Magma_Cube: 2.0
Iron_Golem: 2.0
Wither_Skeleton: 4.0
#
# Settings for commands
###

View File

@ -0,0 +1,159 @@
#
# Experience configuration
#
# Configure the experience formula and experience settings here.
#
#####
#
# Settings for XP formula
###
Experience_Formula:
# Valid values are: LINEAR and EXPONENTIAL
# If an invalid value is entered, this will reset to the default setting, which is LINEAR
# LINEAR: base + (level * multiplier)
# EXPONENTIAL: multiplier * level ^ exponent + base
Curve: LINEAR
# If invalid values are entered mcMMO will use the default values instead and print an error in the console
Linear_Values:
base: 1020
multiplier: 20
Exponential_Values:
multiplier: 0.1
exponent: 1.80
base: 2000
# Cumulative experience curves will use a players power level instead of their skill level,
# players with high power levels will have to gain a lot more experience to reach the next level in every skill.
Cumulative_Curve: false
# Experience gained in every skill will get multiplied by this value. 1.0 by default, 2.0 means two times as much
Multiplier:
Global: 1.0
PVP: 1.0
# Experience gained from mobs not naturally spawned will get multiplied by this value. 0 by default.
Mobspawners:
Multiplier: 0
# Experience gained will get divided by these values. 1.0 by default, 2.0 means two times lower
Modifier:
Swords: 1.0
Taming: 1.0
Acrobatics: 1.0
Excavation: 1.0
Herbalism: 1.0
Unarmed: 1.0
Woodcutting: 1.0
Mining: 1.0
Archery: 1.0
Axes: 1.0
Repair: 1.0
Fishing: 1.0
#
# Settings for XP conversion with '/mcconvert experience'
###
Conversion:
# Old experience will get divided by this modifier
Exp_Modifier: 1
#
# Settings for XP distribution
###
Experience:
PVP:
Rewards: true
Fishing:
Base: 800
Excavation:
Clay: 40
Dirt: 40
Grass: 40
Gravel: 40
Mycel: 40
Sand: 40
Snow: 20
Snow_Block: 40
Soul_Sand: 40
Woodcutting:
Oak: 70
Spruce: 80
Birch: 90
Jungle: 100
Huge_Mushroom_Red: 70
Huge_Mushroom_Brown: 70
Herbalism:
Brown_Mushroom: 150
Cactus: 30
Carrot: 50
Cocoa: 30
Crops: 50
Melon_Block: 20
Nether_Warts: 50
Potato: 50
Pumpkin: 20
Red_Mushroom: 150
Red_Rose: 100
Sugar_Cane_Block: 30
Vine: 10
Water_Lily: 100
Yellow_Flower: 100
Mining:
Coal_Ore: 100
Diamond_Ore: 750
Emerald_Ore: 1000
Ender_Stone: 150
Glowstone: 30
Gold_Ore: 350
Iron_Ore: 250
Lapis_Ore: 400
Mossy_Cobblestone: 30
Netherrack: 30
Obsidian: 150
Quartz_Ore: 250
Redstone_Ore: 150
Sandstone: 30
Stone: 30
Repair:
Base: 1000.0
Wood: 0.6
Stone: 1.3
Iron: 2.5
Gold: 0.3
Diamond: 5.0
Leather: 1.6
String: 1.8
Other: 1.5
Smelting:
Coal_Ore: 10
Diamond_Ore: 75
Emerald_Ore: 100
Gold_Ore: 35
Iron_Ore: 25
Lapis_Ore: 40
Quartz_Ore: 25
Redstone_Ore: 15
Taming:
Animal_Taming:
Wolf: 250
Ocelot: 500
Combat:
Multiplier:
Animals: 1.0
Creeper: 4.0
Skeleton: 3.0
Spider: 2.0
Giant: 4.0
Zombie: 2.0
Slime: 2.0
Ghast: 3.0
Pig_Zombie: 3.0
Enderman: 1.0
Cave_Spider: 3.0
Silverfish: 3.0
Blaze: 3.0
Magma_Cube: 2.0
Iron_Golem: 2.0
Wither_Skeleton: 4.0

View File

@ -1,38 +0,0 @@
Experience_Formula:
# Valid values are: LINEAR and EXPONENTIAL
# If an invalid value is entered, this will reset to the default setting, which is LINEAR
# LINEAR: base + (level * multiplier)
# EXPONENTIAL: multiplier * level ^ exponent + base
Curve: LINEAR
# If invalid values are entered mcMMO will use the default values instead and print an error in the console
Linear_Values:
base: 1020
multiplier: 20
Exponential_Values:
multiplier: 0.1
exponent: 1.80
base: 2000
# Cumulative experience curves will use a players power level instead of their skill level,
# players with high power levels will have to gain a lot more experience to reach the next level in every skill.
Cumulative_Curve: false
# Experience gained will get divided by these values. 1.0 by default, 2.0 means two times lower
Modifier:
Swords: 1.0
Taming: 1.0
Acrobatics: 1.0
Excavation: 1.0
Herbalism: 1.0
Unarmed: 1.0
Woodcutting: 1.0
Mining: 1.0
Archery: 1.0
Axes: 1.0
Repair: 1.0
Fishing: 1.0
Conversion:
# Old experience will get divided by this modifier
Exp_Modifier: 1