More work on skill API impl/migration

This commit is contained in:
nossr50 2020-12-24 16:41:09 -08:00
parent 9b9ffbb982
commit 21ac44ee61
12 changed files with 205 additions and 77 deletions

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.skills.crossbows.CrossbowManager;
import com.gmail.nossr50.skills.crossbows.CrossbowsManager;
import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component;
@ -29,10 +29,10 @@ public class CrossbowsCommand extends SkillCommand {
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>();
CrossbowManager crossbowManager = ((McMMOPlayer) (mmoPlayer)).getCrossbowManager();
CrossbowsManager crossbowsManager = ((McMMOPlayer) (mmoPlayer)).getCrossbowManager();
if(canUseSubskill(mmoPlayer, SubSkillType.CROSSBOWS_SUPER_SHOTGUN)) {
String additionalArrowCount = String.valueOf(crossbowManager.getSuperShotgunAdditionalArrowCount());
String additionalArrowCount = String.valueOf(crossbowsManager.getSuperShotgunAdditionalArrowCount());
messages.add(getStatMessage(SubSkillType.CROSSBOWS_SUPER_SHOTGUN, additionalArrowCount));
}

View File

@ -4,6 +4,8 @@ import com.gmail.nossr50.chat.author.PlayerAuthor;
import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.skills.CoreRootSkill;
import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
@ -15,7 +17,7 @@ import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
import com.gmail.nossr50.skills.archery.ArcheryManager;
import com.gmail.nossr50.skills.axes.AxesManager;
import com.gmail.nossr50.skills.crossbows.CrossbowManager;
import com.gmail.nossr50.skills.crossbows.CrossbowsManager;
import com.gmail.nossr50.skills.excavation.ExcavationManager;
import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
@ -25,7 +27,7 @@ import com.gmail.nossr50.skills.salvage.SalvageManager;
import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.skills.swords.SwordsManager;
import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.skills.tridents.TridentManager;
import com.gmail.nossr50.skills.tridents.TridentsManager;
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
import com.gmail.nossr50.util.Misc;
@ -54,10 +56,9 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
private final @NotNull Identity identity;
private @Nullable Party playerPartyRef;
//Used in our chat systems for chat messages
private final @NotNull PlayerAuthor playerAuthor;
private final @NotNull Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<>();
private final @NotNull Map<RootSkill, SkillManager> skillManagers = new HashMap<>();
private final @NotNull MMOExperienceBarManager experienceBarManager;
private @Nullable PartyTeleportRecord ptpRecord;
@ -141,8 +142,8 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
* If in the future someone wants to remove this, don't forget to also remove what is in the PrimarySkillType enum. - bm01
*/
try {
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
skillManagers.put(primarySkillType, primarySkillType.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
for (CoreRootSkill coreRootSkill : CoreSkills.getCoreRootSkills()) {
skillManagers.put(coreRootSkill, coreRootSkill.getSkillManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
}
}
catch (Exception e) {
@ -311,19 +312,19 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
}
/**
* Grab the {@link TridentManager} for this player
* Grab the {@link TridentsManager} for this player
* @return this player's trident manager
*/
public @NotNull TridentManager getTridentManager() {
return (TridentManager) skillManagers.get(PrimarySkillType.TRIDENTS);
public @NotNull TridentsManager getTridentManager() {
return (TridentsManager) skillManagers.get(PrimarySkillType.TRIDENTS);
}
/**
* Grab the {@link CrossbowManager} for this player
* Grab the {@link CrossbowsManager} for this player
* @return this player's crossbow manager
*/
public @NotNull CrossbowManager getCrossbowManager() {
return (CrossbowManager) skillManagers.get(PrimarySkillType.CROSSBOWS);
public @NotNull CrossbowsManager getCrossbowManager() {
return (CrossbowsManager) skillManagers.get(PrimarySkillType.CROSSBOWS);
}
/**

View File

@ -79,7 +79,7 @@ public class PersistentPlayerData implements MMOPlayerData {
//Core skills
//TODO: Don't store values for disabled skills
for(RootSkill rootSkill : CoreSkills.getCoreSkills()) {
for(RootSkill rootSkill : CoreSkills.getCoreRootSkills()) {
skillLevelValues.put(rootSkill, AdvancedConfig.getInstance().getStartingLevel());
skillExperienceValues.put(rootSkill, 0F);
}

View File

@ -1,14 +1,58 @@
package com.gmail.nossr50.datatypes.skills;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.text.StringUtils;
import com.neetgames.mcmmo.skill.RootSkillImpl;
import com.neetgames.mcmmo.player.MMOPlayer;
import com.neetgames.mcmmo.skill.AbstractRootSkill;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.jetbrains.annotations.NotNull;
import java.util.Locale;
class CoreRootSkill extends RootSkillImpl {
public CoreRootSkill(@NotNull String skillName) {
public class CoreRootSkill extends AbstractRootSkill {
@NotNull private final Class<? extends SkillManager> skillManagerClass;
public CoreRootSkill(@NotNull String skillName, @NotNull Class<? extends SkillManager> clazz) {
super(mcMMO.p.getName(), StringUtils.getCapitalized(skillName), "mcmmo.skills." + skillName.toLowerCase(Locale.ENGLISH));
this.skillManagerClass = clazz;
}
public @NotNull Class<? extends SkillManager> getSkillManagerClass() {
return skillManagerClass;
}
@Override
public boolean isPVPPermitted() {
return Config.getInstance().getPVPEnabled(this);
}
@Override
public boolean isPVEPermitted() {
return Config.getInstance().getPVEEnabled(this);
}
@Override
public boolean isAffectedByHardcoreModeStatLoss() {
return Config.getInstance().getHardcoreStatLossEnabled(this);
}
@Override
public boolean getHardcoreVampirismEnabled() {
return Config.getInstance().getHardcoreVampirismEnabled(this);
}
@Override
public boolean isRootSkillPermitted(@NotNull MMOPlayer mmoPlayer) {
return Permissions.skillEnabled(mmoPlayer, this);
}
@Override
public boolean isOffensiveActionAllowed(@NotNull Object victim) {
return (victim instanceof Player || (victim instanceof Tameable && ((Tameable) victim).isTamed())) ? isPVPPermitted() : isPVEPermitted();;
}
}

View File

@ -0,0 +1,15 @@
package com.gmail.nossr50.datatypes.skills;
import com.neetgames.mcmmo.skill.RootSkill;
import com.neetgames.mcmmo.skill.SkillImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class CoreSkill extends SkillImpl {
//TODO: Change to passing SkillIdentity
public CoreSkill(@NotNull String pluginName, @NotNull String skillName, @Nullable String permission, @NotNull RootSkill parentSkill) {
super(pluginName, skillName, permission, parentSkill);
}
}

View File

@ -1,8 +1,26 @@
package com.gmail.nossr50.datatypes.skills;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
import com.gmail.nossr50.skills.archery.ArcheryManager;
import com.gmail.nossr50.skills.axes.AxesManager;
import com.gmail.nossr50.skills.crossbows.CrossbowsManager;
import com.gmail.nossr50.skills.excavation.ExcavationManager;
import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.repair.RepairManager;
import com.gmail.nossr50.skills.salvage.SalvageManager;
import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.skills.swords.SwordsManager;
import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.skills.tridents.TridentsManager;
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
import com.google.common.collect.ImmutableSet;
import com.neetgames.mcmmo.skill.RootSkill;
import com.neetgames.mcmmo.skill.SkillIdentity;
import com.neetgames.mcmmo.skill.SuperSkill;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
@ -13,18 +31,26 @@ import java.util.stream.Collectors;
public class CoreSkills {
private static final @NotNull ImmutableSet<RootSkill> CORE_ROOT_SKILLS;
private static final @NotNull ImmutableSet<RootSkill> CORE_CHILD_SKILLS;
private static final @NotNull ImmutableSet<RootSkill> CORE_NON_CHILD_SKILLS;
private static final @NotNull ImmutableSet<CoreRootSkill> CORE_ROOT_SKILLS;
private static final @NotNull ImmutableSet<CoreRootSkill> CORE_CHILD_SKILLS; //Could make this a marker interface
private static final @NotNull ImmutableSet<CoreRootSkill> CORE_NON_CHILD_SKILLS;
private static final @NotNull ImmutableSet<CoreSkill> CORE_SUB_SKILLS;
private static final @NotNull ImmutableSet<SuperSkill> CORE_SUPER_SKILLS;
//TODO: Use annotations instead
public static final @NotNull CoreRootSkill ACROBATICS, ALCHEMY, ARCHERY, AXES, EXCAVATION,
FISHING, HERBALISM, MINING, REPAIR, SALVAGE, SMELTING, SWORDS, TAMING, UNARMED,
WOODCUTTING, TRIDENTS, CROSSBOWS;
//TODO: Needed?
public static final @NotNull SkillIdentity ACROBATICS_ID, ALCHEMY_ID, ARCHERY_ID, AXES_ID, EXCAVATION_ID,
FISHING_ID, HERBALISM_ID, MINING_ID, REPAIR_ID, SALVAGE_ID, SMELTING_ID, SWORDS_ID, TAMING_ID, UNARMED_ID,
WOODCUTTING_ID, TRIDENTS_ID, CROSSBOWS_ID;
public static final @NotNull SuperSkill SKULL_SPLITTER, GIGA_DRILL_BREAKER, GREEN_TERRA, SUPER_BREAKER,
BLAST_MINING, SERRATED_STRIKES, CALL_OF_THE_WILD, BERSERK, TREE_FELLER, TRIDENTS_SUPER, SUPER_SHOT_GUN;
public static final CoreSkill ROLL;
private static @NotNull
final HackySkillMappings hackySkillMappings = new HackySkillMappings();
@ -32,56 +58,58 @@ public class CoreSkills {
static {
HashSet<CoreRootSkill> rootSkillSet = new HashSet<>();
HashSet<CoreRootSkill> childSkillSet = new HashSet<>();
HashSet<CoreSkill> subSkillSet = new HashSet<>();
HashSet<SuperSkill> superSkillSet = new HashSet<>();
ACROBATICS = new CoreRootSkill("acrobatics");
ACROBATICS = new CoreRootSkill("acrobatics", AcrobaticsManager.class);
ACROBATICS_ID = ACROBATICS.getSkillIdentity();
ALCHEMY = new CoreRootSkill("alchemy");
ALCHEMY = new CoreRootSkill("alchemy", AlchemyManager.class);
ALCHEMY_ID = ALCHEMY.getSkillIdentity();
ARCHERY = new CoreRootSkill("archery");
ARCHERY = new CoreRootSkill("archery", ArcheryManager.class);
ARCHERY_ID = ARCHERY.getSkillIdentity();
AXES = new CoreRootSkill("axes");
AXES = new CoreRootSkill("axes", AxesManager.class);
AXES_ID = AXES.getSkillIdentity();
EXCAVATION = new CoreRootSkill("excavation");
EXCAVATION = new CoreRootSkill("excavation", ExcavationManager.class);
EXCAVATION_ID = EXCAVATION.getSkillIdentity();
FISHING = new CoreRootSkill("fishing");
FISHING = new CoreRootSkill("fishing", FishingManager.class);
FISHING_ID = FISHING.getSkillIdentity();
HERBALISM = new CoreRootSkill("herbalism");
HERBALISM = new CoreRootSkill("herbalism", HerbalismManager.class);
HERBALISM_ID = HERBALISM.getSkillIdentity();
MINING = new CoreRootSkill("mining");
MINING = new CoreRootSkill("mining", MiningManager.class);
MINING_ID = MINING.getSkillIdentity();
REPAIR = new CoreRootSkill("repair");
REPAIR = new CoreRootSkill("repair", RepairManager.class);
REPAIR_ID = REPAIR.getSkillIdentity();
SALVAGE = new CoreRootSkill("salvage");
SALVAGE = new CoreRootSkill("salvage", SalvageManager.class);
SALVAGE_ID = SALVAGE.getSkillIdentity();
SMELTING = new CoreRootSkill("smelting");
SMELTING = new CoreRootSkill("smelting", SmeltingManager.class);
SMELTING_ID = SMELTING.getSkillIdentity();
SWORDS = new CoreRootSkill("swords");
SWORDS = new CoreRootSkill("swords", SwordsManager.class);
SWORDS_ID = SWORDS.getSkillIdentity();
TAMING = new CoreRootSkill("taming");
TAMING = new CoreRootSkill("taming", TamingManager.class);
TAMING_ID = TAMING.getSkillIdentity();
UNARMED = new CoreRootSkill("unarmed");
UNARMED = new CoreRootSkill("unarmed", UnarmedManager.class);
UNARMED_ID = UNARMED.getSkillIdentity();
WOODCUTTING = new CoreRootSkill("woodcutting");
WOODCUTTING = new CoreRootSkill("woodcutting", WoodcuttingManager.class);
WOODCUTTING_ID = WOODCUTTING.getSkillIdentity();
TRIDENTS = new CoreRootSkill("tridents");
TRIDENTS = new CoreRootSkill("tridents", TridentsManager.class);
TRIDENTS_ID = TRIDENTS.getSkillIdentity();
CROSSBOWS = new CoreRootSkill("crossbows");
CROSSBOWS = new CoreRootSkill("crossbows", CrossbowsManager.class);
CROSSBOWS_ID = CROSSBOWS.getSkillIdentity();
//Child skills (soon to be removed)
@ -109,6 +137,22 @@ public class CoreSkills {
CORE_ROOT_SKILLS = ImmutableSet.copyOf(rootSkillSet);
CORE_CHILD_SKILLS = ImmutableSet.copyOf(childSkillSet);
CORE_NON_CHILD_SKILLS = ImmutableSet.copyOf(generateNonChildSkillSet());
CORE_SUB_SKILLS = ImmutableSet.copyOf(subSkillSet);
CORE_SUPER_SKILLS = ImmutableSet.copyOf(superSkillSet);
/*
* Define managers
*/
}
/**
* Returns a set of built in {@link RootSkill}s for mcMMO
* No guarantees for whether or not the skills are registered or active or inactive
*
* @return a set of all root skills built into mcMMO
*/
public static @NotNull Set<CoreRootSkill> getCoreRootSkills() {
return CORE_ROOT_SKILLS;
}
/**
@ -117,8 +161,8 @@ public class CoreSkills {
*
* @return a set of all root skills built into mcMMO
*/
public static @NotNull Set<RootSkill> getCoreSkills() {
return CORE_ROOT_SKILLS;
public static @NotNull Set<CoreSkill> getCoreSkills() {
return CORE;
}
/**
@ -129,7 +173,7 @@ public class CoreSkills {
* @deprecated child skills will be removed in an upcoming update
*/
@Deprecated
public static @NotNull Set<RootSkill> getChildSkills() {
public static @NotNull Set<CoreRootSkill> getChildSkills() {
return CORE_CHILD_SKILLS;
}
@ -161,17 +205,17 @@ public class CoreSkills {
}
@Deprecated
private static @NotNull Set<RootSkill> generateNonChildSkillSet() {
return getCoreSkills().stream().filter((x) -> !isChildSkill(x)).collect(Collectors.toSet());
private static @NotNull Set<CoreRootSkill> generateNonChildSkillSet() {
return getCoreRootSkills().stream().filter((x) -> !isChildSkill(x)).collect(Collectors.toSet());
}
public static @NotNull Set<RootSkill> getNonChildSkills() {
public static @NotNull Set<CoreRootSkill> getNonChildSkills() {
return CORE_NON_CHILD_SKILLS;
}
protected static class HackySkillMappings {
@NotNull Map<PrimarySkillType, RootSkill> primaryToRootMap = new HashMap<>();
@NotNull Map<RootSkill, PrimarySkillType> rootToPrimaryMap = new HashMap<>();
@NotNull Map<PrimarySkillType, CoreRootSkill> primaryToRootMap = new HashMap<>();
@NotNull Map<CoreRootSkill, PrimarySkillType> rootToPrimaryMap = new HashMap<>();
boolean init = false;
protected void initMappings() {

View File

@ -9,7 +9,7 @@ import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
import com.gmail.nossr50.skills.archery.ArcheryManager;
import com.gmail.nossr50.skills.axes.AxesManager;
import com.gmail.nossr50.skills.crossbows.CrossbowManager;
import com.gmail.nossr50.skills.crossbows.CrossbowsManager;
import com.gmail.nossr50.skills.excavation.ExcavationManager;
import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
@ -19,7 +19,7 @@ import com.gmail.nossr50.skills.salvage.SalvageManager;
import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.skills.swords.SwordsManager;
import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.skills.tridents.TridentManager;
import com.gmail.nossr50.skills.tridents.TridentsManager;
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
import com.gmail.nossr50.util.Permissions;
@ -67,8 +67,8 @@ public enum PrimarySkillType {
ImmutableList.of(SubSkillType.UNARMED_BERSERK, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, SubSkillType.UNARMED_BLOCK_CRACKER, SubSkillType.UNARMED_ARROW_DEFLECT, SubSkillType.UNARMED_DISARM, SubSkillType.UNARMED_STEEL_ARM_STYLE, SubSkillType.UNARMED_IRON_GRIP)),
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, SuperAbilityType.TREE_FELLER,
ImmutableList.of(SubSkillType.WOODCUTTING_LEAF_BLOWER, SubSkillType.WOODCUTTING_TREE_FELLER, SubSkillType.WOODCUTTING_HARVEST_LUMBER, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)),
TRIDENTS(TridentManager.class, Color.TEAL, ImmutableList.of(SubSkillType.TRIDENTS_MULTI_TASKING, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)),
CROSSBOWS(CrossbowManager.class, Color.ORANGE, ImmutableList.of(SubSkillType.CROSSBOWS_SUPER_SHOTGUN, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK));
TRIDENTS(TridentsManager.class, Color.TEAL, ImmutableList.of(SubSkillType.TRIDENTS_MULTI_TASKING, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)),
CROSSBOWS(CrossbowsManager.class, Color.ORANGE, ImmutableList.of(SubSkillType.CROSSBOWS_SUPER_SHOTGUN, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK));
private final Class<? extends SkillManager> managerClass;
private final Color skillColor;

View File

@ -25,7 +25,8 @@ public class SkillRegisterImpl implements SkillRegister {
private final @NotNull Set<SuperSkill> superSkills;
private final @NotNull Set<RankedSkill> rankedSkills;
private final @NotNull Set<RootSkill> rootSkills; //Can include not-official root skills
private final @NotNull Set<RootSkill> coreRootSkills; //Only includes official root skills
private final @NotNull Set<CoreRootSkill> coreRootSkills; //Only includes official root skills
private final @NotNull Set<CoreSkill> coreSkills; //Only includes official core skills
public SkillRegisterImpl() {
skillNameMap = new HashMap<>();
@ -34,11 +35,21 @@ public class SkillRegisterImpl implements SkillRegister {
superSkills = new HashSet<>();
rankedSkills = new HashSet<>();
coreRootSkills = new HashSet<>();
coreSkills = new HashSet<>();
//TODO: allow config to turn off certain core skills
registerCoreSkills();
}
private void registerCoreSkills() {
for(CoreRootSkill coreRootSkill : CoreSkills.getCoreRootSkills()) {
mcMMO.p.getLogger().info("Registering core skill: " + coreRootSkill.getRawSkillName());
registerSkill(coreRootSkill);
}
for(CoreSkill coreSkill : CoreSkills.)
}
@Override
public @Nullable Skill getSkill(@NotNull String fullyQualifiedName) {
return skillNameMap.get(fullyQualifiedName);
@ -96,12 +107,24 @@ public class SkillRegisterImpl implements SkillRegister {
}
private void removeCollectionCache(@NotNull Skill skill) {
//Add to collections for cached lookups
//Remove from register cache(s)
if(skill instanceof CoreRootSkill) {
coreRootSkills.remove(skill);
}
if(skill instanceof CoreSkill) {
coreSkills.remove(skill);
}
if(skill instanceof RootSkill) {
rootSkills.remove(skill);
} else if (skill instanceof SuperSkill) {
}
if (skill instanceof SuperSkill) {
superSkills.remove(skill);
} else if(skill instanceof RankedSkill) {
}
if(skill instanceof RankedSkill) {
rankedSkills.remove( skill);
}
}
@ -117,15 +140,23 @@ public class SkillRegisterImpl implements SkillRegister {
private void addCollectionCache(@NotNull Skill skill) {
//Add to various collections for cached lookups
if(skill instanceof CoreSkill) {
coreSkills.add((CoreSkill) skill);
}
if(skill instanceof CoreRootSkill) {
coreRootSkills.add((CoreRootSkill) skill);
}
if(skill instanceof RootSkill) {
rootSkills.add((RootSkill) skill);
} else if (skill instanceof SuperSkill) {
}
if (skill instanceof SuperSkill) {
superSkills.add((SuperSkill) skill);
} else if(skill instanceof RankedSkill) {
}
if(skill instanceof RankedSkill) {
rankedSkills.add((RankedSkill) skill);
}
}
@ -144,15 +175,8 @@ public class SkillRegisterImpl implements SkillRegister {
postRemovalSkillRegisterProcessing(skill);
}
private void registerCoreSkills() {
for(RootSkill rootSkill : CoreSkills.getCoreSkills()) {
mcMMO.p.getLogger().info("Registering core skill: "+rootSkill.getSkillName());
registerSkill(rootSkill);
}
}
@Override
public @NotNull Set<RootSkill> getCoreRootSkills() {
public @NotNull Set<CoreRootSkill> getCoreRootSkills() {
return coreRootSkills;
}
@ -172,8 +196,8 @@ public class SkillRegisterImpl implements SkillRegister {
public @Nullable RootSkill matchRootSkill(@NotNull String skillName) {
for (RootSkill rootSkill : rootSkills) {
if (rootSkill.getSkillIdentity().getFullyQualifiedName().equalsIgnoreCase(skillName)
|| skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(rootSkill.getSkillName()) + ".SkillName"))
|| rootSkill.getSkillName().equalsIgnoreCase(skillName)) {
|| skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(rootSkill.getRawSkillName()) + ".SkillName"))
|| rootSkill.getRawSkillName().equalsIgnoreCase(skillName)) {
return rootSkill;
}
}

View File

@ -18,8 +18,8 @@ import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class CrossbowManager extends SkillManager {
public CrossbowManager(OnlineMMOPlayer mmoPlayer) {
public class CrossbowsManager extends SkillManager {
public CrossbowsManager(OnlineMMOPlayer mmoPlayer) {
super(mmoPlayer, PrimarySkillType.CROSSBOWS);
}
private static final int SPREAD_VALUE = 12;

View File

@ -4,8 +4,8 @@ import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.skills.SkillManager;
public class TridentManager extends SkillManager {
public TridentManager(OnlineMMOPlayer mmoPlayer) {
public class TridentsManager extends SkillManager {
public TridentsManager(OnlineMMOPlayer mmoPlayer) {
super(mmoPlayer, PrimarySkillType.TRIDENTS);
}

View File

@ -182,7 +182,7 @@ public class MMOExperienceBarManager {
}
public static void setBarStateDefaults(@NotNull Map<RootSkill, SkillBossBarState> barStateHashMap) {
for(RootSkill rootSkill : CoreSkills.getCoreSkills()) {
for(RootSkill rootSkill : CoreSkills.getCoreRootSkills()) {
if(CoreSkills.isChildSkill(rootSkill)) {
barStateHashMap.put(rootSkill, SkillBossBarState.DISABLED);

View File

@ -14,10 +14,10 @@ import com.gmail.nossr50.runnables.skills.AwardCombatXpTask;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.archery.ArcheryManager;
import com.gmail.nossr50.skills.axes.AxesManager;
import com.gmail.nossr50.skills.crossbows.CrossbowManager;
import com.gmail.nossr50.skills.crossbows.CrossbowsManager;
import com.gmail.nossr50.skills.swords.SwordsManager;
import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.skills.tridents.TridentManager;
import com.gmail.nossr50.skills.tridents.TridentsManager;
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.compat.layers.persistentdata.AbstractPersistentDataLayer;
@ -131,7 +131,7 @@ public final class CombatUtils {
return;
}
TridentManager tridentManager = ((McMMOPlayer) (mmoPlayer)).getTridentManager();
TridentsManager tridentsManager = ((McMMOPlayer) (mmoPlayer)).getTridentManager();
// double initialDamage = entityDamageByEntityEvent.getDamage();
// double finalDamage = initialDamage;
@ -340,7 +340,7 @@ public final class CombatUtils {
return;
}
CrossbowManager crossbowManager = ((McMMOPlayer) (mmoPlayer)).getCrossbowManager();
CrossbowsManager crossbowsManager = ((McMMOPlayer) (mmoPlayer)).getCrossbowManager();
double finalDamage = event.getDamage();
@ -361,7 +361,7 @@ public final class CombatUtils {
finalDamage+=getLimitBreakDamage(mmoPlayer, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK);
}
double distanceMultiplier = crossbowManager.distanceXpBonusMultiplier(target, arrow);
double distanceMultiplier = crossbowsManager.distanceXpBonusMultiplier(target, arrow);
applyScaledModifiers(initialDamage, finalDamage, event);