mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Added SkillAPI used to get a list of skill names
This prevents having to rely on the SkillType enum
This commit is contained in:
parent
15d7d3f8a2
commit
09b0bf62e2
@ -17,6 +17,7 @@ Version 1.5.01-dev
|
|||||||
+ Added API to check if an entity is bleeding
|
+ Added API to check if an entity is bleeding
|
||||||
+ Added options to tools.yml and armor.yml config files to set a pretty repair material name
|
+ Added options to tools.yml and armor.yml config files to set a pretty repair material name
|
||||||
+ Added full support for repairables in tools.yml and armor.yml config files
|
+ Added full support for repairables in tools.yml and armor.yml config files
|
||||||
|
+ Added new API class SkillAPI used to get a list of valid skill names
|
||||||
= Fixed bug where pistons would mess with the block tracking
|
= Fixed bug where pistons would mess with the block tracking
|
||||||
= Fixed bug where the Updater was running on the main thread.
|
= Fixed bug where the Updater was running on the main thread.
|
||||||
= Fixed bug when players would use /ptp without being in a party
|
= Fixed bug when players would use /ptp without being in a party
|
||||||
|
93
src/main/java/com/gmail/nossr50/api/SkillAPI.java
Normal file
93
src/main/java/com/gmail/nossr50/api/SkillAPI.java
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
package com.gmail.nossr50.api;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
|
||||||
|
public final class SkillAPI {
|
||||||
|
private SkillAPI() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of strings with mcMMO's skills
|
||||||
|
* This includes parent and child skills
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @return a list of strings with valid skill names
|
||||||
|
*/
|
||||||
|
public static List<String> getSkills() {
|
||||||
|
return getListFromEnum(Arrays.asList(SkillType.values()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of strings with mcMMO's skills
|
||||||
|
* This only includes parent skills
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @return a list of strings with valid skill names
|
||||||
|
*/
|
||||||
|
public static List<String> getNonChildSkills() {
|
||||||
|
return getListFromEnum(SkillType.NON_CHILD_SKILLS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of strings with mcMMO's skills
|
||||||
|
* This only includes child skills
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @return a list of strings with valid skill names
|
||||||
|
*/
|
||||||
|
public static List<String> getChildSkills() {
|
||||||
|
return getListFromEnum(SkillType.CHILD_SKILLS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of strings with mcMMO's skills
|
||||||
|
* This only includes combat skills
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @return a list of strings with valid skill names
|
||||||
|
*/
|
||||||
|
public static List<String> getCombatSkills() {
|
||||||
|
return getListFromEnum(SkillType.COMBAT_SKILLS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of strings with mcMMO's skills
|
||||||
|
* This only includes gathering skills
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @return a list of strings with valid skill names
|
||||||
|
*/
|
||||||
|
public static List<String> getGatheringSkills() {
|
||||||
|
return getListFromEnum(SkillType.GATHERING_SKILLS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of strings with mcMMO's skills
|
||||||
|
* This only includes misc skills
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @return a list of strings with valid skill names
|
||||||
|
*/
|
||||||
|
public static List<String> getMiscSkills() {
|
||||||
|
return getListFromEnum(SkillType.MISC_SKILLS);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<String> getListFromEnum(List<SkillType> skillsTypes) {
|
||||||
|
List<String> skills = new ArrayList<String>();
|
||||||
|
|
||||||
|
for (SkillType skillType : skillsTypes) {
|
||||||
|
skills.add(skillType.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
return skills;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user