mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Static Abuse Removal - PlayerLevelUtils -> PlayerLevelTools
This commit is contained in:
parent
376e156646
commit
8f540796ff
@ -186,7 +186,7 @@ public class McMMOPlayer {
|
||||
continue;
|
||||
|
||||
//Set the players custom XP modifier, defaults to 1.0D on missing entries
|
||||
personalXPModifiers.put(primarySkillType, pluginRef.getPlayerLevelUtils().determineXpPerkValue(player, primarySkillType));
|
||||
personalXPModifiers.put(primarySkillType, pluginRef.getPlayerLevelTools().determineXpPerkValue(player, primarySkillType));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.PlayerLevelUtils;
|
||||
import com.gmail.nossr50.util.player.PlayerLevelTools;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -86,7 +86,7 @@ public class SelfListener implements Listener {
|
||||
int earlyGameBonusXP = 0;
|
||||
|
||||
//Give some bonus XP for low levels
|
||||
if(PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType))
|
||||
if(PlayerLevelTools.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType))
|
||||
{
|
||||
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
|
||||
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
|
||||
|
@ -36,7 +36,7 @@ import com.gmail.nossr50.util.commands.CommandTools;
|
||||
import com.gmail.nossr50.util.experience.FormulaManager;
|
||||
import com.gmail.nossr50.util.nbt.NBTManager;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.PlayerLevelUtils;
|
||||
import com.gmail.nossr50.util.player.PlayerLevelTools;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.CombatTools;
|
||||
@ -71,8 +71,6 @@ public class mcMMO extends JavaPlugin {
|
||||
private DynamicSettingsManager dynamicSettingsManager;
|
||||
private DatabaseManager databaseManager;
|
||||
private FormulaManager formulaManager;
|
||||
private MaterialMapStore materialMapStore;
|
||||
private PlayerLevelUtils playerLevelUtils;
|
||||
private NotificationManager notificationManager;
|
||||
private CommandRegistrationManager commandRegistrationManager;
|
||||
private NBTManager nbtManager;
|
||||
@ -91,6 +89,8 @@ public class mcMMO extends JavaPlugin {
|
||||
private SkillTools skillTools; //TODO: Remove once a new skill system is in place
|
||||
private CombatTools combatTools; //TODO: Rewrite this garbo
|
||||
private TextComponentFactory textComponentFactory;
|
||||
private PlayerLevelTools playerLevelTools;
|
||||
private MaterialMapStore materialMapStore;
|
||||
|
||||
/* Never-Ending tasks */
|
||||
private BleedTimerTask bleedTimerTask;
|
||||
@ -179,7 +179,7 @@ public class mcMMO extends JavaPlugin {
|
||||
commandRegistrationManager = new CommandRegistrationManager(this);
|
||||
commandRegistrationManager.registerCommands();
|
||||
|
||||
nbtManager = new NBTManager();
|
||||
nbtManager = new NBTManager(this);
|
||||
|
||||
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
||||
|
||||
@ -215,7 +215,7 @@ public class mcMMO extends JavaPlugin {
|
||||
materialMapStore = new MaterialMapStore();
|
||||
|
||||
//Init player level values
|
||||
playerLevelUtils = new PlayerLevelUtils();
|
||||
playerLevelTools = new PlayerLevelTools(this);
|
||||
|
||||
//Init Notification Manager
|
||||
notificationManager = new NotificationManager(this);
|
||||
@ -309,8 +309,8 @@ public class mcMMO extends JavaPlugin {
|
||||
getPartyManager().loadParties();
|
||||
}
|
||||
|
||||
public PlayerLevelUtils getPlayerLevelUtils() {
|
||||
return playerLevelUtils;
|
||||
public PlayerLevelTools getPlayerLevelTools() {
|
||||
return playerLevelTools;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.player.PlayerLevelUtils;
|
||||
import com.gmail.nossr50.util.player.PlayerLevelTools;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
@ -55,7 +55,7 @@ public class ExperienceBarWrapper {
|
||||
|
||||
private String getTitleTemplate() {
|
||||
//If they are using extra details
|
||||
if(pluginRef.getConfigManager().getConfigLeveling().getEarlyGameBoost().isEnableEarlyGameBoost() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
|
||||
if(pluginRef.getConfigManager().getConfigLeveling().getEarlyGameBoost().isEnableEarlyGameBoost() && PlayerLevelTools.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
|
||||
return pluginRef.getLocaleManager().getString("XPBar.Template.EarlyGameBoost");
|
||||
} else if(pluginRef.getConfigManager().getConfigLeveling().getConfigExperienceBars().isMoreDetailedXPBars())
|
||||
return pluginRef.getLocaleManager().getString("XPBar.Complex.Template", pluginRef.getLocaleManager().getString("XPBar."+niceSkillName, getLevel()), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
|
||||
@ -122,7 +122,7 @@ public class ExperienceBarWrapper {
|
||||
bossBar.setProgress(v);
|
||||
|
||||
//Check player level
|
||||
if(pluginRef.getConfigManager().getConfigLeveling().getEarlyGameBoost().isEnableEarlyGameBoost() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
|
||||
if(pluginRef.getConfigManager().getConfigLeveling().getEarlyGameBoost().isEnableEarlyGameBoost() && PlayerLevelTools.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
|
||||
setColor(BarColor.YELLOW);
|
||||
} else {
|
||||
setColor(pluginRef.getConfigManager().getConfigLeveling().getConfigExperienceBars().getXPBarColor(primarySkillType));
|
||||
|
@ -3,16 +3,19 @@ package com.gmail.nossr50.util.player;
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class PlayerLevelUtils {
|
||||
public class PlayerLevelTools {
|
||||
private final mcMMO pluginRef;
|
||||
private HashSet<CustomXPPerk> customXpPerkNodes;
|
||||
|
||||
public PlayerLevelUtils() {
|
||||
public PlayerLevelTools(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
registerCustomPerkPermissions();
|
||||
applyConfigPerks();
|
||||
}
|
||||
@ -39,7 +42,7 @@ public class PlayerLevelUtils {
|
||||
* @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) {
|
||||
public boolean qualifiesForEarlyGameBoost(McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType) {
|
||||
return mcMMOPlayer.getSkillLevel(primarySkillType) < 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user