mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-01 03:55:28 +02:00
MASSIVE config overhaul - most keys are now based on the "proper" name
given to a material or entity by Bukkit. This WILL wipe some custom values you may have set, so please verify that your values are what you want them to be after the new config file is generated.
This commit is contained in:
@@ -12,8 +12,6 @@ import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public enum AbilityType {
|
||||
BERSERK(
|
||||
Config.getInstance().getAbilityCooldownBerserk(),
|
||||
Config.getInstance().getAbilityMaxTicksBerserk(),
|
||||
"Unarmed.Skills.Berserk.On",
|
||||
"Unarmed.Skills.Berserk.Off",
|
||||
"Unarmed.Skills.Berserk.Other.On",
|
||||
@@ -21,8 +19,6 @@ public enum AbilityType {
|
||||
"Unarmed.Skills.Berserk.Other.Off"),
|
||||
|
||||
SUPER_BREAKER(
|
||||
Config.getInstance().getAbilityCooldownSuperBreaker(),
|
||||
Config.getInstance().getAbilityMaxTicksSuperBreaker(),
|
||||
"Mining.Skills.SuperBreaker.On",
|
||||
"Mining.Skills.SuperBreaker.Off",
|
||||
"Mining.Skills.SuperBreaker.Other.On",
|
||||
@@ -30,8 +26,6 @@ public enum AbilityType {
|
||||
"Mining.Skills.SuperBreaker.Other.Off"),
|
||||
|
||||
GIGA_DRILL_BREAKER(
|
||||
Config.getInstance().getAbilityCooldownGigaDrillBreaker(),
|
||||
Config.getInstance().getAbilityMaxTicksGigaDrillBreaker(),
|
||||
"Excavation.Skills.GigaDrillBreaker.On",
|
||||
"Excavation.Skills.GigaDrillBreaker.Off",
|
||||
"Excavation.Skills.GigaDrillBreaker.Other.On",
|
||||
@@ -39,8 +33,6 @@ public enum AbilityType {
|
||||
"Excavation.Skills.GigaDrillBreaker.Other.Off"),
|
||||
|
||||
GREEN_TERRA(
|
||||
Config.getInstance().getAbilityCooldownGreenTerra(),
|
||||
Config.getInstance().getAbilityMaxTicksGreenTerra(),
|
||||
"Herbalism.Skills.GTe.On",
|
||||
"Herbalism.Skills.GTe.Off",
|
||||
"Herbalism.Skills.GTe.Other.On",
|
||||
@@ -48,8 +40,6 @@ public enum AbilityType {
|
||||
"Herbalism.Skills.GTe.Other.Off"),
|
||||
|
||||
SKULL_SPLITTER(
|
||||
Config.getInstance().getAbilityCooldownSkullSplitter(),
|
||||
Config.getInstance().getAbilityMaxTicksSkullSplitter(),
|
||||
"Axes.Skills.SS.On",
|
||||
"Axes.Skills.SS.Off",
|
||||
"Axes.Skills.SS.Other.On",
|
||||
@@ -57,8 +47,6 @@ public enum AbilityType {
|
||||
"Axes.Skills.SS.Other.Off"),
|
||||
|
||||
TREE_FELLER(
|
||||
Config.getInstance().getAbilityCooldownTreeFeller(),
|
||||
Config.getInstance().getAbilityMaxTicksTreeFeller(),
|
||||
"Woodcutting.Skills.TreeFeller.On",
|
||||
"Woodcutting.Skills.TreeFeller.Off",
|
||||
"Woodcutting.Skills.TreeFeller.Other.On",
|
||||
@@ -66,8 +54,6 @@ public enum AbilityType {
|
||||
"Woodcutting.Skills.TreeFeller.Other.Off"),
|
||||
|
||||
SERRATED_STRIKES(
|
||||
Config.getInstance().getAbilityCooldownSerratedStrikes(),
|
||||
Config.getInstance().getAbilityMaxTicksSerratedStrikes(),
|
||||
"Swords.Skills.SS.On",
|
||||
"Swords.Skills.SS.Off",
|
||||
"Swords.Skills.SS.Other.On",
|
||||
@@ -75,8 +61,6 @@ public enum AbilityType {
|
||||
"Swords.Skills.SS.Other.Off"),
|
||||
|
||||
BLAST_MINING(
|
||||
Config.getInstance().getAbilityCooldownBlastMining(),
|
||||
Config.getInstance().getAbilityMaxTicksBlastMining(),
|
||||
null,
|
||||
null,
|
||||
"Mining.Blast.Other.On",
|
||||
@@ -84,25 +68,19 @@ public enum AbilityType {
|
||||
null),
|
||||
|
||||
LEAF_BLOWER(
|
||||
0,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
|
||||
private int cooldown;
|
||||
private int maxTicks;
|
||||
private String abilityOn;
|
||||
private String abilityOff;
|
||||
private String abilityPlayer;
|
||||
private String abilityRefresh;
|
||||
private String abilityPlayerOff;
|
||||
|
||||
private AbilityType(int cooldown, int maxTicks, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||
this.cooldown = cooldown;
|
||||
this.maxTicks = maxTicks;
|
||||
private AbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||
this.abilityOn = abilityOn;
|
||||
this.abilityOff = abilityOff;
|
||||
this.abilityPlayer = abilityPlayer;
|
||||
@@ -111,7 +89,11 @@ public enum AbilityType {
|
||||
}
|
||||
|
||||
public int getCooldown() {
|
||||
return this.cooldown;
|
||||
return Config.getInstance().getCooldown(this);
|
||||
}
|
||||
|
||||
public int getMaxTicks() {
|
||||
return Config.getInstance().getMaxTicks(this);
|
||||
}
|
||||
|
||||
public String getAbilityOn() {
|
||||
@@ -134,10 +116,6 @@ public enum AbilityType {
|
||||
return LocaleLoader.getString(this.abilityRefresh);
|
||||
}
|
||||
|
||||
public int getMaxTicks() {
|
||||
return this.maxTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String baseString = name();
|
||||
|
@@ -31,17 +31,14 @@ import com.gmail.nossr50.mods.ModChecks;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.skills.acrobatics.Acrobatics;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
import com.gmail.nossr50.skills.archery.Archery;
|
||||
import com.gmail.nossr50.skills.archery.ArcheryManager;
|
||||
import com.gmail.nossr50.skills.axes.AxeManager;
|
||||
import com.gmail.nossr50.skills.axes.Axes;
|
||||
import com.gmail.nossr50.skills.runnables.BleedTimer;
|
||||
import com.gmail.nossr50.skills.runnables.CombatXpGiver;
|
||||
import com.gmail.nossr50.skills.swords.Swords;
|
||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.Taming;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.util.ItemChecks;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
@@ -79,11 +76,11 @@ public final class CombatTools {
|
||||
|
||||
if (ItemChecks.isSword(heldItem) && damageCause == DamageCause.ENTITY_ATTACK) {
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
if (!Swords.pvpEnabled) {
|
||||
if (!SkillType.SWORDS.getPVPEnabled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!Swords.pveEnabled) {
|
||||
else if (!SkillType.SWORDS.getPVEEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,11 +107,11 @@ public final class CombatTools {
|
||||
}
|
||||
else if (ItemChecks.isAxe(heldItem) && damageCause == DamageCause.ENTITY_ATTACK) {
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
if (!Axes.pvpEnabled) {
|
||||
if (!SkillType.AXES.getPVPEnabled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!Axes.pveEnabled) {
|
||||
else if (!SkillType.AXES.getPVEEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,11 +145,11 @@ public final class CombatTools {
|
||||
}
|
||||
else if (heldItemType == Material.AIR && damageCause == DamageCause.ENTITY_ATTACK) {
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
if (!configInstance.getUnarmedPVP()) {
|
||||
if (!SkillType.UNARMED.getPVPEnabled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!configInstance.getUnarmedPVE()) {
|
||||
else if (!SkillType.UNARMED.getPVEEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -202,11 +199,11 @@ public final class CombatTools {
|
||||
}
|
||||
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
if (!Taming.pvpEnabled) {
|
||||
if (!SkillType.TAMING.getPVPEnabled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!Taming.pveEnabled) {
|
||||
else if (!SkillType.TAMING.getPVEEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -242,11 +239,11 @@ public final class CombatTools {
|
||||
}
|
||||
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
if (!Archery.pvpEnabled) {
|
||||
if (!SkillType.ARCHERY.getPVPEnabled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!Archery.pveEnabled) {
|
||||
else if (!SkillType.ARCHERY.getPVEEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -267,23 +264,23 @@ public final class CombatTools {
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
if (damager instanceof Player) {
|
||||
if (Swords.pvpEnabled && ItemChecks.isSword(heldItem) && Permissions.counterAttack(player)) {
|
||||
if (SkillType.SWORDS.getPVPEnabled() && ItemChecks.isSword(heldItem) && Permissions.counterAttack(player)) {
|
||||
SwordsManager swordsManager = new SwordsManager(Users.getPlayer(player));
|
||||
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||
}
|
||||
|
||||
if (Acrobatics.pvpEnabled && Permissions.dodge(player)) {
|
||||
if (SkillType.ACROBATICS.getPVPEnabled() && Permissions.dodge(player)) {
|
||||
AcrobaticsManager acrobaticsManager = new AcrobaticsManager(Users.getPlayer(player));
|
||||
acrobaticsManager.dodgeCheck(event);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Swords.pveEnabled && damager instanceof LivingEntity && ItemChecks.isSword(heldItem) && Permissions.counterAttack(player)) {
|
||||
if (SkillType.SWORDS.getPVEEnabled() && damager instanceof LivingEntity && ItemChecks.isSword(heldItem) && Permissions.counterAttack(player)) {
|
||||
SwordsManager swordsManager = new SwordsManager(Users.getPlayer(player));
|
||||
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||
}
|
||||
|
||||
if (Acrobatics.pveEnabled && !(damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) && Permissions.dodge(player)) {
|
||||
if (SkillType.ACROBATICS.getPVEEnabled() && !(damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) && Permissions.dodge(player)) {
|
||||
AcrobaticsManager acrobaticsManager = new AcrobaticsManager(Users.getPlayer(player));
|
||||
acrobaticsManager.dodgeCheck(event);
|
||||
}
|
||||
@@ -309,7 +306,7 @@ public final class CombatTools {
|
||||
archeryManager.skillShot(event);
|
||||
|
||||
if (target instanceof Player) {
|
||||
if (Unarmed.pvpEnabled && ((Player) target).getItemInHand().getType() == Material.AIR && Permissions.arrowDeflect((Player) target)) {
|
||||
if (SkillType.UNARMED.getPVPEnabled() && ((Player) target).getItemInHand().getType() == Material.AIR && Permissions.arrowDeflect((Player) target)) {
|
||||
UnarmedManager unarmedManager = new UnarmedManager(Users.getPlayer((Player) target));
|
||||
unarmedManager.deflectCheck(event);
|
||||
}
|
||||
@@ -478,50 +475,26 @@ public final class CombatTools {
|
||||
break;
|
||||
|
||||
case BLAZE:
|
||||
baseXP = configInstance.getBlazeXP();
|
||||
break;
|
||||
|
||||
case CAVE_SPIDER:
|
||||
baseXP = configInstance.getCaveSpiderXP();
|
||||
break;
|
||||
|
||||
case CREEPER:
|
||||
baseXP = configInstance.getCreeperXP();
|
||||
break;
|
||||
|
||||
case ENDER_DRAGON:
|
||||
baseXP = configInstance.getEnderDragonXP();
|
||||
break;
|
||||
|
||||
case ENDERMAN:
|
||||
baseXP = configInstance.getEndermanXP();
|
||||
break;
|
||||
|
||||
case GHAST:
|
||||
baseXP = configInstance.getGhastXP();
|
||||
break;
|
||||
|
||||
case GIANT:
|
||||
baseXP = configInstance.getGiantXP();
|
||||
break;
|
||||
|
||||
case MAGMA_CUBE:
|
||||
baseXP = configInstance.getMagmaCubeXP();
|
||||
break;
|
||||
|
||||
case IRON_GOLEM:
|
||||
if (!((IronGolem) target).isPlayerCreated()) {
|
||||
baseXP = configInstance.getIronGolemXP();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PIG_ZOMBIE:
|
||||
baseXP = configInstance.getPigZombieXP();
|
||||
case SILVERFISH:
|
||||
case SLIME:
|
||||
case SPIDER:
|
||||
case WITCH:
|
||||
case WITHER:
|
||||
case ZOMBIE:
|
||||
baseXP = Config.getInstance().getCombatXP(type);
|
||||
break;
|
||||
|
||||
case SILVERFISH:
|
||||
baseXP = configInstance.getSilverfishXP();
|
||||
// Temporary workaround for custom entities
|
||||
case UNKNOWN:
|
||||
baseXP = 1.0;
|
||||
break;
|
||||
|
||||
case SKELETON:
|
||||
@@ -530,41 +503,21 @@ public final class CombatTools {
|
||||
baseXP = configInstance.getWitherSkeletonXP();
|
||||
break;
|
||||
default:
|
||||
baseXP = configInstance.getSkeletonXP();
|
||||
baseXP = Config.getInstance().getCombatXP(type);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIME:
|
||||
baseXP = configInstance.getSlimeXP();
|
||||
break;
|
||||
|
||||
case SPIDER:
|
||||
baseXP = configInstance.getSpiderXP();
|
||||
break;
|
||||
|
||||
case WITCH:
|
||||
baseXP = configInstance.getWitchXP();
|
||||
break;
|
||||
|
||||
case WITHER:
|
||||
baseXP = configInstance.getWitherXP();
|
||||
break;
|
||||
|
||||
case ZOMBIE:
|
||||
baseXP = configInstance.getZombieXP();
|
||||
break;
|
||||
|
||||
// Temporary workaround for custom entities
|
||||
case UNKNOWN:
|
||||
baseXP = 1.0;
|
||||
case IRON_GOLEM:
|
||||
if (!((IronGolem) target).isPlayerCreated()) {
|
||||
baseXP = Config.getInstance().getCombatXP(type);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ModChecks.isCustomEntity(target)) {
|
||||
baseXP = ModChecks.getCustomEntity(target).getXpMultiplier();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -6,41 +6,31 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public enum SkillType {
|
||||
ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()),
|
||||
ARCHERY(Config.getInstance().getLevelCapArchery(), Config.getInstance().getFormulaMultiplierArchery()),
|
||||
AXES(AbilityType.SKULL_SPLITTER, Config.getInstance().getLevelCapAxes(), ToolType.AXE, Config.getInstance().getFormulaMultiplierAxes()),
|
||||
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, Config.getInstance().getLevelCapExcavation(), ToolType.SHOVEL, Config.getInstance().getFormulaMultiplierExcavation()),
|
||||
FISHING(Config.getInstance().getLevelCapFishing(), Config.getInstance().getFormulaMultiplierFishing()),
|
||||
HERBALISM(AbilityType.GREEN_TERRA, Config.getInstance().getLevelCapHerbalism(), ToolType.HOE, Config.getInstance().getFormulaMultiplierHerbalism()),
|
||||
MINING(AbilityType.SUPER_BREAKER, Config.getInstance().getLevelCapMining(), ToolType.PICKAXE, Config.getInstance().getFormulaMultiplierMining()),
|
||||
REPAIR(Config.getInstance().getLevelCapRepair(), Config.getInstance().getFormulaMultiplierRepair()),
|
||||
SMELTING(Config.getInstance().getLevelCapSmelting(), 0),
|
||||
SWORDS(AbilityType.SERRATED_STRIKES, Config.getInstance().getLevelCapSwords(), ToolType.SWORD, Config.getInstance().getFormulaMultiplierSwords()),
|
||||
TAMING(Config.getInstance().getLevelCapTaming(), Config.getInstance().getFormulaMultiplierTaming()),
|
||||
UNARMED(AbilityType.BERSERK, Config.getInstance().getLevelCapUnarmed(), ToolType.FISTS, Config.getInstance().getFormulaMultiplierUnarmed()),
|
||||
WOODCUTTING(AbilityType.TREE_FELLER, Config.getInstance().getLevelCapWoodcutting(), ToolType.AXE, Config.getInstance().getFormulaMultiplierWoodcutting());
|
||||
ACROBATICS,
|
||||
ARCHERY,
|
||||
AXES(AbilityType.SKULL_SPLITTER, ToolType.AXE),
|
||||
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL),
|
||||
FISHING,
|
||||
HERBALISM(AbilityType.GREEN_TERRA, ToolType.HOE),
|
||||
MINING(AbilityType.SUPER_BREAKER, ToolType.PICKAXE),
|
||||
REPAIR,
|
||||
SMELTING,
|
||||
SWORDS(AbilityType.SERRATED_STRIKES, ToolType.SWORD),
|
||||
TAMING,
|
||||
UNARMED(AbilityType.BERSERK, ToolType.FISTS),
|
||||
WOODCUTTING(AbilityType.TREE_FELLER, ToolType.AXE);
|
||||
|
||||
private AbilityType ability;
|
||||
private int maxLevel;
|
||||
private ToolType tool;
|
||||
private double xpModifier;
|
||||
|
||||
private SkillType() {
|
||||
this.ability = null;
|
||||
this.maxLevel = 0;
|
||||
this.tool = null;
|
||||
this.xpModifier = 0;
|
||||
}
|
||||
|
||||
private SkillType(AbilityType ability, int maxLevel, ToolType tool, double xpModifier) {
|
||||
private SkillType(AbilityType ability, ToolType tool) {
|
||||
this.ability = ability;
|
||||
this.maxLevel = maxLevel;
|
||||
this.tool = tool;
|
||||
this.xpModifier = xpModifier;
|
||||
}
|
||||
|
||||
private SkillType(int maxLevel, double xpModifier) {
|
||||
this(null, maxLevel, null, xpModifier);
|
||||
}
|
||||
|
||||
public AbilityType getAbility() {
|
||||
@@ -53,11 +43,19 @@ public enum SkillType {
|
||||
* @return the max level of this skill
|
||||
*/
|
||||
public int getMaxLevel() {
|
||||
if (maxLevel > 0) {
|
||||
return maxLevel;
|
||||
}
|
||||
return Config.getInstance().getLevelCap(this);
|
||||
}
|
||||
|
||||
return Integer.MAX_VALUE;
|
||||
public boolean getPVPEnabled() {
|
||||
return Config.getInstance().getPVPEnabled(this);
|
||||
}
|
||||
|
||||
public boolean getPVEEnabled() {
|
||||
return Config.getInstance().getPVEEnabled(this);
|
||||
}
|
||||
|
||||
public boolean getDoubleDropsDisabled() {
|
||||
return Config.getInstance().getDoubleDropsDisabled(this);
|
||||
}
|
||||
|
||||
public ToolType getTool() {
|
||||
@@ -65,7 +63,7 @@ public enum SkillType {
|
||||
}
|
||||
|
||||
public double getXpModifier() {
|
||||
return xpModifier;
|
||||
return Config.getInstance().getForumulaMultiplier(this);
|
||||
}
|
||||
|
||||
public static SkillType getSkill(String skillName) {
|
||||
|
Reference in New Issue
Block a user