mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-28 08:06:46 +01:00
Gutting out new Skill API and putting it on hold
This commit is contained in:
parent
31904ef181
commit
a6276bded8
@ -1,341 +1,341 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills;
|
//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 org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class CoreSkills {
|
|
||||||
|
|
||||||
//TODO: Should these be immutable?
|
|
||||||
private static final @NotNull ImmutableSet<CoreRootSkill> CORE_ROOT_SKILLS;
|
|
||||||
private static final @NotNull ImmutableSet<CoreRootSkill> CORE_CHILD_SKILLS;
|
|
||||||
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 @NotNull CoreSkill
|
|
||||||
// /* Acrobatics */
|
|
||||||
// DODGE, ROLL,
|
|
||||||
//
|
//
|
||||||
// /* Alchemy */
|
//import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||||
// CATALYSIS, CONCOCTIONS,
|
//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 org.jetbrains.annotations.Nullable;
|
||||||
//
|
//
|
||||||
// /* Archery */
|
//import java.util.HashMap;
|
||||||
// ARROW_RETRIEVAL, DAZE, SKILLSHOT, LIMIT_BREAK_ARCHERY,
|
//import java.util.HashSet;
|
||||||
|
//import java.util.Map;
|
||||||
|
//import java.util.Set;
|
||||||
|
//import java.util.stream.Collectors;
|
||||||
//
|
//
|
||||||
// /* Axes */
|
//public class CoreSkills {
|
||||||
// ARMOR_IMPACT, AXE_MASTERY, LIMIT_BREAK_AXES, CRITICAL_STRIKES, GREATER_IMPACT, SKULL_SPLITTER,
|
|
||||||
//
|
//
|
||||||
// /* Excavation */
|
// //TODO: Should these be immutable?
|
||||||
// ARCHAEOLOGY, GIGA_DRILL_BREAKER,
|
// private static final @NotNull ImmutableSet<CoreRootSkill> CORE_ROOT_SKILLS;
|
||||||
|
// private static final @NotNull ImmutableSet<CoreRootSkill> CORE_CHILD_SKILLS;
|
||||||
|
// 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;
|
||||||
//
|
//
|
||||||
// /* Fishing */
|
// //TODO: Use annotations instead
|
||||||
// FISHERMANS_DIET, ICE_FISHING, MAGIC_HUNTER, MASTER_ANGLER, TREASURE_HUNTER, SHAKE,
|
// public static final @NotNull CoreRootSkill ACROBATICS, ALCHEMY, ARCHERY, AXES, EXCAVATION,
|
||||||
|
// FISHING, HERBALISM, MINING, REPAIR, SALVAGE, SMELTING, SWORDS, TAMING, UNARMED,
|
||||||
|
// WOODCUTTING, TRIDENTS, CROSSBOWS;
|
||||||
//
|
//
|
||||||
// /* Herbalism */
|
// //TODO: Needed?
|
||||||
// DOUBLE_DROPS_HERBALISM, FARMERS_DIET, GREEN_TERRA, GREEN_THUMB, HYLIAN_LUCK, SHROOM_THUMB,
|
// 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;
|
||||||
//
|
//
|
||||||
// /* Mining */
|
//// public static final @NotNull SuperSkill SKULL_SPLITTER, GIGA_DRILL_BREAKER, GREEN_TERRA, SUPER_BREAKER,
|
||||||
// BIGGER_BOMBS, BLAST_MINING, DEMOLITIONS_EXPERTISE, DOUBLE_DROPS, SUPER_BREAKER,
|
//// BLAST_MINING, SERRATED_STRIKES, CALL_OF_THE_WILD, BERSERK, TREE_FELLER, TRIDENTS_SUPER, SUPER_SHOT_GUN;
|
||||||
//
|
//
|
||||||
// /* Repair */
|
//// public static @NotNull CoreSkill
|
||||||
// ARCANE_FORGING, REPAIR_MASTERY, SUPER_REPAIR,
|
//// /* Acrobatics */
|
||||||
|
//// DODGE, ROLL,
|
||||||
|
////
|
||||||
|
//// /* Alchemy */
|
||||||
|
//// CATALYSIS, CONCOCTIONS,
|
||||||
|
////
|
||||||
|
//// /* Archery */
|
||||||
|
//// ARROW_RETRIEVAL, DAZE, SKILLSHOT, LIMIT_BREAK_ARCHERY,
|
||||||
|
////
|
||||||
|
//// /* Axes */
|
||||||
|
//// ARMOR_IMPACT, AXE_MASTERY, LIMIT_BREAK_AXES, CRITICAL_STRIKES, GREATER_IMPACT, SKULL_SPLITTER,
|
||||||
|
////
|
||||||
|
//// /* Excavation */
|
||||||
|
//// ARCHAEOLOGY, GIGA_DRILL_BREAKER,
|
||||||
|
////
|
||||||
|
//// /* Fishing */
|
||||||
|
//// FISHERMANS_DIET, ICE_FISHING, MAGIC_HUNTER, MASTER_ANGLER, TREASURE_HUNTER, SHAKE,
|
||||||
|
////
|
||||||
|
//// /* Herbalism */
|
||||||
|
//// DOUBLE_DROPS_HERBALISM, FARMERS_DIET, GREEN_TERRA, GREEN_THUMB, HYLIAN_LUCK, SHROOM_THUMB,
|
||||||
|
////
|
||||||
|
//// /* Mining */
|
||||||
|
//// BIGGER_BOMBS, BLAST_MINING, DEMOLITIONS_EXPERTISE, DOUBLE_DROPS, SUPER_BREAKER,
|
||||||
|
////
|
||||||
|
//// /* Repair */
|
||||||
|
//// ARCANE_FORGING, REPAIR_MASTERY, SUPER_REPAIR,
|
||||||
|
////
|
||||||
|
//// /* Salvage */
|
||||||
|
//// SCRAP_COLLECTOR, ARCANE_SALVAGE,
|
||||||
|
////
|
||||||
|
//// /* Smelting */
|
||||||
|
//// FUEL_EFFICIENCY, SECOND_SMELT, UNDERSTANDING_THE_ART,
|
||||||
|
////
|
||||||
|
//// /* Swords */
|
||||||
|
//// COUNTER_ATTACK, RUPTURE, SERRATED_STRIKES, STAB, LIMIT_BREAK_SWORDS,
|
||||||
|
////
|
||||||
|
//// /* Taming */
|
||||||
|
//// BEAST_LORE, CALL_OF_THE_WILD, ENVIRONMENTALLY_AWARE, FAST_FOOD_SERVICE, GORE, HOLY_HOUND, PUMMEL, SHARPENED_CLAWS, SHOCK_PROOF, THICK_FUR,
|
||||||
|
////
|
||||||
|
//// /* Archery */
|
||||||
|
//// ARROW_DEFLECT, BERSERK, BLOCK_CRACKER, DISARM, STEEL_ARM_STYLE, IRON_GRIP, LIMIT_BREAK_UNARMED,
|
||||||
|
////
|
||||||
|
//// /* Woodcutting */
|
||||||
|
//// KNOCK_ON_WOOD, HARVEST_LUMBER, LEAF_BLOWER, TREE_FELLER,
|
||||||
|
////
|
||||||
|
//// /* Tridents */
|
||||||
|
//// MULTI_TASKING, LIMIT_BREAK_TRIDENTS,
|
||||||
|
////
|
||||||
|
//// /* Crossbows */
|
||||||
|
//// SUPER_SHOTGUN, LIMIT_BREAK_CROSSBOWS;
|
||||||
//
|
//
|
||||||
// /* Salvage */
|
// private static final @NotNull HackySkillMappings hackySkillMappings = new HackySkillMappings();
|
||||||
// SCRAP_COLLECTOR, ARCANE_SALVAGE,
|
|
||||||
//
|
//
|
||||||
// /* Smelting */
|
// static {
|
||||||
// FUEL_EFFICIENCY, SECOND_SMELT, UNDERSTANDING_THE_ART,
|
// HashSet<CoreRootSkill> rootSkillSet = new HashSet<>();
|
||||||
|
// HashSet<CoreRootSkill> childSkillSet = new HashSet<>();
|
||||||
|
// HashSet<CoreSkill> subSkillSet = new HashSet<>();
|
||||||
|
// HashSet<SuperSkill> superSkillSet = new HashSet<>();
|
||||||
//
|
//
|
||||||
// /* Swords */
|
// ACROBATICS = new CoreRootSkill("acrobatics", AcrobaticsManager.class);
|
||||||
// COUNTER_ATTACK, RUPTURE, SERRATED_STRIKES, STAB, LIMIT_BREAK_SWORDS,
|
// ACROBATICS_ID = ACROBATICS.getSkillIdentity();
|
||||||
//
|
//
|
||||||
// /* Taming */
|
// ALCHEMY = new CoreRootSkill("alchemy", AlchemyManager.class);
|
||||||
// BEAST_LORE, CALL_OF_THE_WILD, ENVIRONMENTALLY_AWARE, FAST_FOOD_SERVICE, GORE, HOLY_HOUND, PUMMEL, SHARPENED_CLAWS, SHOCK_PROOF, THICK_FUR,
|
// ALCHEMY_ID = ALCHEMY.getSkillIdentity();
|
||||||
//
|
//
|
||||||
// /* Archery */
|
// ARCHERY = new CoreRootSkill("archery", ArcheryManager.class);
|
||||||
// ARROW_DEFLECT, BERSERK, BLOCK_CRACKER, DISARM, STEEL_ARM_STYLE, IRON_GRIP, LIMIT_BREAK_UNARMED,
|
// ARCHERY_ID = ARCHERY.getSkillIdentity();
|
||||||
//
|
//
|
||||||
// /* Woodcutting */
|
// AXES = new CoreRootSkill("axes", AxesManager.class);
|
||||||
// KNOCK_ON_WOOD, HARVEST_LUMBER, LEAF_BLOWER, TREE_FELLER,
|
// AXES_ID = AXES.getSkillIdentity();
|
||||||
//
|
//
|
||||||
// /* Tridents */
|
// EXCAVATION = new CoreRootSkill("excavation", ExcavationManager.class);
|
||||||
// MULTI_TASKING, LIMIT_BREAK_TRIDENTS,
|
// EXCAVATION_ID = EXCAVATION.getSkillIdentity();
|
||||||
//
|
//
|
||||||
// /* Crossbows */
|
// FISHING = new CoreRootSkill("fishing", FishingManager.class);
|
||||||
// SUPER_SHOTGUN, LIMIT_BREAK_CROSSBOWS;
|
// FISHING_ID = FISHING.getSkillIdentity();
|
||||||
|
//
|
||||||
private static final @NotNull HackySkillMappings hackySkillMappings = new HackySkillMappings();
|
// HERBALISM = new CoreRootSkill("herbalism", HerbalismManager.class);
|
||||||
|
// HERBALISM_ID = HERBALISM.getSkillIdentity();
|
||||||
static {
|
//
|
||||||
HashSet<CoreRootSkill> rootSkillSet = new HashSet<>();
|
// MINING = new CoreRootSkill("mining", MiningManager.class);
|
||||||
HashSet<CoreRootSkill> childSkillSet = new HashSet<>();
|
// MINING_ID = MINING.getSkillIdentity();
|
||||||
HashSet<CoreSkill> subSkillSet = new HashSet<>();
|
//
|
||||||
HashSet<SuperSkill> superSkillSet = new HashSet<>();
|
// REPAIR = new CoreRootSkill("repair", RepairManager.class);
|
||||||
|
// REPAIR_ID = REPAIR.getSkillIdentity();
|
||||||
ACROBATICS = new CoreRootSkill("acrobatics", AcrobaticsManager.class);
|
//
|
||||||
ACROBATICS_ID = ACROBATICS.getSkillIdentity();
|
// SALVAGE = new CoreRootSkill("salvage", SalvageManager.class);
|
||||||
|
// SALVAGE_ID = SALVAGE.getSkillIdentity();
|
||||||
ALCHEMY = new CoreRootSkill("alchemy", AlchemyManager.class);
|
//
|
||||||
ALCHEMY_ID = ALCHEMY.getSkillIdentity();
|
// SMELTING = new CoreRootSkill("smelting", SmeltingManager.class);
|
||||||
|
// SMELTING_ID = SMELTING.getSkillIdentity();
|
||||||
ARCHERY = new CoreRootSkill("archery", ArcheryManager.class);
|
//
|
||||||
ARCHERY_ID = ARCHERY.getSkillIdentity();
|
// SWORDS = new CoreRootSkill("swords", SwordsManager.class);
|
||||||
|
// SWORDS_ID = SWORDS.getSkillIdentity();
|
||||||
AXES = new CoreRootSkill("axes", AxesManager.class);
|
//
|
||||||
AXES_ID = AXES.getSkillIdentity();
|
// TAMING = new CoreRootSkill("taming", TamingManager.class);
|
||||||
|
// TAMING_ID = TAMING.getSkillIdentity();
|
||||||
EXCAVATION = new CoreRootSkill("excavation", ExcavationManager.class);
|
//
|
||||||
EXCAVATION_ID = EXCAVATION.getSkillIdentity();
|
// UNARMED = new CoreRootSkill("unarmed", UnarmedManager.class);
|
||||||
|
// UNARMED_ID = UNARMED.getSkillIdentity();
|
||||||
FISHING = new CoreRootSkill("fishing", FishingManager.class);
|
//
|
||||||
FISHING_ID = FISHING.getSkillIdentity();
|
// WOODCUTTING = new CoreRootSkill("woodcutting", WoodcuttingManager.class);
|
||||||
|
// WOODCUTTING_ID = WOODCUTTING.getSkillIdentity();
|
||||||
HERBALISM = new CoreRootSkill("herbalism", HerbalismManager.class);
|
//
|
||||||
HERBALISM_ID = HERBALISM.getSkillIdentity();
|
// TRIDENTS = new CoreRootSkill("tridents", TridentsManager.class);
|
||||||
|
// TRIDENTS_ID = TRIDENTS.getSkillIdentity();
|
||||||
MINING = new CoreRootSkill("mining", MiningManager.class);
|
//
|
||||||
MINING_ID = MINING.getSkillIdentity();
|
// CROSSBOWS = new CoreRootSkill("crossbows", CrossbowsManager.class);
|
||||||
|
// CROSSBOWS_ID = CROSSBOWS.getSkillIdentity();
|
||||||
REPAIR = new CoreRootSkill("repair", RepairManager.class);
|
//
|
||||||
REPAIR_ID = REPAIR.getSkillIdentity();
|
// //Child skills (soon to be removed)
|
||||||
|
// childSkillSet.add(SMELTING);
|
||||||
SALVAGE = new CoreRootSkill("salvage", SalvageManager.class);
|
// childSkillSet.add(SALVAGE);
|
||||||
SALVAGE_ID = SALVAGE.getSkillIdentity();
|
//
|
||||||
|
// rootSkillSet.add(ACROBATICS);
|
||||||
SMELTING = new CoreRootSkill("smelting", SmeltingManager.class);
|
// rootSkillSet.add(ALCHEMY);
|
||||||
SMELTING_ID = SMELTING.getSkillIdentity();
|
// rootSkillSet.add(ARCHERY);
|
||||||
|
// rootSkillSet.add(AXES);
|
||||||
SWORDS = new CoreRootSkill("swords", SwordsManager.class);
|
// rootSkillSet.add(EXCAVATION);
|
||||||
SWORDS_ID = SWORDS.getSkillIdentity();
|
// rootSkillSet.add(FISHING);
|
||||||
|
// rootSkillSet.add(HERBALISM);
|
||||||
TAMING = new CoreRootSkill("taming", TamingManager.class);
|
// rootSkillSet.add(MINING);
|
||||||
TAMING_ID = TAMING.getSkillIdentity();
|
// rootSkillSet.add(REPAIR);
|
||||||
|
// rootSkillSet.add(SALVAGE);
|
||||||
UNARMED = new CoreRootSkill("unarmed", UnarmedManager.class);
|
// rootSkillSet.add(SMELTING);
|
||||||
UNARMED_ID = UNARMED.getSkillIdentity();
|
// rootSkillSet.add(SWORDS);
|
||||||
|
// rootSkillSet.add(TAMING);
|
||||||
WOODCUTTING = new CoreRootSkill("woodcutting", WoodcuttingManager.class);
|
// rootSkillSet.add(UNARMED);
|
||||||
WOODCUTTING_ID = WOODCUTTING.getSkillIdentity();
|
// rootSkillSet.add(WOODCUTTING);
|
||||||
|
// rootSkillSet.add(TRIDENTS);
|
||||||
TRIDENTS = new CoreRootSkill("tridents", TridentsManager.class);
|
// rootSkillSet.add(CROSSBOWS);
|
||||||
TRIDENTS_ID = TRIDENTS.getSkillIdentity();
|
//
|
||||||
|
// CORE_ROOT_SKILLS = ImmutableSet.copyOf(rootSkillSet);
|
||||||
CROSSBOWS = new CoreRootSkill("crossbows", CrossbowsManager.class);
|
// CORE_CHILD_SKILLS = ImmutableSet.copyOf(childSkillSet);
|
||||||
CROSSBOWS_ID = CROSSBOWS.getSkillIdentity();
|
// CORE_NON_CHILD_SKILLS = ImmutableSet.copyOf(generateNonChildSkillSet());
|
||||||
|
// CORE_SUB_SKILLS = ImmutableSet.copyOf(subSkillSet);
|
||||||
//Child skills (soon to be removed)
|
// CORE_SUPER_SKILLS = ImmutableSet.copyOf(superSkillSet);
|
||||||
childSkillSet.add(SMELTING);
|
//
|
||||||
childSkillSet.add(SALVAGE);
|
// /*
|
||||||
|
// * Init core skills
|
||||||
rootSkillSet.add(ACROBATICS);
|
// */
|
||||||
rootSkillSet.add(ALCHEMY);
|
//
|
||||||
rootSkillSet.add(ARCHERY);
|
//
|
||||||
rootSkillSet.add(AXES);
|
// }
|
||||||
rootSkillSet.add(EXCAVATION);
|
//
|
||||||
rootSkillSet.add(FISHING);
|
// /**
|
||||||
rootSkillSet.add(HERBALISM);
|
// * Returns a set of built in {@link RootSkill}s for mcMMO
|
||||||
rootSkillSet.add(MINING);
|
// * No guarantees for whether or not the skills are registered or active or inactive
|
||||||
rootSkillSet.add(REPAIR);
|
// *
|
||||||
rootSkillSet.add(SALVAGE);
|
// * @return a set of all {@link RootSkill} built into mcMMO
|
||||||
rootSkillSet.add(SMELTING);
|
// */
|
||||||
rootSkillSet.add(SWORDS);
|
// public static @NotNull Set<CoreRootSkill> getCoreRootSkills() {
|
||||||
rootSkillSet.add(TAMING);
|
// return CORE_ROOT_SKILLS;
|
||||||
rootSkillSet.add(UNARMED);
|
// }
|
||||||
rootSkillSet.add(WOODCUTTING);
|
//
|
||||||
rootSkillSet.add(TRIDENTS);
|
// /**
|
||||||
rootSkillSet.add(CROSSBOWS);
|
// * Returns a set of built in {@link CoreSkill}s for mcMMO
|
||||||
|
// * No guarantees for whether or not the skills are registered or active or inactive
|
||||||
CORE_ROOT_SKILLS = ImmutableSet.copyOf(rootSkillSet);
|
// *
|
||||||
CORE_CHILD_SKILLS = ImmutableSet.copyOf(childSkillSet);
|
// * @return a set of all {@link CoreSkill} built into mcMMO
|
||||||
CORE_NON_CHILD_SKILLS = ImmutableSet.copyOf(generateNonChildSkillSet());
|
// */
|
||||||
CORE_SUB_SKILLS = ImmutableSet.copyOf(subSkillSet);
|
// public static @NotNull Set<CoreSkill> getCoreSkills() {
|
||||||
CORE_SUPER_SKILLS = ImmutableSet.copyOf(superSkillSet);
|
// return CORE_SUB_SKILLS;
|
||||||
|
// }
|
||||||
/*
|
//
|
||||||
* Init core skills
|
// /**
|
||||||
*/
|
// * Returns a set of built in {@link SuperSkill}s for mcMMO
|
||||||
|
// * No guarantees for whether or not the skills are registered or active or inactive
|
||||||
|
// *
|
||||||
}
|
// * @return a set of all {@link SuperSkill} built into mcMMO
|
||||||
|
// */
|
||||||
/**
|
// public static @NotNull Set<SuperSkill> getCoreSuperSkills() {
|
||||||
* Returns a set of built in {@link RootSkill}s for mcMMO
|
// return CORE_SUPER_SKILLS;
|
||||||
* No guarantees for whether or not the skills are registered or active or inactive
|
// }
|
||||||
*
|
//
|
||||||
* @return a set of all {@link RootSkill} built into mcMMO
|
// /**
|
||||||
*/
|
// * Returns a set of built in skills for mcMMO which are child skills
|
||||||
public static @NotNull Set<CoreRootSkill> getCoreRootSkills() {
|
// * No guarantees for whether or not the skills are registered or active or inactive
|
||||||
return CORE_ROOT_SKILLS;
|
// *
|
||||||
}
|
// * @return a set of all "child" root skills for mcMMO
|
||||||
|
// * @deprecated child skills will be removed in an upcoming update
|
||||||
/**
|
// */
|
||||||
* Returns a set of built in {@link CoreSkill}s for mcMMO
|
// @Deprecated
|
||||||
* No guarantees for whether or not the skills are registered or active or inactive
|
// public static @NotNull Set<CoreRootSkill> getChildSkills() {
|
||||||
*
|
// return CORE_CHILD_SKILLS;
|
||||||
* @return a set of all {@link CoreSkill} built into mcMMO
|
// }
|
||||||
*/
|
//
|
||||||
public static @NotNull Set<CoreSkill> getCoreSkills() {
|
// /**
|
||||||
return CORE_SUB_SKILLS;
|
// * Whether or not a skill is considered a child skill
|
||||||
}
|
// * @param rootSkill target skill
|
||||||
|
// * @return true if the skill identity belongs to a core "child" root skill
|
||||||
/**
|
// */
|
||||||
* Returns a set of built in {@link SuperSkill}s for mcMMO
|
// public static boolean isChildSkill(@NotNull RootSkill rootSkill) {
|
||||||
* No guarantees for whether or not the skills are registered or active or inactive
|
// return CORE_CHILD_SKILLS.contains(rootSkill);
|
||||||
*
|
// }
|
||||||
* @return a set of all {@link SuperSkill} built into mcMMO
|
//
|
||||||
*/
|
// @Deprecated
|
||||||
public static @NotNull Set<SuperSkill> getCoreSuperSkills() {
|
// public static @NotNull RootSkill getSkill(@NotNull PrimarySkillType primarySkillType) {
|
||||||
return CORE_SUPER_SKILLS;
|
// if(!hackySkillMappings.init) {
|
||||||
}
|
// hackySkillMappings.initMappings();
|
||||||
|
// }
|
||||||
/**
|
//
|
||||||
* Returns a set of built in skills for mcMMO which are child skills
|
// return hackySkillMappings.primaryToRootMap.get(primarySkillType);
|
||||||
* No guarantees for whether or not the skills are registered or active or inactive
|
// }
|
||||||
*
|
//
|
||||||
* @return a set of all "child" root skills for mcMMO
|
// @Deprecated
|
||||||
* @deprecated child skills will be removed in an upcoming update
|
// public static @NotNull PrimarySkillType getSkill(@NotNull RootSkill rootSkill) {
|
||||||
*/
|
// if(!hackySkillMappings.init) {
|
||||||
@Deprecated
|
// hackySkillMappings.initMappings();
|
||||||
public static @NotNull Set<CoreRootSkill> getChildSkills() {
|
// }
|
||||||
return CORE_CHILD_SKILLS;
|
//
|
||||||
}
|
// return hackySkillMappings.rootToPrimaryMap.get(rootSkill);
|
||||||
|
// }
|
||||||
/**
|
//
|
||||||
* Whether or not a skill is considered a child skill
|
// @Deprecated
|
||||||
* @param rootSkill target skill
|
// private static @NotNull Set<CoreRootSkill> generateNonChildSkillSet() {
|
||||||
* @return true if the skill identity belongs to a core "child" root skill
|
// return getCoreRootSkills().stream().filter((x) -> !isChildSkill(x)).collect(Collectors.toSet());
|
||||||
*/
|
// }
|
||||||
public static boolean isChildSkill(@NotNull RootSkill rootSkill) {
|
//
|
||||||
return CORE_CHILD_SKILLS.contains(rootSkill);
|
// public static @NotNull Set<CoreRootSkill> getNonChildSkills() {
|
||||||
}
|
// return CORE_NON_CHILD_SKILLS;
|
||||||
|
// }
|
||||||
@Deprecated
|
//
|
||||||
public static @NotNull RootSkill getSkill(@NotNull PrimarySkillType primarySkillType) {
|
// protected static class HackySkillMappings {
|
||||||
if(!hackySkillMappings.init) {
|
// @NotNull Map<PrimarySkillType, CoreRootSkill> primaryToRootMap = new HashMap<>();
|
||||||
hackySkillMappings.initMappings();
|
// @NotNull Map<CoreRootSkill, PrimarySkillType> rootToPrimaryMap = new HashMap<>();
|
||||||
}
|
// boolean init = false;
|
||||||
|
//
|
||||||
return hackySkillMappings.primaryToRootMap.get(primarySkillType);
|
// protected void initMappings() {
|
||||||
}
|
// //TODO: add tests
|
||||||
|
// //Can't init these from the get go as PrimarySkillType does some stuff and it would be race condition hell
|
||||||
@Deprecated
|
// primaryToRootMap.put(PrimarySkillType.ACROBATICS, ACROBATICS);
|
||||||
public static @NotNull PrimarySkillType getSkill(@NotNull RootSkill rootSkill) {
|
// rootToPrimaryMap.put(ACROBATICS, PrimarySkillType.ACROBATICS);
|
||||||
if(!hackySkillMappings.init) {
|
//
|
||||||
hackySkillMappings.initMappings();
|
// primaryToRootMap.put(PrimarySkillType.ALCHEMY, ALCHEMY);
|
||||||
}
|
// rootToPrimaryMap.put(ALCHEMY, PrimarySkillType.ALCHEMY);
|
||||||
|
//
|
||||||
return hackySkillMappings.rootToPrimaryMap.get(rootSkill);
|
// primaryToRootMap.put(PrimarySkillType.ARCHERY, ARCHERY);
|
||||||
}
|
// rootToPrimaryMap.put(ARCHERY, PrimarySkillType.ARCHERY);
|
||||||
|
//
|
||||||
@Deprecated
|
// primaryToRootMap.put(PrimarySkillType.AXES, AXES);
|
||||||
private static @NotNull Set<CoreRootSkill> generateNonChildSkillSet() {
|
// rootToPrimaryMap.put(AXES, PrimarySkillType.AXES);
|
||||||
return getCoreRootSkills().stream().filter((x) -> !isChildSkill(x)).collect(Collectors.toSet());
|
//
|
||||||
}
|
// primaryToRootMap.put(PrimarySkillType.EXCAVATION, EXCAVATION);
|
||||||
|
// rootToPrimaryMap.put(EXCAVATION, PrimarySkillType.EXCAVATION);
|
||||||
public static @NotNull Set<CoreRootSkill> getNonChildSkills() {
|
//
|
||||||
return CORE_NON_CHILD_SKILLS;
|
// primaryToRootMap.put(PrimarySkillType.FISHING, FISHING);
|
||||||
}
|
// rootToPrimaryMap.put(FISHING, PrimarySkillType.FISHING);
|
||||||
|
//
|
||||||
protected static class HackySkillMappings {
|
// primaryToRootMap.put(PrimarySkillType.HERBALISM, HERBALISM);
|
||||||
@NotNull Map<PrimarySkillType, CoreRootSkill> primaryToRootMap = new HashMap<>();
|
// rootToPrimaryMap.put(HERBALISM, PrimarySkillType.HERBALISM);
|
||||||
@NotNull Map<CoreRootSkill, PrimarySkillType> rootToPrimaryMap = new HashMap<>();
|
//
|
||||||
boolean init = false;
|
// primaryToRootMap.put(PrimarySkillType.MINING, MINING);
|
||||||
|
// rootToPrimaryMap.put(MINING, PrimarySkillType.MINING);
|
||||||
protected void initMappings() {
|
//
|
||||||
//TODO: add tests
|
// primaryToRootMap.put(PrimarySkillType.REPAIR, REPAIR);
|
||||||
//Can't init these from the get go as PrimarySkillType does some stuff and it would be race condition hell
|
// rootToPrimaryMap.put(REPAIR, PrimarySkillType.REPAIR);
|
||||||
primaryToRootMap.put(PrimarySkillType.ACROBATICS, ACROBATICS);
|
//
|
||||||
rootToPrimaryMap.put(ACROBATICS, PrimarySkillType.ACROBATICS);
|
// primaryToRootMap.put(PrimarySkillType.SALVAGE, SALVAGE);
|
||||||
|
// rootToPrimaryMap.put(SALVAGE, PrimarySkillType.SALVAGE);
|
||||||
primaryToRootMap.put(PrimarySkillType.ALCHEMY, ALCHEMY);
|
//
|
||||||
rootToPrimaryMap.put(ALCHEMY, PrimarySkillType.ALCHEMY);
|
// primaryToRootMap.put(PrimarySkillType.SMELTING, SMELTING);
|
||||||
|
// rootToPrimaryMap.put(SMELTING, PrimarySkillType.SMELTING);
|
||||||
primaryToRootMap.put(PrimarySkillType.ARCHERY, ARCHERY);
|
//
|
||||||
rootToPrimaryMap.put(ARCHERY, PrimarySkillType.ARCHERY);
|
// primaryToRootMap.put(PrimarySkillType.SWORDS, SWORDS);
|
||||||
|
// rootToPrimaryMap.put(SWORDS, PrimarySkillType.SWORDS);
|
||||||
primaryToRootMap.put(PrimarySkillType.AXES, AXES);
|
//
|
||||||
rootToPrimaryMap.put(AXES, PrimarySkillType.AXES);
|
// primaryToRootMap.put(PrimarySkillType.TAMING, TAMING);
|
||||||
|
// rootToPrimaryMap.put(TAMING, PrimarySkillType.TAMING);
|
||||||
primaryToRootMap.put(PrimarySkillType.EXCAVATION, EXCAVATION);
|
//
|
||||||
rootToPrimaryMap.put(EXCAVATION, PrimarySkillType.EXCAVATION);
|
// primaryToRootMap.put(PrimarySkillType.UNARMED, UNARMED);
|
||||||
|
// rootToPrimaryMap.put(UNARMED, PrimarySkillType.UNARMED);
|
||||||
primaryToRootMap.put(PrimarySkillType.FISHING, FISHING);
|
//
|
||||||
rootToPrimaryMap.put(FISHING, PrimarySkillType.FISHING);
|
// primaryToRootMap.put(PrimarySkillType.WOODCUTTING, WOODCUTTING);
|
||||||
|
// rootToPrimaryMap.put(WOODCUTTING, PrimarySkillType.WOODCUTTING);
|
||||||
primaryToRootMap.put(PrimarySkillType.HERBALISM, HERBALISM);
|
//
|
||||||
rootToPrimaryMap.put(HERBALISM, PrimarySkillType.HERBALISM);
|
// primaryToRootMap.put(PrimarySkillType.TRIDENTS, TRIDENTS);
|
||||||
|
// rootToPrimaryMap.put(TRIDENTS, PrimarySkillType.TRIDENTS);
|
||||||
primaryToRootMap.put(PrimarySkillType.MINING, MINING);
|
//
|
||||||
rootToPrimaryMap.put(MINING, PrimarySkillType.MINING);
|
// primaryToRootMap.put(PrimarySkillType.CROSSBOWS, CROSSBOWS);
|
||||||
|
// rootToPrimaryMap.put(CROSSBOWS, PrimarySkillType.CROSSBOWS);
|
||||||
primaryToRootMap.put(PrimarySkillType.REPAIR, REPAIR);
|
//
|
||||||
rootToPrimaryMap.put(REPAIR, PrimarySkillType.REPAIR);
|
// init = true;
|
||||||
|
// }
|
||||||
primaryToRootMap.put(PrimarySkillType.SALVAGE, SALVAGE);
|
// }
|
||||||
rootToPrimaryMap.put(SALVAGE, PrimarySkillType.SALVAGE);
|
//}
|
||||||
|
|
||||||
primaryToRootMap.put(PrimarySkillType.SMELTING, SMELTING);
|
|
||||||
rootToPrimaryMap.put(SMELTING, PrimarySkillType.SMELTING);
|
|
||||||
|
|
||||||
primaryToRootMap.put(PrimarySkillType.SWORDS, SWORDS);
|
|
||||||
rootToPrimaryMap.put(SWORDS, PrimarySkillType.SWORDS);
|
|
||||||
|
|
||||||
primaryToRootMap.put(PrimarySkillType.TAMING, TAMING);
|
|
||||||
rootToPrimaryMap.put(TAMING, PrimarySkillType.TAMING);
|
|
||||||
|
|
||||||
primaryToRootMap.put(PrimarySkillType.UNARMED, UNARMED);
|
|
||||||
rootToPrimaryMap.put(UNARMED, PrimarySkillType.UNARMED);
|
|
||||||
|
|
||||||
primaryToRootMap.put(PrimarySkillType.WOODCUTTING, WOODCUTTING);
|
|
||||||
rootToPrimaryMap.put(WOODCUTTING, PrimarySkillType.WOODCUTTING);
|
|
||||||
|
|
||||||
primaryToRootMap.put(PrimarySkillType.TRIDENTS, TRIDENTS);
|
|
||||||
rootToPrimaryMap.put(TRIDENTS, PrimarySkillType.TRIDENTS);
|
|
||||||
|
|
||||||
primaryToRootMap.put(PrimarySkillType.CROSSBOWS, CROSSBOWS);
|
|
||||||
rootToPrimaryMap.put(CROSSBOWS, PrimarySkillType.CROSSBOWS);
|
|
||||||
|
|
||||||
init = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,207 +1,207 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills;
|
//package com.gmail.nossr50.datatypes.skills;
|
||||||
|
//
|
||||||
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.text.StringUtils;
|
//import com.gmail.nossr50.util.text.StringUtils;
|
||||||
import com.neetgames.mcmmo.api.SkillRegister;
|
//import com.neetgames.mcmmo.api.SkillRegister;
|
||||||
import com.neetgames.mcmmo.skill.*;
|
//import com.neetgames.mcmmo.skill.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
//import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
//import org.jetbrains.annotations.Nullable;
|
||||||
|
//
|
||||||
import java.util.HashMap;
|
//import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
//import java.util.HashSet;
|
||||||
import java.util.Set;
|
//import java.util.Set;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Skills mcMMO is aware of are registered here
|
// * Skills mcMMO is aware of are registered here
|
||||||
* The skill register will be used for a few things in mcMMO
|
// * The skill register will be used for a few things in mcMMO
|
||||||
* Removing a skill from the register doesn't mean it isn't doing anything as the register is simply for mcMMO's own awareness
|
// * Removing a skill from the register doesn't mean it isn't doing anything as the register is simply for mcMMO's own awareness
|
||||||
* When a player uses certain commands, such as checking their skill levels, if the skill isn't registered it won't be added to the resulting output of that command
|
// * When a player uses certain commands, such as checking their skill levels, if the skill isn't registered it won't be added to the resulting output of that command
|
||||||
*/
|
// */
|
||||||
public class SkillRegisterImpl implements SkillRegister {
|
//public class SkillRegisterImpl implements SkillRegister {
|
||||||
//TODO: Move maps and collections to their own container
|
// //TODO: Move maps and collections to their own container
|
||||||
private final @NotNull HashMap<String, Skill> skillNameMap;
|
// private final @NotNull HashMap<String, Skill> skillNameMap;
|
||||||
private final @NotNull Set<Skill> registeredSkills;
|
// private final @NotNull Set<Skill> registeredSkills;
|
||||||
private final @NotNull Set<SuperSkill> superSkills;
|
// private final @NotNull Set<SuperSkill> superSkills;
|
||||||
private final @NotNull Set<RankedSkill> rankedSkills;
|
// private final @NotNull Set<RankedSkill> rankedSkills;
|
||||||
private final @NotNull Set<RootSkill> rootSkills; //Can include not-official root skills
|
// private final @NotNull Set<RootSkill> rootSkills; //Can include not-official root skills
|
||||||
private final @NotNull Set<CoreRootSkill> 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
|
// private final @NotNull Set<CoreSkill> coreSkills; //Only includes official core skills
|
||||||
|
//
|
||||||
public SkillRegisterImpl() {
|
// public SkillRegisterImpl() {
|
||||||
skillNameMap = new HashMap<>();
|
// skillNameMap = new HashMap<>();
|
||||||
registeredSkills = new HashSet<>();
|
// registeredSkills = new HashSet<>();
|
||||||
rootSkills = new HashSet<>();
|
// rootSkills = new HashSet<>();
|
||||||
superSkills = new HashSet<>();
|
// superSkills = new HashSet<>();
|
||||||
rankedSkills = new HashSet<>();
|
// rankedSkills = new HashSet<>();
|
||||||
coreRootSkills = new HashSet<>();
|
// coreRootSkills = new HashSet<>();
|
||||||
coreSkills = new HashSet<>();
|
// coreSkills = new HashSet<>();
|
||||||
|
//
|
||||||
//TODO: allow config to turn off certain core skills
|
// //TODO: allow config to turn off certain core skills
|
||||||
registerCoreSkills();
|
// registerCoreSkills();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void registerCoreSkills() {
|
// private void registerCoreSkills() {
|
||||||
for(CoreRootSkill coreRootSkill : CoreSkills.getCoreRootSkills()) {
|
// for(CoreRootSkill coreRootSkill : CoreSkills.getCoreRootSkills()) {
|
||||||
mcMMO.p.getLogger().info("Registering core skill: " + coreRootSkill.getRawSkillName());
|
// mcMMO.p.getLogger().info("Registering core skill: " + coreRootSkill.getRawSkillName());
|
||||||
registerSkill(coreRootSkill);
|
// registerSkill(coreRootSkill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
for(CoreSkill coreSkill : CoreSkills.)
|
// for(CoreSkill coreSkill : CoreSkills.)
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public @Nullable Skill getSkill(@NotNull String fullyQualifiedName) {
|
// public @Nullable Skill getSkill(@NotNull String fullyQualifiedName) {
|
||||||
return skillNameMap.get(fullyQualifiedName);
|
// return skillNameMap.get(fullyQualifiedName);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public @Nullable Skill getSkill(@NotNull SkillIdentity skillIdentity) {
|
// public @Nullable Skill getSkill(@NotNull SkillIdentity skillIdentity) {
|
||||||
return skillNameMap.get(skillIdentity.getFullyQualifiedName());
|
// return skillNameMap.get(skillIdentity.getFullyQualifiedName());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public @NotNull Set<SuperSkill> getSuperSkills() {
|
// public @NotNull Set<SuperSkill> getSuperSkills() {
|
||||||
return superSkills;
|
// return superSkills;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public @NotNull Set<RankedSkill> getRankedSkills() {
|
// public @NotNull Set<RankedSkill> getRankedSkills() {
|
||||||
return rankedSkills;
|
// return rankedSkills;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public @NotNull Set<RootSkill> getRootSkills() {
|
// public @NotNull Set<RootSkill> getRootSkills() {
|
||||||
return rootSkills;
|
// return rootSkills;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public boolean isSkillRegistered(@NotNull Skill skill) {
|
// public boolean isSkillRegistered(@NotNull Skill skill) {
|
||||||
return registeredSkills.contains(skill);
|
// return registeredSkills.contains(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void registerSkill(@NotNull Skill skill) {
|
// public void registerSkill(@NotNull Skill skill) {
|
||||||
registeredSkills.add(skill);
|
// registeredSkills.add(skill);
|
||||||
addedSkillRegisterProcessing(skill);
|
// addedSkillRegisterProcessing(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void registerSkill(@NotNull Skill skill, boolean override) {
|
// public void registerSkill(@NotNull Skill skill, boolean override) {
|
||||||
if(isSkillRegistered(skill) && override) {
|
// if(isSkillRegistered(skill) && override) {
|
||||||
registeredSkills.remove(skill);
|
// registeredSkills.remove(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
registeredSkills.add(skill);
|
// registeredSkills.add(skill);
|
||||||
addedSkillRegisterProcessing(skill);
|
// addedSkillRegisterProcessing(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public @NotNull Set<Skill> getRegisteredSkills() {
|
// public @NotNull Set<Skill> getRegisteredSkills() {
|
||||||
return registeredSkills;
|
// return registeredSkills;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void postRemovalSkillRegisterProcessing(@NotNull Skill skill) {
|
// private void postRemovalSkillRegisterProcessing(@NotNull Skill skill) {
|
||||||
removeSkillNameLookup(skill);
|
// removeSkillNameLookup(skill);
|
||||||
removeCollectionCache(skill);
|
// removeCollectionCache(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void removeCollectionCache(@NotNull Skill skill) {
|
// private void removeCollectionCache(@NotNull Skill skill) {
|
||||||
//Remove from register cache(s)
|
// //Remove from register cache(s)
|
||||||
if(skill instanceof CoreRootSkill) {
|
// if(skill instanceof CoreRootSkill) {
|
||||||
coreRootSkills.remove(skill);
|
// coreRootSkills.remove(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(skill instanceof CoreSkill) {
|
// if(skill instanceof CoreSkill) {
|
||||||
coreSkills.remove(skill);
|
// coreSkills.remove(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(skill instanceof RootSkill) {
|
// if(skill instanceof RootSkill) {
|
||||||
rootSkills.remove(skill);
|
// rootSkills.remove(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (skill instanceof SuperSkill) {
|
// if (skill instanceof SuperSkill) {
|
||||||
superSkills.remove(skill);
|
// superSkills.remove(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(skill instanceof RankedSkill) {
|
// if(skill instanceof RankedSkill) {
|
||||||
rankedSkills.remove( skill);
|
// rankedSkills.remove( skill);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void removeSkillNameLookup(@NotNull Skill skill) {
|
// private void removeSkillNameLookup(@NotNull Skill skill) {
|
||||||
skillNameMap.remove(skill.getSkillIdentity().getFullyQualifiedName());
|
// skillNameMap.remove(skill.getSkillIdentity().getFullyQualifiedName());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void addedSkillRegisterProcessing(@NotNull Skill skill) {
|
// private void addedSkillRegisterProcessing(@NotNull Skill skill) {
|
||||||
addSkillNameLookup(skill);
|
// addSkillNameLookup(skill);
|
||||||
addCollectionCache(skill);
|
// addCollectionCache(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void addCollectionCache(@NotNull Skill skill) {
|
// private void addCollectionCache(@NotNull Skill skill) {
|
||||||
//Add to various collections for cached lookups
|
// //Add to various collections for cached lookups
|
||||||
if(skill instanceof CoreSkill) {
|
// if(skill instanceof CoreSkill) {
|
||||||
coreSkills.add((CoreSkill) skill);
|
// coreSkills.add((CoreSkill) skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(skill instanceof CoreRootSkill) {
|
// if(skill instanceof CoreRootSkill) {
|
||||||
coreRootSkills.add((CoreRootSkill) skill);
|
// coreRootSkills.add((CoreRootSkill) skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(skill instanceof RootSkill) {
|
// if(skill instanceof RootSkill) {
|
||||||
rootSkills.add((RootSkill) skill);
|
// rootSkills.add((RootSkill) skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (skill instanceof SuperSkill) {
|
// if (skill instanceof SuperSkill) {
|
||||||
superSkills.add((SuperSkill) skill);
|
// superSkills.add((SuperSkill) skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(skill instanceof RankedSkill) {
|
// if(skill instanceof RankedSkill) {
|
||||||
rankedSkills.add((RankedSkill) skill);
|
// rankedSkills.add((RankedSkill) skill);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void addSkillNameLookup(@NotNull Skill skill) {
|
// private void addSkillNameLookup(@NotNull Skill skill) {
|
||||||
skillNameMap.put(skill.getSkillIdentity().getFullyQualifiedName(), skill);
|
// skillNameMap.put(skill.getSkillIdentity().getFullyQualifiedName(), skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void unregisterSkill(@NotNull Skill skill) {
|
// public void unregisterSkill(@NotNull Skill skill) {
|
||||||
mcMMO.p.getLogger().info("Skill "+skill.toString()+" has been removed from the skill register.");
|
// mcMMO.p.getLogger().info("Skill "+skill.toString()+" has been removed from the skill register.");
|
||||||
registeredSkills.remove(skill);
|
// registeredSkills.remove(skill);
|
||||||
skillNameMap.remove(skill.getSkillIdentity().getFullyQualifiedName());
|
// skillNameMap.remove(skill.getSkillIdentity().getFullyQualifiedName());
|
||||||
|
//
|
||||||
//Collection cache cleanup
|
// //Collection cache cleanup
|
||||||
postRemovalSkillRegisterProcessing(skill);
|
// postRemovalSkillRegisterProcessing(skill);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public @NotNull Set<CoreRootSkill> getCoreRootSkills() {
|
// public @NotNull Set<CoreRootSkill> getCoreRootSkills() {
|
||||||
return coreRootSkills;
|
// return coreRootSkills;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Used to match skill by a "skill name"
|
// * Used to match skill by a "skill name"
|
||||||
* This is NOT case sensitive
|
// * This is NOT case sensitive
|
||||||
*
|
// *
|
||||||
* Will match against any registered root skill if one of the following is true
|
// * Will match against any registered root skill if one of the following is true
|
||||||
* 1) The skills localized name is equal to the provided {@link String skillName}
|
// * 1) The skills localized name is equal to the provided {@link String skillName}
|
||||||
* 2) The provided {@link String skillName} matches a root skill's fully qualified name
|
// * 2) The provided {@link String skillName} matches a root skill's fully qualified name
|
||||||
* 3) The provided {@link String skillName} matches the name of the default name of the skill (the en_US not localized name, this name is never overridden by locale)
|
// * 3) The provided {@link String skillName} matches the name of the default name of the skill (the en_US not localized name, this name is never overridden by locale)
|
||||||
*
|
// *
|
||||||
* @param skillName skill name or skill identity
|
// * @param skillName skill name or skill identity
|
||||||
* @return The matching {@link RootSkill} if it exists
|
// * @return The matching {@link RootSkill} if it exists
|
||||||
* @see SkillIdentity#getFullyQualifiedName()
|
// * @see SkillIdentity#getFullyQualifiedName()
|
||||||
*/
|
// */
|
||||||
public @Nullable RootSkill matchRootSkill(@NotNull String skillName) {
|
// public @Nullable RootSkill matchRootSkill(@NotNull String skillName) {
|
||||||
for (RootSkill rootSkill : rootSkills) {
|
// for (RootSkill rootSkill : rootSkills) {
|
||||||
if (rootSkill.getSkillIdentity().getFullyQualifiedName().equalsIgnoreCase(skillName)
|
// if (rootSkill.getSkillIdentity().getFullyQualifiedName().equalsIgnoreCase(skillName)
|
||||||
|| skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(rootSkill.getRawSkillName()) + ".SkillName"))
|
// || skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(rootSkill.getRawSkillName()) + ".SkillName"))
|
||||||
|| rootSkill.getRawSkillName().equalsIgnoreCase(skillName)) {
|
// || rootSkill.getRawSkillName().equalsIgnoreCase(skillName)) {
|
||||||
return rootSkill;
|
// return rootSkill;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -12,10 +12,8 @@ import com.gmail.nossr50.config.treasure.TreasureConfig;
|
|||||||
import com.gmail.nossr50.database.DatabaseManager;
|
import com.gmail.nossr50.database.DatabaseManager;
|
||||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillRegisterImpl;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll;
|
import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll;
|
||||||
import com.gmail.nossr50.listeners.*;
|
import com.gmail.nossr50.listeners.*;
|
||||||
import com.gmail.nossr50.party.PartyManagerImpl;
|
|
||||||
import com.gmail.nossr50.runnables.CheckDateTask;
|
import com.gmail.nossr50.runnables.CheckDateTask;
|
||||||
import com.gmail.nossr50.runnables.SaveTimerTask;
|
import com.gmail.nossr50.runnables.SaveTimerTask;
|
||||||
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
||||||
@ -49,8 +47,6 @@ import com.gmail.nossr50.util.skills.RankUtils;
|
|||||||
import com.gmail.nossr50.util.skills.SmeltingTracker;
|
import com.gmail.nossr50.util.skills.SmeltingTracker;
|
||||||
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
import com.google.common.base.Charsets;
|
|
||||||
import com.neetgames.mcmmo.api.SkillRegister;
|
|
||||||
import com.neetgames.mcmmo.party.PartyManager;
|
import com.neetgames.mcmmo.party.PartyManager;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||||
@ -93,7 +89,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
private static TransientMetadataTools transientMetadataTools;
|
private static TransientMetadataTools transientMetadataTools;
|
||||||
private static ChatManager chatManager;
|
private static ChatManager chatManager;
|
||||||
private static CommandManager commandManager; //ACF
|
private static CommandManager commandManager; //ACF
|
||||||
private static SkillRegister skillRegister;
|
|
||||||
private static TransientEntityTracker transientEntityTracker;
|
private static TransientEntityTracker transientEntityTracker;
|
||||||
private static boolean serverShutdownExecuted = false;
|
private static boolean serverShutdownExecuted = false;
|
||||||
|
|
||||||
@ -164,9 +159,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
try {
|
try {
|
||||||
//Skill Register
|
|
||||||
skillRegister = new SkillRegisterImpl();
|
|
||||||
|
|
||||||
//Platform Manager
|
//Platform Manager
|
||||||
platformManager = new PlatformManager();
|
platformManager = new PlatformManager();
|
||||||
|
|
||||||
@ -736,7 +728,4 @@ public class mcMMO extends JavaPlugin {
|
|||||||
private static synchronized void setServerShutdown(boolean bool) {
|
private static synchronized void setServerShutdown(boolean bool) {
|
||||||
serverShutdownExecuted = bool;
|
serverShutdownExecuted = bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public @NotNull SkillRegister getSkillRegister() { return skillRegister; }
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user