Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into configurable

This commit is contained in:
nossr50 2019-06-01 01:58:21 -07:00
commit 5af60e2fe1
5 changed files with 52 additions and 4 deletions

View File

@ -156,6 +156,21 @@ Version 2.2.0
Added API method to check if a skill was being level capped Added API method to check if a skill was being level capped
Added 'UndefinedSkillBehaviour' for trying to use a method that has no behaviour defined for the provided skill Added 'UndefinedSkillBehaviour' for trying to use a method that has no behaviour defined for the provided skill
Version 2.1.67
The XP bar now reflects whether or not the player is receiving the early game boost
Players who are receiving an early game boost will be shown "Learning a skill..." as the title of the XP bar while gaining XP
New locale string 'XPBar.Template.EarlyGameBoost'
NOTES:
You can turn off this system in experience.yml 'EarlyGameBoost.Enabled'
The Early Game Boost is a system in which players receive drastically increased XP gains for the first few levels (until the first set of skills are unlocked)
With default settings, this means players will be receiving boosted XP for the first 5 levels (50 for Retro)
The Early Game Boost ends when players get the first skill in each ability under default settings
The main purpose of this system is to alleviate progression issues with a few skills where the first set of unlocked abilities drastically increase how fun it is to level the skill
The secondary purpose of this system is to alleviate any psychological issues when grinding towards the first set of unlocks by making the first set of unlocks happen quickly
This system has been in place for a few versions now, but without an in game indicator of what was going on.
If you have XP bars off there is still no indicator that this system is in place, I'll address that at some point.
Version 2.1.66 Version 2.1.66
Fixed a bug that could happen if a player was removed from the DB when using MySQL/MariaDB when the user was offline Fixed a bug that could happen if a player was removed from the DB when using MySQL/MariaDB when the user was offline
Fixed a minor memory leak for MySQL Fixed a minor memory leak for MySQL

View File

@ -8,6 +8,7 @@ import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent; import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent; import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.PlayerLevelUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
@ -92,7 +93,8 @@ public class SelfListener implements Listener {
int earlyGameBonusXP = 0; int earlyGameBonusXP = 0;
//Give some bonus XP for low levels //Give some bonus XP for low levels
if (mcMMOPlayer.getSkillLevel(primarySkillType) <= mcMMO.getPlayerLevelUtils().getEarlyGameCutoff(primarySkillType)) { if(PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType))
{
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05); earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP); event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
} }
@ -144,4 +146,6 @@ public class SelfListener implements Listener {
} }
} }
} }

View File

