mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Refactor McMMOAbilityEvent(s) and fix TextComponentFactory
This commit is contained in:
parent
815131a013
commit
14fa243b69
@ -154,42 +154,42 @@ public final class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initSerializedDataFiles() {
|
private void initSerializedDataFiles() {
|
||||||
partyData = new SerializedConfigLoader<>(ConfigPartyData.class, "partydata.conf", "PartyData", null);
|
partyData = new SerializedConfigLoader<>(pluginRef, ConfigPartyData.class, "partydata.conf", "PartyData", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initSerializedConfigs() {
|
private void initSerializedConfigs() {
|
||||||
//There's some race conditions here because mcMMO is goddamn spaghetti mess, language has to load first
|
//There's some race conditions here because mcMMO is goddamn spaghetti mess, language has to load first
|
||||||
configLanguage = new SerializedConfigLoader<>(ConfigLanguage.class, "language.conf", "Language", null);
|
configLanguage = new SerializedConfigLoader<>(pluginRef, ConfigLanguage.class, "language.conf", "Language", null);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No more race conditions
|
* No more race conditions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
configDatabase = new SerializedConfigLoader<>(ConfigDatabase.class, "database_settings.conf", "Database", null);
|
configDatabase = new SerializedConfigLoader<>(pluginRef, ConfigDatabase.class, "database_settings.conf", "Database", null);
|
||||||
configScoreboard = new SerializedConfigLoader<>(ConfigScoreboard.class, "scoreboard.conf", "Scoreboard", null);
|
configScoreboard = new SerializedConfigLoader<>(pluginRef, ConfigScoreboard.class, "scoreboard.conf", "Scoreboard", null);
|
||||||
configLeveling = new SerializedConfigLoader<>(ConfigLeveling.class, "player_leveling.conf", "Player-Leveling", null);
|
configLeveling = new SerializedConfigLoader<>(pluginRef, ConfigLeveling.class, "player_leveling.conf", "Player-Leveling", null);
|
||||||
configWorldBlacklist = new SerializedConfigLoader<>(ConfigWorldBlacklist.class, "world_blacklist.conf", "World-Blacklist", null);
|
configWorldBlacklist = new SerializedConfigLoader<>(pluginRef, ConfigWorldBlacklist.class, "world_blacklist.conf", "World-Blacklist", null);
|
||||||
configExploitPrevention = new SerializedConfigLoader<>(ConfigExploitPrevention.class, "anti_exploit.conf", "Anti-Exploit", null);
|
configExploitPrevention = new SerializedConfigLoader<>(pluginRef, ConfigExploitPrevention.class, "anti_exploit.conf", "Anti-Exploit", null);
|
||||||
configMOTD = new SerializedConfigLoader<>(ConfigMOTD.class, "message_of_the_day.conf", "MOTD", null);
|
configMOTD = new SerializedConfigLoader<>(pluginRef, ConfigMOTD.class, "message_of_the_day.conf", "MOTD", null);
|
||||||
configHardcore = new SerializedConfigLoader<>(ConfigHardcore.class, "hardcore_mode.conf", "Hardcore-Mode", null);
|
configHardcore = new SerializedConfigLoader<>(pluginRef, ConfigHardcore.class, "hardcore_mode.conf", "Hardcore-Mode", null);
|
||||||
configMetrics = new SerializedConfigLoader<>(ConfigMetrics.class, "analytics_reporting.conf", "Analytic-Reporting", null);
|
configMetrics = new SerializedConfigLoader<>(pluginRef, ConfigMetrics.class, "analytics_reporting.conf", "Analytic-Reporting", null);
|
||||||
configAuthorAdvertisements = new SerializedConfigLoader<>(ConfigAuthorAdvertisements.class, "author_support_advertisements.conf", "mcMMO", null);
|
configAuthorAdvertisements = new SerializedConfigLoader<>(pluginRef, ConfigAuthorAdvertisements.class, "author_support_advertisements.conf", "mcMMO", null);
|
||||||
configAutomatedBackups = new SerializedConfigLoader<>(ConfigAutomatedBackups.class, "automated_backups.conf", "Automated-Backups", null);
|
configAutomatedBackups = new SerializedConfigLoader<>(pluginRef, ConfigAutomatedBackups.class, "automated_backups.conf", "Automated-Backups", null);
|
||||||
configCommands = new SerializedConfigLoader<>(ConfigCommands.class, "commands.conf", "Commands", null);
|
configCommands = new SerializedConfigLoader<>(pluginRef, ConfigCommands.class, "commands.conf", "Commands", null);
|
||||||
configItems = new SerializedConfigLoader<>(ConfigItems.class, "custom_items.conf", "Items", null);
|
configItems = new SerializedConfigLoader<>(pluginRef, ConfigItems.class, "custom_items.conf", "Items", null);
|
||||||
configParticles = new SerializedConfigLoader<>(ConfigParticles.class, "particle_spawning.conf", "Particles", null);
|
configParticles = new SerializedConfigLoader<>(pluginRef, ConfigParticles.class, "particle_spawning.conf", "Particles", null);
|
||||||
configParty = new SerializedConfigLoader<>(ConfigParty.class, "party.conf", "Party", null);
|
configParty = new SerializedConfigLoader<>(pluginRef, ConfigParty.class, "party.conf", "Party", null);
|
||||||
configNotifications = new SerializedConfigLoader<>(ConfigNotifications.class, "alerts_and_notifications.conf", "Notifications", null);
|
configNotifications = new SerializedConfigLoader<>(pluginRef, ConfigNotifications.class, "alerts_and_notifications.conf", "Notifications", null);
|
||||||
configSuperAbilities = new SerializedConfigLoader<>(ConfigSuperAbilities.class, "skill_super_abilities.conf", "Super-Abilities", null);
|
configSuperAbilities = new SerializedConfigLoader<>(pluginRef, ConfigSuperAbilities.class, "skill_super_abilities.conf", "Super-Abilities", null);
|
||||||
configAdmin = new SerializedConfigLoader<>(ConfigAdmin.class, "admin.conf", "Admin", null);
|
configAdmin = new SerializedConfigLoader<>(pluginRef, ConfigAdmin.class, "admin.conf", "Admin", null);
|
||||||
configMobs = new SerializedConfigLoader<>(ConfigMobs.class, "creatures.conf", "Creatures", null);
|
configMobs = new SerializedConfigLoader<>(pluginRef, ConfigMobs.class, "creatures.conf", "Creatures", null);
|
||||||
configExperience = new SerializedConfigLoader<>(ConfigExperience.class, "experience.conf", "Experience", null);
|
configExperience = new SerializedConfigLoader<>(pluginRef, ConfigExperience.class, "experience.conf", "Experience", null);
|
||||||
configCoreSkills = new SerializedConfigLoader<>(ConfigCoreSkills.class, "core_skills.conf", "Core-Skills", null);
|
configCoreSkills = new SerializedConfigLoader<>(pluginRef, ConfigCoreSkills.class, "core_skills.conf", "Core-Skills", null);
|
||||||
configEvent = new SerializedConfigLoader<>(ConfigEvent.class, "events.conf", "Events", null);
|
configEvent = new SerializedConfigLoader<>(pluginRef, ConfigEvent.class, "events.conf", "Events", null);
|
||||||
configRanks = new SerializedConfigLoader<>(ConfigRanks.class, "ranks.conf", "Skill-Ranks", null);
|
configRanks = new SerializedConfigLoader<>(pluginRef, ConfigRanks.class, "ranks.conf", "Skill-Ranks", null);
|
||||||
configSound = new SerializedConfigLoader<>(ConfigSound.class, "sounds.conf", "Sounds", null);
|
configSound = new SerializedConfigLoader<>(pluginRef, ConfigSound.class, "sounds.conf", "Sounds", null);
|
||||||
|
|
||||||
configDefaultExamples = new SerializedConfigLoader<>(ConfigNameRegisterDefaults.class, "minecraft_item_block_name_examples.conf", "Minecraft", null);
|
configDefaultExamples = new SerializedConfigLoader<>(pluginRef, ConfigNameRegisterDefaults.class, "minecraft_item_block_name_examples.conf", "Minecraft", null);
|
||||||
initSerializedSkillConfigs();
|
initSerializedSkillConfigs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,340 +1,340 @@
|
|||||||
package com.gmail.nossr50.config.experience;
|
//package com.gmail.nossr50.config.experience;
|
||||||
|
//
|
||||||
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
//import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
//import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
//import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
//import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
//import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
//import com.gmail.nossr50.util.StringUtils;
|
||||||
import org.bukkit.Material;
|
//import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
//import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.boss.BarColor;
|
//import org.bukkit.boss.BarColor;
|
||||||
import org.bukkit.boss.BarStyle;
|
//import org.bukkit.boss.BarStyle;
|
||||||
import org.bukkit.entity.EntityType;
|
//import org.bukkit.entity.EntityType;
|
||||||
|
//
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
public class ExperienceConfig extends AutoUpdateConfigLoader {
|
//public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||||
private static ExperienceConfig instance;
|
// private static ExperienceConfig instance;
|
||||||
|
//
|
||||||
private ExperienceConfig() {
|
// private ExperienceConfig() {
|
||||||
super("experience.yml");
|
// super("experience.yml");
|
||||||
validate();
|
// validate();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public static ExperienceConfig getInstance() {
|
// public static ExperienceConfig getInstance() {
|
||||||
if (instance == null) {
|
// if (instance == null) {
|
||||||
instance = new ExperienceConfig();
|
// instance = new ExperienceConfig();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return instance;
|
// return instance;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
protected void loadKeys() {}
|
// protected void loadKeys() {}
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
protected boolean validateKeys() {
|
// protected boolean validateKeys() {
|
||||||
List<String> reason = new ArrayList<String>();
|
// List<String> reason = new ArrayList<String>();
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* FORMULA SETTINGS
|
// * FORMULA SETTINGS
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
/* Curve values */
|
// /* Curve values */
|
||||||
if (getMultiplier(FormulaType.EXPONENTIAL) <= 0) {
|
// if (getMultiplier(FormulaType.EXPONENTIAL) <= 0) {
|
||||||
reason.add("Experience_Formula.Exponential_Values.multiplier should be greater than 0!");
|
// reason.add("Experience_Formula.Exponential_Values.multiplier should be greater than 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (getMultiplier(FormulaType.LINEAR) <= 0) {
|
// if (getMultiplier(FormulaType.LINEAR) <= 0) {
|
||||||
reason.add("Experience_Formula.Linear_Values.multiplier should be greater than 0!");
|
// reason.add("Experience_Formula.Linear_Values.multiplier should be greater than 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (getExponent(FormulaType.EXPONENTIAL) <= 0) {
|
// if (getExponent(FormulaType.EXPONENTIAL) <= 0) {
|
||||||
reason.add("Experience_Formula.Exponential_Values.exponent should be greater than 0!");
|
// reason.add("Experience_Formula.Exponential_Values.exponent should be greater than 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Global modifier */
|
// /* Global modifier */
|
||||||
if (getExperienceGainsGlobalMultiplier() <= 0) {
|
// if (getExperienceGainsGlobalMultiplier() <= 0) {
|
||||||
reason.add("Experience_Formula.Multiplier.Global should be greater than 0!");
|
// reason.add("Experience_Formula.Multiplier.Global should be greater than 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* PVP modifier */
|
// /* PVP modifier */
|
||||||
if (getPlayerVersusPlayerXP() < 0) {
|
// if (getPlayerVersusPlayerXP() < 0) {
|
||||||
reason.add("Experience_Formula.Multiplier.PVP should be at least 0!");
|
// reason.add("Experience_Formula.Multiplier.PVP should be at least 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Spawned Mob modifier */
|
// /* Spawned Mob modifier */
|
||||||
if (getSpawnedMobXpMultiplier() < 0) {
|
// if (getSpawnedMobXpMultiplier() < 0) {
|
||||||
reason.add("Experience_Formula.Mobspawners.Multiplier should be at least 0!");
|
// reason.add("Experience_Formula.Mobspawners.Multiplier should be at least 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Bred Mob modifier */
|
// /* Bred Mob modifier */
|
||||||
if (getBredMobXpMultiplier() < 0) {
|
// if (getBredMobXpMultiplier() < 0) {
|
||||||
reason.add("Experience_Formula.Breeding.Multiplier should be at least 0!");
|
// reason.add("Experience_Formula.Breeding.Multiplier should be at least 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Conversion */
|
// /* Conversion */
|
||||||
if (getExpModifier() <= 0) {
|
// if (getExpModifier() <= 0) {
|
||||||
reason.add("Conversion.Exp_Modifier should be greater than 0!");
|
// reason.add("Conversion.Exp_Modifier should be greater than 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* XP SETTINGS
|
// * XP SETTINGS
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
/* Alchemy */
|
// /* Alchemy */
|
||||||
for (PotionStage potionStage : PotionStage.values()) {
|
// for (PotionStage potionStage : PotionStage.values()) {
|
||||||
if (getPotionXP(potionStage) < 0) {
|
// if (getPotionXP(potionStage) < 0) {
|
||||||
reason.add("Experience_Values.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!");
|
// reason.add("Experience_Values.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Archery */
|
// /* Archery */
|
||||||
if (getArcheryDistanceMultiplier() < 0) {
|
// if (getArcheryDistanceMultiplier() < 0) {
|
||||||
reason.add("Experience_Values.Archery.Distance_Multiplier should be at least 0!");
|
// reason.add("Experience_Values.Archery.Distance_Multiplier should be at least 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Combat XP Multipliers */
|
// /* Combat XP Multipliers */
|
||||||
if (getAnimalsXP() < 0) {
|
// if (getAnimalsXP() < 0) {
|
||||||
reason.add("Experience_Values.Combat.Multiplier.Animals should be at least 0!");
|
// reason.add("Experience_Values.Combat.Multiplier.Animals should be at least 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (getDodgeXPModifier() < 0) {
|
// if (getDodgeXPModifier() < 0) {
|
||||||
reason.add("Skills.Acrobatics.Dodge_XP_Modifier should be at least 0!");
|
// reason.add("Skills.Acrobatics.Dodge_XP_Modifier should be at least 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (getRollXPModifier() < 0) {
|
// if (getRollXPModifier() < 0) {
|
||||||
reason.add("Skills.Acrobatics.Roll_XP_Modifier should be at least 0!");
|
// reason.add("Skills.Acrobatics.Roll_XP_Modifier should be at least 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (getFallXPModifier() < 0) {
|
// if (getFallXPModifier() < 0) {
|
||||||
reason.add("Skills.Acrobatics.Fall_XP_Modifier should be at least 0!");
|
// reason.add("Skills.Acrobatics.Fall_XP_Modifier should be at least 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Fishing */
|
// /* Fishing */
|
||||||
// TODO: Add validation for each fish type once enum is available.
|
// // TODO: Add validation for each fish type once enum is available.
|
||||||
|
//
|
||||||
if (getFishingShakeXP() <= 0) {
|
// if (getFishingShakeXP() <= 0) {
|
||||||
reason.add("Experience_Values.Fishing.Shake should be greater than 0!");
|
// reason.add("Experience_Values.Fishing.Shake should be greater than 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Repair */
|
// /* Repair */
|
||||||
if (getRepairXPBase() <= 0) {
|
// if (getRepairXPBase() <= 0) {
|
||||||
reason.add("Experience_Values.Repair.Base should be greater than 0!");
|
// reason.add("Experience_Values.Repair.Base should be greater than 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Taming */
|
// /* Taming */
|
||||||
if (getTamingXP(EntityType.WOLF) <= 0) {
|
// if (getTamingXP(EntityType.WOLF) <= 0) {
|
||||||
reason.add("Experience_Values.Taming.Animal_Taming.Wolf should be greater than 0!");
|
// reason.add("Experience_Values.Taming.Animal_Taming.Wolf should be greater than 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (getTamingXP(EntityType.OCELOT) <= 0) {
|
// if (getTamingXP(EntityType.OCELOT) <= 0) {
|
||||||
reason.add("Experience_Values.Taming.Animal_Taming.Ocelot should be greater than 0!");
|
// reason.add("Experience_Values.Taming.Animal_Taming.Ocelot should be greater than 0!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return noErrorsInConfig(reason);
|
// return noErrorsInConfig(reason);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isEarlyGameBoostEnabled() { return config.getBoolean("EarlyGameBoost.Enabled", true); }
|
// public boolean isEarlyGameBoostEnabled() { return config.getBoolean("EarlyGameBoost.Enabled", true); }
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* FORMULA SETTINGS
|
// * FORMULA SETTINGS
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
/* EXPLOIT TOGGLES */
|
// /* EXPLOIT TOGGLES */
|
||||||
public boolean isEndermanEndermiteFarmingPrevented() { return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true); }
|
// public boolean isEndermanEndermiteFarmingPrevented() { return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true); }
|
||||||
public boolean isPistonCheatingPrevented() { return config.getBoolean("ExploitFix.PistonCheating", true); }
|
// public boolean isPistonCheatingPrevented() { return config.getBoolean("ExploitFix.PistonCheating", true); }
|
||||||
public boolean isPistonExploitPrevented() { return config.getBoolean("ExploitFix.Pistons", false); }
|
// public boolean isPistonExploitPrevented() { return config.getBoolean("ExploitFix.Pistons", false); }
|
||||||
public boolean allowUnsafeEnchantments() { return config.getBoolean("ExploitFix.UnsafeEnchantments", false); }
|
// public boolean allowUnsafeEnchantments() { return config.getBoolean("ExploitFix.UnsafeEnchantments", false); }
|
||||||
public boolean isCOTWBreedingPrevented() { return config.getBoolean("ExploitFix.COTWBreeding", true); }
|
// public boolean isCOTWBreedingPrevented() { return config.getBoolean("ExploitFix.COTWBreeding", true); }
|
||||||
|
//
|
||||||
public boolean isFishingExploitingPrevented() { return config.getBoolean("ExploitFix.Fishing", true); }
|
// public boolean isFishingExploitingPrevented() { return config.getBoolean("ExploitFix.Fishing", true); }
|
||||||
public boolean isAcrobaticsExploitingPrevented() { return config.getBoolean("ExploitFix.Acrobatics", true); }
|
// public boolean isAcrobaticsExploitingPrevented() { return config.getBoolean("ExploitFix.Acrobatics", true); }
|
||||||
public boolean isTreeFellerXPReduced() { return config.getBoolean("ExploitFix.TreeFellerReducedXP", true); }
|
// public boolean isTreeFellerXPReduced() { return config.getBoolean("ExploitFix.TreeFellerReducedXP", true); }
|
||||||
|
//
|
||||||
/* Curve settings */
|
// /* Curve settings */
|
||||||
public FormulaType getFormulaType() { return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve")); }
|
// public FormulaType getFormulaType() { return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve")); }
|
||||||
public boolean getCumulativeCurveEnabled() { return config.getBoolean("Experience_Formula.Cumulative_Curve", false); }
|
// public boolean getCumulativeCurveEnabled() { return config.getBoolean("Experience_Formula.Cumulative_Curve", false); }
|
||||||
|
//
|
||||||
/* Curve values */
|
// /* Curve values */
|
||||||
public double getMultiplier(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier"); }
|
// public double getMultiplier(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier"); }
|
||||||
public int getBase(FormulaType type) { return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base"); }
|
// 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"); }
|
// public double getExponent(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent"); }
|
||||||
|
//
|
||||||
/* Global modifier */
|
// /* Global modifier */
|
||||||
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience_Formula.Multiplier.Global", 1.0); }
|
// public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience_Formula.Multiplier.Global", 1.0); }
|
||||||
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience_Formula.Multiplier.Global", value); }
|
// public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience_Formula.Multiplier.Global", value); }
|
||||||
|
//
|
||||||
/* PVP modifier */
|
// /* PVP modifier */
|
||||||
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0); }
|
// public double getPlayerVersusPlayerXP() { return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0); }
|
||||||
|
//
|
||||||
/* Spawned Mob modifier */
|
// /* Spawned Mob modifier */
|
||||||
public double getSpawnedMobXpMultiplier() { return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0); }
|
// public double getSpawnedMobXpMultiplier() { return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0); }
|
||||||
public double getBredMobXpMultiplier() { return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0); }
|
// public double getBredMobXpMultiplier() { return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0); }
|
||||||
|
//
|
||||||
/* Skill modifiers */
|
// /* Skill modifiers */
|
||||||
public double getFormulaSkillModifier(PrimarySkillType skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); }
|
// public double getFormulaSkillModifier(PrimarySkillType skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); }
|
||||||
|
//
|
||||||
/* Custom XP perk */
|
// /* Custom XP perk */
|
||||||
public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
// public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
||||||
|
//
|
||||||
/* Diminished Returns */
|
// /* Diminished Returns */
|
||||||
public float getDiminishedReturnsCap() { return (float) config.getDouble("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D); }
|
// public float getDiminishedReturnsCap() { return (float) config.getDouble("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D); }
|
||||||
public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); }
|
// public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); }
|
||||||
public int getDiminishedReturnsThreshold(PrimarySkillType skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); }
|
// public int getDiminishedReturnsThreshold(PrimarySkillType skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); }
|
||||||
public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); }
|
// public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); }
|
||||||
|
//
|
||||||
/* Conversion */
|
// /* Conversion */
|
||||||
public double getExpModifier() { return config.getDouble("Conversion.Exp_Modifier", 1); }
|
// public double getExpModifier() { return config.getDouble("Conversion.Exp_Modifier", 1); }
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* XP SETTINGS
|
// * XP SETTINGS
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
/* General Settings */
|
// /* General Settings */
|
||||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience_Values.PVP.Rewards", true); }
|
// public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience_Values.PVP.Rewards", true); }
|
||||||
|
//
|
||||||
/* Combat XP Multipliers */
|
// /* Combat XP Multipliers */
|
||||||
public double getCombatXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
// public double getCombatXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||||
public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); }
|
// public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); }
|
||||||
public double getAnimalsXP() { return config.getDouble("Experience_Values.Combat.Multiplier.Animals", 1.0); }
|
// public double getAnimalsXP() { return config.getDouble("Experience_Values.Combat.Multiplier.Animals", 1.0); }
|
||||||
public boolean hasCombatXP(EntityType entity) {return config.contains("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
// public boolean hasCombatXP(EntityType entity) {return config.contains("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||||
|
//
|
||||||
/* Materials */
|
// /* Materials */
|
||||||
public int getXp(PrimarySkillType skill, Material data)
|
// public int getXp(PrimarySkillType skill, Material data)
|
||||||
{
|
// {
|
||||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
// String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
// String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||||
if (config.contains(explicitString))
|
// if (config.contains(explicitString))
|
||||||
return config.getInt(explicitString);
|
// return config.getInt(explicitString);
|
||||||
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
// String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
||||||
if (config.contains(friendlyString))
|
// if (config.contains(friendlyString))
|
||||||
return config.getInt(friendlyString);
|
// return config.getInt(friendlyString);
|
||||||
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
// String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
||||||
if (config.contains(wildcardString))
|
// if (config.contains(wildcardString))
|
||||||
return config.getInt(wildcardString);
|
// return config.getInt(wildcardString);
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Materials */
|
// /* Materials */
|
||||||
public int getXp(PrimarySkillType skill, BlockData data)
|
// public int getXp(PrimarySkillType skill, BlockData data)
|
||||||
{
|
// {
|
||||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
// String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
// String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||||
if (config.contains(explicitString))
|
// if (config.contains(explicitString))
|
||||||
return config.getInt(explicitString);
|
// return config.getInt(explicitString);
|
||||||
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
// String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
||||||
if (config.contains(friendlyString))
|
// if (config.contains(friendlyString))
|
||||||
return config.getInt(friendlyString);
|
// return config.getInt(friendlyString);
|
||||||
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
// String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
||||||
if (config.contains(wildcardString))
|
// if (config.contains(wildcardString))
|
||||||
return config.getInt(wildcardString);
|
// return config.getInt(wildcardString);
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data)
|
// public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data)
|
||||||
{
|
// {
|
||||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
// String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
// String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||||
if (config.contains(explicitString))
|
// if (config.contains(explicitString))
|
||||||
return true;
|
// return true;
|
||||||
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
// String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
||||||
if (config.contains(friendlyString))
|
// if (config.contains(friendlyString))
|
||||||
return true;
|
// return true;
|
||||||
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
// String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
||||||
return config.contains(wildcardString);
|
// return config.contains(wildcardString);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data)
|
// public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data)
|
||||||
{
|
// {
|
||||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
// String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
// String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||||
if (config.contains(explicitString))
|
// if (config.contains(explicitString))
|
||||||
return true;
|
// return true;
|
||||||
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
// String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
||||||
if (config.contains(friendlyString))
|
// if (config.contains(friendlyString))
|
||||||
return true;
|
// return true;
|
||||||
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
// String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
||||||
return config.contains(wildcardString);
|
// return config.contains(wildcardString);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* Experience Bar Stuff
|
// * Experience Bar Stuff
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
public boolean isPartyExperienceBarsEnabled()
|
// public boolean isPartyExperienceBarsEnabled()
|
||||||
{
|
// {
|
||||||
return config.getBoolean("Experience_Bars.Update.Party", true);
|
// return config.getBoolean("Experience_Bars.Update.Party", true);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isPassiveGainsExperienceBarsEnabled()
|
// public boolean isPassiveGainsExperienceBarsEnabled()
|
||||||
{
|
// {
|
||||||
return config.getBoolean("Experience_Bars.Update.Passive", true);
|
// return config.getBoolean("Experience_Bars.Update.Passive", true);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean getDoExperienceBarsAlwaysUpdateTitle()
|
// public boolean getDoExperienceBarsAlwaysUpdateTitle()
|
||||||
{
|
// {
|
||||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.Enable", false) || getAddExtraDetails();
|
// return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.Enable", false) || getAddExtraDetails();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean getAddExtraDetails() { return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);}
|
// public boolean getAddExtraDetails() { return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);}
|
||||||
public boolean isExperienceBarsEnabled() { return config.getBoolean("Experience_Bars.Enable", true); }
|
// public boolean isExperienceBarsEnabled() { return config.getBoolean("Experience_Bars.Enable", true); }
|
||||||
public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Enable", true);}
|
// public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Enable", true);}
|
||||||
|
//
|
||||||
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType)
|
// public BarColor getExperienceBarColor(PrimarySkillType primarySkillType)
|
||||||
{
|
// {
|
||||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Color");
|
// String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Color");
|
||||||
|
//
|
||||||
for(BarColor barColor : BarColor.values())
|
// for(BarColor barColor : BarColor.values())
|
||||||
{
|
// {
|
||||||
if(barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
// if(barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||||
return barColor;
|
// return barColor;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//In case the value is invalid
|
// //In case the value is invalid
|
||||||
return BarColor.WHITE;
|
// return BarColor.WHITE;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType)
|
// public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType)
|
||||||
{
|
// {
|
||||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".BarStyle");
|
// String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".BarStyle");
|
||||||
|
//
|
||||||
for(BarStyle barStyle : BarStyle.values())
|
// for(BarStyle barStyle : BarStyle.values())
|
||||||
{
|
// {
|
||||||
if(barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
// if(barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||||
return barStyle;
|
// return barStyle;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//In case the value is invalid
|
// //In case the value is invalid
|
||||||
return BarStyle.SOLID;
|
// return BarStyle.SOLID;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/* Acrobatics */
|
// /* Acrobatics */
|
||||||
public int getDodgeXPModifier() { return config.getInt("Experience_Values.Acrobatics.Dodge", 120); }
|
// public int getDodgeXPModifier() { return config.getInt("Experience_Values.Acrobatics.Dodge", 120); }
|
||||||
public int getRollXPModifier() { return config.getInt("Experience_Values.Acrobatics.Roll", 80); }
|
// public int getRollXPModifier() { return config.getInt("Experience_Values.Acrobatics.Roll", 80); }
|
||||||
public int getFallXPModifier() { return config.getInt("Experience_Values.Acrobatics.Fall", 120); }
|
// public int getFallXPModifier() { return config.getInt("Experience_Values.Acrobatics.Fall", 120); }
|
||||||
|
//
|
||||||
public double getFeatherFallXPModifier() { return config.getDouble("Experience_Values.Acrobatics.FeatherFall_Multiplier", 2.0); }
|
// public double getFeatherFallXPModifier() { return config.getDouble("Experience_Values.Acrobatics.FeatherFall_Multiplier", 2.0); }
|
||||||
|
//
|
||||||
/* Alchemy */
|
// /* Alchemy */
|
||||||
public double getPotionXP(PotionStage stage) { return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
|
// public double getPotionXP(PotionStage stage) { return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
|
||||||
|
//
|
||||||
/* Archery */
|
// /* Archery */
|
||||||
public double getArcheryDistanceMultiplier() { return config.getDouble("Experience_Values.Archery.Distance_Multiplier", 0.025); }
|
// public double getArcheryDistanceMultiplier() { return config.getDouble("Experience_Values.Archery.Distance_Multiplier", 0.025); }
|
||||||
|
//
|
||||||
public int getFishingShakeXP() { return config.getInt("Experience_Values.Fishing.Shake", 50); }
|
// public int getFishingShakeXP() { return config.getInt("Experience_Values.Fishing.Shake", 50); }
|
||||||
|
//
|
||||||
/* Repair */
|
// /* Repair */
|
||||||
public double getRepairXPBase() { return config.getDouble("Experience_Values.Repair.Base", 1000.0); }
|
// public double getRepairXPBase() { return config.getDouble("Experience_Values.Repair.Base", 1000.0); }
|
||||||
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience_Values.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
// public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience_Values.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
||||||
|
//
|
||||||
/* Taming */
|
// /* Taming */
|
||||||
public int getTamingXP(EntityType type)
|
// public int getTamingXP(EntityType type)
|
||||||
{
|
// {
|
||||||
return config.getInt("Experience_Values.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
|
// return config.getInt("Experience_Values.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean preventStoneLavaFarming() { return config.getBoolean("ExploitFix.LavaStoneAndCobbleFarming", true);}
|
// public boolean preventStoneLavaFarming() { return config.getBoolean("ExploitFix.LavaStoneAndCobbleFarming", true);}
|
||||||
}
|
//}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
package com.gmail.nossr50.events.skills.abilities;
|
package com.gmail.nossr50.events.skills.abilities;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
public class McMMOPlayerAbilityActivateEvent extends McMMOPlayerAbilityEvent implements Cancellable {
|
public class McMMOPlayerAbilityActivateEvent extends McMMOPlayerAbilityEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public McMMOPlayerAbilityActivateEvent(Player player, PrimarySkillType skill) {
|
public McMMOPlayerAbilityActivateEvent(Player player, PrimarySkillType skill, SuperAbilityType superAbilityType) {
|
||||||
super(player, skill);
|
super(player, skill, superAbilityType);
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package com.gmail.nossr50.events.skills.abilities;
|
package com.gmail.nossr50.events.skills.abilities;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerAbilityEvent {
|
public class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerAbilityEvent {
|
||||||
public McMMOPlayerAbilityDeactivateEvent(Player player, PrimarySkillType skill) {
|
public McMMOPlayerAbilityDeactivateEvent(Player player, PrimarySkillType primarySkillType, SuperAbilityType superAbilityType) {
|
||||||
super(player, skill);
|
super(player, primarySkillType, superAbilityType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,14 @@ import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class McMMOPlayerAbilityEvent extends McMMOPlayerSkillEvent {
|
public class McMMOPlayerAbilityEvent extends McMMOPlayerSkillEvent {
|
||||||
private SuperAbilityType ability;
|
private SuperAbilityType superAbilityType;
|
||||||
|
|
||||||
protected McMMOPlayerAbilityEvent(Player player, PrimarySkillType skill) {
|
protected McMMOPlayerAbilityEvent(Player player, PrimarySkillType primarySkillType, SuperAbilityType superAbilityType) {
|
||||||
super(player, skill);
|
super(player, primarySkillType);
|
||||||
ability = skill.getSuperAbility();
|
this.superAbilityType = superAbilityType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuperAbilityType getAbility() {
|
public SuperAbilityType getSuperAbilityType() {
|
||||||
return ability;
|
return superAbilityType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,18 +5,11 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.behaviours.ExcavationBehaviour;
|
import com.gmail.nossr50.datatypes.skills.behaviours.ExcavationBehaviour;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.ExperienceOrb;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ExcavationManager extends SkillManager {
|
public class ExcavationManager extends SkillManager {
|
||||||
|
|
||||||
private final ExcavationBehaviour excavationBehaviour;
|
private final ExcavationBehaviour excavationBehaviour;
|
||||||
@ -34,29 +27,29 @@ public class ExcavationManager extends SkillManager {
|
|||||||
public void excavationBlockCheck(BlockState blockState) {
|
public void excavationBlockCheck(BlockState blockState) {
|
||||||
int xp = excavationBehaviour.getBlockXP(blockState);
|
int xp = excavationBehaviour.getBlockXP(blockState);
|
||||||
|
|
||||||
if (pluginRef.getPermissionTools().isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
// if (pluginRef.getPermissionTools().isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
||||||
List<ExcavationTreasure> treasures = excavationBehaviour.getTreasures(blockState);
|
// List<ExcavationTreasure> treasures = excavationBehaviour.getTreasures(blockState);
|
||||||
|
//
|
||||||
if (!treasures.isEmpty()) {
|
// if (!treasures.isEmpty()) {
|
||||||
int skillLevel = getSkillLevel();
|
// int skillLevel = getSkillLevel();
|
||||||
Location location = Misc.getBlockCenter(blockState);
|
// Location location = Misc.getBlockCenter(blockState);
|
||||||
|
//
|
||||||
for (ExcavationTreasure treasure : treasures) {
|
// for (ExcavationTreasure treasure : treasures) {
|
||||||
if (skillLevel >= treasure.getDropLevel()
|
// if (skillLevel >= treasure.getDropLevel()
|
||||||
&& pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(getPlayer(), PrimarySkillType.EXCAVATION, treasure.getDropChance())) {
|
// && pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(getPlayer(), PrimarySkillType.EXCAVATION, treasure.getDropChance())) {
|
||||||
|
//
|
||||||
//Spawn Vanilla XP orbs if a dice roll succeeds
|
// //Spawn Vanilla XP orbs if a dice roll succeeds
|
||||||
if(pluginRef.getRandomChanceTools().rollDice(getArchaelogyExperienceOrbChance(), 100)) {
|
// if(pluginRef.getRandomChanceTools().rollDice(getArchaelogyExperienceOrbChance(), 100)) {
|
||||||
ExperienceOrb experienceOrb = (ExperienceOrb) getPlayer().getWorld().spawnEntity(location, EntityType.EXPERIENCE_ORB);
|
// ExperienceOrb experienceOrb = (ExperienceOrb) getPlayer().getWorld().spawnEntity(location, EntityType.EXPERIENCE_ORB);
|
||||||
experienceOrb.setExperience(getExperienceOrbsReward());
|
// experienceOrb.setExperience(getExperienceOrbsReward());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
xp += treasure.getXp();
|
// xp += treasure.getXp();
|
||||||
Misc.dropItem(location, treasure.getDrop());
|
// Misc.dropItem(location, treasure.getDrop());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
applyXpGain(xp, XPGainReason.PVE);
|
applyXpGain(xp, XPGainReason.PVE);
|
||||||
}
|
}
|
||||||
@ -75,21 +68,21 @@ public class ExcavationManager extends SkillManager {
|
|||||||
|
|
||||||
public void printExcavationDebug(Player player, BlockState blockState)
|
public void printExcavationDebug(Player player, BlockState blockState)
|
||||||
{
|
{
|
||||||
if (pluginRef.getPermissionTools().isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
// if (pluginRef.getPermissionTools().isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
||||||
List<ExcavationTreasure> treasures = excavationBehaviour.getTreasures(blockState);
|
// List<ExcavationTreasure> treasures = excavationBehaviour.getTreasures(blockState);
|
||||||
|
//
|
||||||
if (!treasures.isEmpty()) {
|
// if (!treasures.isEmpty()) {
|
||||||
for (ExcavationTreasure treasure : treasures) {
|
// for (ExcavationTreasure treasure : treasures) {
|
||||||
player.sendMessage("|||||||||||||||||||||||||||||||||");
|
// player.sendMessage("|||||||||||||||||||||||||||||||||");
|
||||||
player.sendMessage("[mcMMO DEBUG] Treasure found: (" + treasure.getDrop().getType().toString() + ")");
|
// player.sendMessage("[mcMMO DEBUG] Treasure found: (" + treasure.getDrop().getType().toString() + ")");
|
||||||
player.sendMessage("[mcMMO DEBUG] Drop Chance for Treasure: " + treasure.getDropChance());
|
// player.sendMessage("[mcMMO DEBUG] Drop Chance for Treasure: " + treasure.getDropChance());
|
||||||
player.sendMessage("[mcMMO DEBUG] Skill Level Required: " + treasure.getDropLevel());
|
// player.sendMessage("[mcMMO DEBUG] Skill Level Required: " + treasure.getDropLevel());
|
||||||
player.sendMessage("[mcMMO DEBUG] XP for Treasure: " + treasure.getXp());
|
// player.sendMessage("[mcMMO DEBUG] XP for Treasure: " + treasure.getXp());
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
player.sendMessage("[mcMMO DEBUG] No treasures found for this block.");
|
// player.sendMessage("[mcMMO DEBUG] No treasures found for this block.");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,16 +11,13 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.datatypes.skills.behaviours.HerbalismBehaviour;
|
import com.gmail.nossr50.datatypes.skills.behaviours.HerbalismBehaviour;
|
||||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.DelayedHerbalismXPCheckTask;
|
import com.gmail.nossr50.runnables.skills.DelayedHerbalismXPCheckTask;
|
||||||
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -36,7 +33,6 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HerbalismManager extends SkillManager {
|
public class HerbalismManager extends SkillManager {
|
||||||
|
|
||||||
@ -556,35 +552,36 @@ public class HerbalismManager extends SkillManager {
|
|||||||
* @return true if the ability was successful, false otherwise
|
* @return true if the ability was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean processHylianLuck(BlockState blockState) {
|
public boolean processHylianLuck(BlockState blockState) {
|
||||||
if (!pluginRef.getRandomChanceTools().isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.HERBALISM_HYLIAN_LUCK, getPlayer())) {
|
// if (!pluginRef.getRandomChanceTools().isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.HERBALISM_HYLIAN_LUCK, getPlayer())) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
// String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
||||||
if (!HerbalismTreasureConfig.getInstance().hylianMap.containsKey(friendly))
|
// if (!HerbalismTreasureConfig.getInstance().hylianMap.containsKey(friendly))
|
||||||
return false;
|
// return false;
|
||||||
List<HylianTreasure> treasures = HerbalismTreasureConfig.getInstance().hylianMap.get(friendly);
|
// List<HylianTreasure> treasures = HerbalismTreasureConfig.getInstance().hylianMap.get(friendly);
|
||||||
|
//
|
||||||
Player player = getPlayer();
|
// Player player = getPlayer();
|
||||||
|
//
|
||||||
if (treasures.isEmpty()) {
|
// if (treasures.isEmpty()) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
int skillLevel = getSkillLevel();
|
// int skillLevel = getSkillLevel();
|
||||||
Location location = Misc.getBlockCenter(blockState);
|
// Location location = Misc.getBlockCenter(blockState);
|
||||||
|
//
|
||||||
for (HylianTreasure treasure : treasures) {
|
// for (HylianTreasure treasure : treasures) {
|
||||||
if (skillLevel >= treasure.getDropLevel()
|
// if (skillLevel >= treasure.getDropLevel()
|
||||||
&& pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(treasure.getDropChance(), getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK))) {
|
// && pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(treasure.getDropChance(), getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK))) {
|
||||||
if (!pluginRef.getEventManager().simulateBlockBreak(blockState.getBlock(), player, false)) {
|
// if (!pluginRef.getEventManager().simulateBlockBreak(blockState.getBlock(), player, false)) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
blockState.setType(Material.AIR);
|
// blockState.setType(Material.AIR);
|
||||||
Misc.dropItem(location, treasure.getDrop());
|
// Misc.dropItem(location, treasure.getDrop());
|
||||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Herbalism.HylianLuck");
|
// pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Herbalism.HylianLuck");
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// return false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,17 +270,17 @@ public class TextComponentFactory {
|
|||||||
|
|
||||||
private TextComponent getSubSkillTextComponent(Player player, SubSkillType subSkillType) {
|
private TextComponent getSubSkillTextComponent(Player player, SubSkillType subSkillType) {
|
||||||
//Get skill name
|
//Get skill name
|
||||||
String skillName = subSkillType.getLocaleName();
|
String subSkillTypeLocaleName = subSkillType.getLocaleName(pluginRef);
|
||||||
|
|
||||||
boolean skillUnlocked = pluginRef.getRankTools().hasUnlockedSubskill(player, subSkillType);
|
boolean skillUnlocked = pluginRef.getRankTools().hasUnlockedSubskill(player, subSkillType);
|
||||||
|
|
||||||
TextComponent textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
|
TextComponent textComponent = initNewSkillTextComponent(player, subSkillTypeLocaleName, subSkillType, skillUnlocked);
|
||||||
|
|
||||||
//Hover Event
|
//Hover Event
|
||||||
addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, subSkillType));
|
addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, subSkillType));
|
||||||
|
|
||||||
//Insertion
|
//Insertion
|
||||||
textComponent.setInsertion(skillName);
|
textComponent.setInsertion(subSkillTypeLocaleName);
|
||||||
|
|
||||||
return textComponent;
|
return textComponent;
|
||||||
}
|
}
|
||||||
@ -450,7 +450,7 @@ public class TextComponentFactory {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private BaseComponent[] getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player) {
|
private BaseComponent[] getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player) {
|
||||||
String skillName = subSkillType.getLocaleName();
|
String skillName = subSkillType.getLocaleName(pluginRef);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hover Event BaseComponent color table
|
* Hover Event BaseComponent color table
|
||||||
@ -492,7 +492,7 @@ public class TextComponentFactory {
|
|||||||
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.DescriptionHeader"));
|
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.DescriptionHeader"));
|
||||||
componentBuilder.color(ccDescriptionHeader);
|
componentBuilder.color(ccDescriptionHeader);
|
||||||
componentBuilder.append("\n");
|
componentBuilder.append("\n");
|
||||||
componentBuilder.append(subSkillType.getLocaleDescription());
|
componentBuilder.append(subSkillType.getLocaleDescription(pluginRef));
|
||||||
componentBuilder.color(ccDescription);
|
componentBuilder.color(ccDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ public class TextComponentFactory {
|
|||||||
|
|
||||||
public void getSubSkillTextComponents(Player player, List<TextComponent> textComponents, PrimarySkillType parentSkill) {
|
public void getSubSkillTextComponents(Player player, List<TextComponent> textComponents, PrimarySkillType parentSkill) {
|
||||||
for (SubSkillType subSkillType : SubSkillType.values()) {
|
for (SubSkillType subSkillType : SubSkillType.values()) {
|
||||||
if (subSkillType.getParentSkill() == parentSkill) {
|
if (pluginRef.getSkillTools().getPrimarySkillBySubSkill(subSkillType) == parentSkill) {
|
||||||
if (pluginRef.getPermissionTools().isSubSkillEnabled(player, subSkillType)) {
|
if (pluginRef.getPermissionTools().isSubSkillEnabled(player, subSkillType)) {
|
||||||
if (!InteractionManager.hasSubSkill(subSkillType))
|
if (!InteractionManager.hasSubSkill(subSkillType))
|
||||||
textComponents.add(pluginRef.getTextComponentFactory().getSubSkillTextComponent(player, subSkillType));
|
textComponents.add(pluginRef.getTextComponentFactory().getSubSkillTextComponent(player, subSkillType));
|
||||||
@ -535,11 +535,9 @@ public class TextComponentFactory {
|
|||||||
|
|
||||||
public TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType) {
|
public TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType) {
|
||||||
TextComponent unlockMessage = new TextComponent("");
|
TextComponent unlockMessage = new TextComponent("");
|
||||||
unlockMessage.setText(pluginRef.getLocaleManager().getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), pluginRef.getRankTools().getRank(player, subSkillType)));
|
unlockMessage.setText(pluginRef.getLocaleManager().getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(pluginRef), pluginRef.getRankTools().getRank(player, subSkillType)));
|
||||||
unlockMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, getSubSkillHoverComponent(player, subSkillType)));
|
unlockMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, getSubSkillHoverComponent(player, subSkillType)));
|
||||||
unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + subSkillType.getParentSkill().toString().toLowerCase()));
|
unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + pluginRef.getSkillTools().getPrimarySkillBySubSkill(subSkillType).toString().toLowerCase()));
|
||||||
return unlockMessage;
|
return unlockMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user