mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Static Abuse Removal - Commands, Boss Bars
This commit is contained in:
parent
e001dea4d7
commit
376e156646
@ -106,7 +106,7 @@ public class McMMOPlayer {
|
|||||||
toolMode.put(toolType, false);
|
toolMode.put(toolType, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
experienceBarManager = new ExperienceBarManager(this);
|
experienceBarManager = new ExperienceBarManager(pluginRef,this);
|
||||||
fillPersonalXPModifiers(); //Cache players XP rates
|
fillPersonalXPModifiers(); //Cache players XP rates
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
registerCustomRecipes();
|
registerCustomRecipes();
|
||||||
initParties();
|
initParties();
|
||||||
|
|
||||||
formulaManager = new FormulaManager();
|
formulaManager = new FormulaManager(this);
|
||||||
|
|
||||||
for (Player player : getServer().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
new PlayerProfileLoadingTask(this, player).runTaskLaterAsynchronously(this, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
new PlayerProfileLoadingTask(this, player).runTaskLaterAsynchronously(this, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||||
|
@ -22,7 +22,7 @@ public final class CommandTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChildSkill(CommandSender sender, PrimarySkillType skill) {
|
public boolean isChildSkill(CommandSender sender, PrimarySkillType skill) {
|
||||||
if (skill == null || !skill.isChildSkill()) {
|
if (skill == null || !pluginRef.getSkillTools().isChildSkill(skill)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ public final class CommandTools {
|
|||||||
* @param display The sender to display stats to
|
* @param display The sender to display stats to
|
||||||
*/
|
*/
|
||||||
public void printGatheringSkills(Player inspect, CommandSender display) {
|
public void printGatheringSkills(Player inspect, CommandSender display) {
|
||||||
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Gathering"), PrimarySkillType.GATHERING_SKILLS);
|
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Gathering"), pluginRef.getSkillTools().GATHERING_SKILLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printGatheringSkills(Player player) {
|
public void printGatheringSkills(Player player) {
|
||||||
@ -174,7 +174,7 @@ public final class CommandTools {
|
|||||||
* @param display The sender to display stats to
|
* @param display The sender to display stats to
|
||||||
*/
|
*/
|
||||||
public void printCombatSkills(Player inspect, CommandSender display) {
|
public void printCombatSkills(Player inspect, CommandSender display) {
|
||||||
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Combat"), PrimarySkillType.COMBAT_SKILLS);
|
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Combat"), pluginRef.getSkillTools().COMBAT_SKILLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printCombatSkills(Player player) {
|
public void printCombatSkills(Player player) {
|
||||||
@ -188,7 +188,7 @@ public final class CommandTools {
|
|||||||
* @param display The sender to display stats to
|
* @param display The sender to display stats to
|
||||||
*/
|
*/
|
||||||
public void printMiscSkills(Player inspect, CommandSender display) {
|
public void printMiscSkills(Player inspect, CommandSender display) {
|
||||||
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Misc"), PrimarySkillType.MISC_SKILLS);
|
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Misc"), pluginRef.getSkillTools().MISC_SKILLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printMiscSkills(Player player) {
|
public void printMiscSkills(Player player) {
|
||||||
@ -196,7 +196,7 @@ public final class CommandTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String displaySkill(PlayerProfile profile, PrimarySkillType skill) {
|
public String displaySkill(PlayerProfile profile, PrimarySkillType skill) {
|
||||||
if (skill.isChildSkill()) {
|
if (pluginRef.getSkillTools().isChildSkill(skill)) {
|
||||||
return pluginRef.getLocaleManager().getString("Skills.ChildStats", pluginRef.getLocaleManager().getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill));
|
return pluginRef.getLocaleManager().getString("Skills.ChildStats", pluginRef.getLocaleManager().getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,9 +212,9 @@ public final class CommandTools {
|
|||||||
List<String> displayData = new ArrayList<>();
|
List<String> displayData = new ArrayList<>();
|
||||||
displayData.add(header);
|
displayData.add(header);
|
||||||
|
|
||||||
for (PrimarySkillType skill : skillGroup) {
|
for (PrimarySkillType primarySkillType : skillGroup) {
|
||||||
if (skill.doesPlayerHaveSkillPermission(inspect)) {
|
if (pluginRef.getSkillTools().doesPlayerHaveSkillPermission(primarySkillType, inspect)) {
|
||||||
displayData.add(displaySkill(profile, skill));
|
displayData.add(displaySkill(profile, primarySkillType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.util.experience;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.runnables.skills.ExperienceBarHideTask;
|
import com.gmail.nossr50.runnables.skills.ExperienceBarHideTask;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -15,8 +16,11 @@ public class ExperienceBarManager {
|
|||||||
HashMap<PrimarySkillType, ExperienceBarWrapper> experienceBars;
|
HashMap<PrimarySkillType, ExperienceBarWrapper> experienceBars;
|
||||||
HashMap<PrimarySkillType, ExperienceBarHideTask> experienceBarHideTaskHashMap;
|
HashMap<PrimarySkillType, ExperienceBarHideTask> experienceBarHideTaskHashMap;
|
||||||
private McMMOPlayer mcMMOPlayer;
|
private McMMOPlayer mcMMOPlayer;
|
||||||
|
private final mcMMO pluginRef;
|
||||||
|
|
||||||
|
public ExperienceBarManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
|
||||||
public ExperienceBarManager(McMMOPlayer mcMMOPlayer) {
|
|
||||||
//Init map
|
//Init map
|
||||||
experienceBars = new HashMap<>();
|
experienceBars = new HashMap<>();
|
||||||
experienceBarHideTaskHashMap = new HashMap<>();
|
experienceBarHideTaskHashMap = new HashMap<>();
|
||||||
@ -30,7 +34,7 @@ public class ExperienceBarManager {
|
|||||||
|
|
||||||
//Init Bar
|
//Init Bar
|
||||||
if (experienceBars.get(primarySkillType) == null)
|
if (experienceBars.get(primarySkillType) == null)
|
||||||
experienceBars.put(primarySkillType, new ExperienceBarWrapper(primarySkillType, mcMMOPlayer));
|
experienceBars.put(primarySkillType, new ExperienceBarWrapper(pluginRef, primarySkillType, mcMMOPlayer));
|
||||||
|
|
||||||
//Get Bar
|
//Get Bar
|
||||||
ExperienceBarWrapper experienceBarWrapper = experienceBars.get(primarySkillType);
|
ExperienceBarWrapper experienceBarWrapper = experienceBars.get(primarySkillType);
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.util.experience;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.player.PlayerLevelUtils;
|
import com.gmail.nossr50.util.player.PlayerLevelUtils;
|
||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
@ -20,6 +21,7 @@ public class ExperienceBarWrapper {
|
|||||||
private final PrimarySkillType primarySkillType; //Primary Skill
|
private final PrimarySkillType primarySkillType; //Primary Skill
|
||||||
private BossBar bossBar;
|
private BossBar bossBar;
|
||||||
private int lastLevelUpdated;
|
private int lastLevelUpdated;
|
||||||
|
private final mcMMO pluginRef;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is stored to help optimize updating the title
|
* This is stored to help optimize updating the title
|
||||||
@ -27,7 +29,8 @@ public class ExperienceBarWrapper {
|
|||||||
protected String niceSkillName;
|
protected String niceSkillName;
|
||||||
protected String title;
|
protected String title;
|
||||||
|
|
||||||
public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer) {
|
public ExperienceBarWrapper(mcMMO pluginRef, PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
this.mcMMOPlayer = mcMMOPlayer;
|
this.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.primarySkillType = primarySkillType;
|
this.primarySkillType = primarySkillType;
|
||||||
title = "";
|
title = "";
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.util.experience;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -14,8 +15,10 @@ public class FormulaManager {
|
|||||||
private Map<Integer, Integer> experienceNeededStandardExponential;
|
private Map<Integer, Integer> experienceNeededStandardExponential;
|
||||||
|
|
||||||
private FormulaType currentFormula;
|
private FormulaType currentFormula;
|
||||||
|
private final mcMMO pluginRef;
|
||||||
|
|
||||||
public FormulaManager() {
|
public FormulaManager(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
currentFormula = pluginRef.getConfigManager().getConfigLeveling().getFormulaType();
|
currentFormula = pluginRef.getConfigManager().getConfigLeveling().getFormulaType();
|
||||||
initExperienceNeededMaps();
|
initExperienceNeededMaps();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.util.nbt;
|
package com.gmail.nossr50.util.nbt;
|
||||||
|
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import net.minecraft.server.v1_13_R2.NBTBase;
|
import net.minecraft.server.v1_13_R2.NBTBase;
|
||||||
import net.minecraft.server.v1_13_R2.NBTList;
|
import net.minecraft.server.v1_13_R2.NBTList;
|
||||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||||
@ -13,8 +14,10 @@ public class NBTManager {
|
|||||||
|
|
||||||
private static final String CRAFT_META_ITEM_CLASS_PATH = "org.bukkit.craftbukkit.inventory.CraftMetaItem";
|
private static final String CRAFT_META_ITEM_CLASS_PATH = "org.bukkit.craftbukkit.inventory.CraftMetaItem";
|
||||||
private Class<?> craftMetaItemClass;
|
private Class<?> craftMetaItemClass;
|
||||||
|
private final mcMMO pluginRef;
|
||||||
|
|
||||||
public NBTManager() {
|
public NBTManager(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
init(); //Setup method references etc
|
init(); //Setup method references etc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.nbt;
|
package com.gmail.nossr50.util.nbt;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import net.minecraft.server.v1_13_R2.NBTBase;
|
import net.minecraft.server.v1_13_R2.NBTBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,7 +28,7 @@ public class RawNBT {
|
|||||||
this.nbtContents = nbtContents;
|
this.nbtContents = nbtContents;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTBase getNbtData() {
|
public NBTBase getNbtData(mcMMO pluginRef) {
|
||||||
return pluginRef.getNbtManager().constructNBT(nbtContents);
|
return pluginRef.getNbtManager().constructNBT(nbtContents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user