@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.player.PlayerLevelUtils;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.boss.BarColor; import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle; import org.bukkit.boss.BarStyle;
@ -20,7 +21,14 @@ public class ExperienceBarWrapper {
protected final McMMOPlayer mcMMOPlayer; protected final McMMOPlayer mcMMOPlayer;
private final PrimarySkillType primarySkillType; //Primary Skill private final PrimarySkillType primarySkillType; //Primary Skill
<<<<<<< HEAD
private final Server server; private final Server server;
=======
private BossBar bossBar;
protected final McMMOPlayer mcMMOPlayer;
private int lastLevelUpdated;
>>>>>>> 9111590dc2a9bb6a1c12fefc13167a1d88470cd4
/* /*
* This is stored to help optimize updating the title * This is stored to help optimize updating the title
*/ */
@ -31,7 +39,6 @@ public class ExperienceBarWrapper {
public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer) { public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer) {
this.mcMMOPlayer = mcMMOPlayer; this.mcMMOPlayer = mcMMOPlayer;
this.server = mcMMOPlayer.getPlayer().getServer(); //Might not be good for bungee to do this
this.primarySkillType = primarySkillType; this.primarySkillType = primarySkillType;
title = ""; title = "";
lastLevelUpdated = 0; lastLevelUpdated = 0;
@ -55,8 +62,10 @@ public class ExperienceBarWrapper {
private String getTitleTemplate() { private String getTitleTemplate() {
//If they are using extra details //If they are using extra details
if (mcMMO.getConfigManager().getConfigLeveling().isMoreDetailedXPBars()) if(mcMMO.getConfigManager().getConfigLeveling().getEarlyGameBoost().isEnableEarlyGameBoost() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
return LocaleLoader.getString("XPBar.Complex.Template", LocaleLoader.getString("XPBar." + niceSkillName, getLevel()), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel()); return LocaleLoader.getString("XPBar.Template.EarlyGameBoost");
} else if(mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceBars().isMoreDetailedXPBars())
return LocaleLoader.getString("XPBar.Complex.Template", LocaleLoader.getString("XPBar."+niceSkillName, getLevel()), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
return LocaleLoader.getString("XPBar." + niceSkillName, getLevel(), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel()); return LocaleLoader.getString("XPBar." + niceSkillName, getLevel(), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
} }
@ -119,6 +128,13 @@ public class ExperienceBarWrapper {
else else
bossBar.setProgress(v); bossBar.setProgress(v);
//Check player level
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
setColor(BarColor.YELLOW);
} else {
setColor(ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType));
}
//Every time progress updates we need to check for a title update //Every time progress updates we need to check for a title update
if (getLevel() != lastLevelUpdated || mcMMO.getConfigManager().getConfigLeveling().isMoreDetailedXPBars()) { if (getLevel() != lastLevelUpdated || mcMMO.getConfigManager().getConfigLeveling().isMoreDetailedXPBars()) {
updateTitle(); updateTitle();

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.util.player; package com.gmail.nossr50.util.player;
import com.gmail.nossr50.datatypes.experience.CustomXPPerk; import com.gmail.nossr50.datatypes.experience.CustomXPPerk;
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.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -131,4 +132,14 @@ public class PlayerLevelUtils {
} }
/**
* Check if a player is currently qualifying for the early game boosted XP
* Will return false only if a player is above the boost level cutoff, it does not check config settings to see if the early game boost is on
* @param mcMMOPlayer target player
* @param primarySkillType target skill
* @return if the player would qualify for the XP boost if its enabled
*/
public static boolean qualifiesForEarlyGameBoost(McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType) {
return mcMMOPlayer.getSkillLevel(primarySkillType) < mcMMO.getPlayerLevelUtils().getEarlyGameCutoff(primarySkillType);
}
} }

View File

@ -98,6 +98,8 @@ Commands.Party.Header=[[RED]]-----[][[GREEN]]PARTY[[RED]][]-----
Commands.Party.Features.Header=[[RED]]-----[][[GREEN]]FEATURES[[RED]][]----- Commands.Party.Features.Header=[[RED]]-----[][[GREEN]]FEATURES[[RED]][]-----
# XP BAR Allows for the following variables -- {0} = Skill Level, {1} Current XP, {2} XP Needed for next level, {3} Power Level, {4} Percentage of Level # XP BAR Allows for the following variables -- {0} = Skill Level, {1} Current XP, {2} XP Needed for next level, {3} Power Level, {4} Percentage of Level
# Make sure you turn on Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained if you want the XP bar title to update every time a player gains XP! # Make sure you turn on Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained if you want the XP bar title to update every time a player gains XP!
XPBar.Template={0}
XPBar.Template.EarlyGameBoost=[[GOLD]]Learning a new skill...
XPBar.Acrobatics=Acrobatics Lv.[[GOLD]]{0} XPBar.Acrobatics=Acrobatics Lv.[[GOLD]]{0}
XPBar.Alchemy=Alchemy Lv.[[GOLD]]{0} XPBar.Alchemy=Alchemy Lv.[[GOLD]]{0}
XPBar.Archery=Archery Lv.[[GOLD]]{0} XPBar.Archery=Archery Lv.[[GOLD]]{0}