mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Add enable toggle and per skill thresholds
This commit is contained in:
parent
ce3463ad6d
commit
62a767db89
@ -11,6 +11,7 @@ Version 1.5.01-dev
|
||||
+ Added new child skill; Salvage
|
||||
+ Added UUID support!
|
||||
+ Added SQL connection pooling and async loading!
|
||||
+ Added the long awaited Diminished Returns feature
|
||||
+ Added new feature to Herbalism. Instantly-regrown crops are protected from being broken for 1 second
|
||||
+ Added option to config.yml to show the /mcstats scoreboard automatically after logging in
|
||||
+ Added option to config.yml for Alchemy. Skills.Alchemy.Prevent_Hopper_Transfer_Bottles
|
||||
|
@ -180,7 +180,8 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
||||
|
||||
/* Deminished Returns */
|
||||
public int getDiminishedReturnsThreshold() { return config.getInt("Diminished_Returns.Threshold", 20000); }
|
||||
public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); }
|
||||
public int getDiminishedReturnsThreshold(SkillType skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); }
|
||||
public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); }
|
||||
|
||||
/* Conversion */
|
||||
|
@ -44,7 +44,8 @@ public class SelfListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold();
|
||||
SkillType skillType = event.getSkill();
|
||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(skillType);
|
||||
|
||||
if (threshold <= 0) {
|
||||
// Diminished returns is turned off
|
||||
@ -59,7 +60,6 @@ public class SelfListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
SkillType skillType = event.getSkill();
|
||||
|
||||
if (skillType.isChildSkill()) {
|
||||
return;
|
||||
|
@ -496,7 +496,7 @@ public class mcMMO extends JavaPlugin {
|
||||
}
|
||||
|
||||
// Clear the registered XP data so players can earn XP again
|
||||
if (ExperienceConfig.getInstance().getDiminishedReturnsThreshold() > 0) {
|
||||
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
|
||||
}
|
||||
}
|
||||
|
@ -63,9 +63,25 @@ Experience_Formula:
|
||||
# Settings for Diminished Returns
|
||||
###
|
||||
Diminished_Returns:
|
||||
Enabled: false
|
||||
|
||||
# Limit the amount of experience a player can earn:
|
||||
# Threshold (amount of experience) per Time_Interval (in minutes)
|
||||
Threshold: 20000
|
||||
Threshold:
|
||||
Swords: 20000
|
||||
Taming: 20000
|
||||
Acrobatics: 20000
|
||||
Excavation: 20000
|
||||
Herbalism: 20000
|
||||
Unarmed: 20000
|
||||
Woodcutting: 20000
|
||||
Mining: 20000
|
||||
Archery: 20000
|
||||
Axes: 20000
|
||||
Repair: 20000
|
||||
Fishing: 20000
|
||||
Alchemy: 20000
|
||||
|
||||
Time_Interval: 10
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user