Skip to content

Instantly share code, notes, and snippets.

@scarabcoder
Created May 23, 2018 15:25
Show Gist options
  • Save scarabcoder/99eb280476f00edd0f6190795e6a67dc to your computer and use it in GitHub Desktop.
Save scarabcoder/99eb280476f00edd0f6190795e6a67dc to your computer and use it in GitHub Desktop.
package ca.yomnetwork.skills.API;
import ca.yomnetwork.skills.Enums.Level;
import ca.yomnetwork.skills.Managers.*;
import ca.yomnetwork.skills.Objects.Bonus;
import ca.yomnetwork.skills.Objects.Boosts.Boost;
import ca.yomnetwork.skills.Objects.Class;
import ca.yomnetwork.skills.Objects.Exceptions.*;
import ca.yomnetwork.skills.Objects.Exceptions.ClassNotFoundException;
import ca.yomnetwork.skills.Objects.Skill;
import ca.yomnetwork.skills.Objects.sPlayer;
import ca.yomnetwork.skills.Skills;
import ca.yomnetwork.skills.Util;
import net.brcdev.gangs.gang.Gang;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class SkillsBase {
private static Skills skillMain = Skills.getInst();
private static ClassManager classModule = skillMain.classModule;
private static PlayerManager playerModule = skillMain.playerModule;
private static SkillManager skillModule = skillMain.skillModule;
private static XPManager xpModule = skillMain.xpModule;
private static BoostManager boostModule = skillMain.boostModule;
/**
* This will get the map of all loaded classes.
*
* @return All loaded classes.
*/
public static HashMap<String, Class> getClasses() {
return classModule.classes;
}
/**
* This will get the map of all loaded skills.
*
* @return All loaded skills.
*/
public static HashMap<String, Skill> getSkills() {
return skillModule.skills;
}
/**
* This will get the map of all loaded players.
*
* @return All loaded players.
*/
public static HashMap<UUID, sPlayer> getPlayers() {
return playerModule.sPlayers;
}
/**
* This will reset a single skill for the target player.
* Note: This will reset bonus point assignments.
*
* @param uuid The UUID of the target player.
* @param skillID The skillID of the target skill.
* @throws SQLException If there was an issue fetching SQL information for the method.
* @throws GreaterThanMaxException This can safely be ignored.
* @throws NotEnoughExtraPointsException This can safely be ignored.
* @throws LessThanZeroException This can safely be ignored
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
*/
public static void resetSkill(UUID uuid, String skillID) throws ExecutionException, SQLException, GreaterThanMaxException, NotEnoughExtraPointsException, LessThanZeroException, InterruptedException {
skillModule.resetSkill(uuid, skillID);
}
/**
* This will reset all skills for the target player.
* Note: This will reset bonus point assignments.
* Note: If the target is offline, this will set their extra points to their level.
*
* @param uuid The UUID of the target player.
* @throws NotEnoughExtraPointsException This can safely be ignored.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws LessThanZeroException This can safely be ignored.
* @throws SQLException If there is an issue reading SQL data.
* @throws GreaterThanMaxException This can safely be ignored.
*/
public static void resetSkill(UUID uuid) throws NotEnoughExtraPointsException, InterruptedException, LessThanZeroException, ExecutionException, SQLException, GreaterThanMaxException {
skillModule.resetSkill(uuid);
}
/**
* This will fetch the max level for the target skill in the basic or donator type.
*
* @param classID The ID of the target class
* @param skillID The ID of the target skill.
* @param donator Whether or not you want the basic or donator max.
* @return The max skill given the parameters.
* @throws SkillNotFoundException If the target skill is not loaded.
* @throws ClassNotFoundException If the target class is not loaded.
*/
public static int getMaxSkill(String classID, String skillID, Boolean donator) throws SkillNotFoundException, ClassNotFoundException {
return skillModule.getMaxSkill(classID, skillID, donator);
}
/**
* This will fetch the max level for a target skill for a target player.
*
* @param uuid the UUID of the target player.
* @param skillID The ID of the target skill.
* @return The max skill level based on the parameters given.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there was an error reading the SQL database.
*/
public static int getMaxSkill(UUID uuid, String skillID) throws InterruptedException, ExecutionException, SQLException {
return skillModule.getMaxSkill(uuid, skillID);
}
/**
* This will fetch the current skill level for a target skill for a target player with or without bonus points.
*
* @param uuid The UUID of the target player.
* @param skillID The ID of the target skill.
* @param includeBonus Whether or not you want to include bonus points.
* @return The current skill level of the target player.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there was an error reading the SQL database.
*/
public static int getCurrentSkill(UUID uuid, String skillID, Boolean includeBonus) throws InterruptedException, ExecutionException, SQLException {
return skillModule.getCurrentSkill(uuid, skillID, includeBonus);
}
/**
* This will set the current skill level for a target player.
*
* @param uuid The UUID of the target player.
* @param skillID The ID of the target skill.
* @param newValue The new skill level.
* @throws NotEnoughExtraPointsException If the target player does not have enough extra points to complete the target action.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws LessThanZeroException If the new skill level is less than 0.
* @throws SQLException If there is an issue fetching SQL data.
* @throws GreaterThanMaxException If the new skill level is greater than the max for that player and their class.
*/
public static void setCurrentSkill(UUID uuid, String skillID, Integer newValue) throws NotEnoughExtraPointsException, InterruptedException, LessThanZeroException, ExecutionException, SQLException, GreaterThanMaxException {
skillModule.setCurrentSkill(uuid, skillID, newValue);
}
/**
* This will get the current number of extra points for the target player.
*
* @param uuid The UUID of the target player.
* @return The number of extra points that the target player has remaining.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
*/
public static int getExtraPoints(UUID uuid) throws InterruptedException, ExecutionException, SQLException {
return skillModule.getExtraPoints(uuid);
}
/**
* This will set the current number of extra points for the target player.
*
* @param uuid The UUID of the target player.
* @param newPoints The new number of extra points.
* @throws LessThanZeroException If the new value is less than 0
* @throws GreaterThanMaxException If the new value is greater than the max set in config.
*/
public static void setExtraPoints(UUID uuid, Integer newPoints) throws LessThanZeroException, GreaterThanMaxException {
skillModule.setExtraPoints(uuid, newPoints);
}
/**
* This will add a supplied amount of points to the current number of extra points of the target player.
*
* @param uuid The UUID of the target player.
* @param amount The amount of points to add.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
* @throws GreaterThanMaxException This can safely be ignored.
* @throws LessThanZeroException If the new value is greater than the max set in config.
*/
public static void addExtraPoints(UUID uuid, Integer amount) throws InterruptedException, SQLException, GreaterThanMaxException, ExecutionException, LessThanZeroException {
skillModule.addExtraPoints(uuid, amount);
}
/**
* This will fetch the maximum extra points for a player.
*
* @return The max extra points set in config.
*/
public static int getMaxExtraPoints() {
return skillModule.getMaxExtraPoints();
}
/**
* This will fetch all of the bonuses targeted at the specified player.
* Note: If the player is offline, this requires a fairly heavy SQL query. It is done asynchronously.
*
* @param uuid The UUID of the target player.
* @return A list of all of the bonus associated with the targer player.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
*/
public static List<Bonus> getBonuses(UUID uuid) throws InterruptedException, ExecutionException, SQLException {
return skillModule.getBonuses(uuid);
}
/**
* This will fetch a list of all of the bonuses.
* Note: This requires a large SQL query. It is done asynchronously.
*
* @return A list of every active bonus.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
*/
public static List<Bonus> getAllBonuses() throws InterruptedException, ExecutionException, SQLException {
return skillModule.getAllBonuses();
}
/**
* This will fetch a list of every bonus which originated from the target.
*
* @param origin The origin which you wish to collect.
* @return A list of every active bonus
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
*/
public static List<Bonus> getBonuses(String origin) throws InterruptedException, ExecutionException, SQLException {
return skillModule.getBonuses(origin);
}
/**
* This will fetch a bonus based on its key.
* Note: Each bonus should have it's own key so this will only return one result.
*
* @param key The target key for a bonus.
* @return The bonus associated with the target key.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
*/
public static Bonus getBonus(String key) throws InterruptedException, ExecutionException, SQLException {
return skillModule.getBonus(key);
}
/**
* This will fetch the total bonus points which a player has assigned to them.
*
* @param uuid The UUID of the target player.
* @return The number of bonus points assigned to the target player.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
*/
public static Integer getTotalBonusPoints(UUID uuid) throws InterruptedException, ExecutionException, SQLException {
return skillModule.getTotalBonusPoints(uuid);
}
/**
* This will fetch the amount of bonus points which a player has not used yet.
*
* @param uuid The UUID of the target player.
* @return The number of bonus points which are unassigned currently.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
*/
public static Integer getUnusedBonusPoints(UUID uuid) throws InterruptedException, ExecutionException, SQLException {
return skillModule.getUnusedBonusPoints(uuid);
}
/**
* This will fetch the amount of bonus points which a player has assigned to a target skill.
*
* @param uuid The UUID of the target player.
* @param skillID The ID of the target skill.
* @return The number of bonus points assigned to the target skill.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
*/
public static Integer getBonusForSkill(UUID uuid, String skillID) throws InterruptedException, ExecutionException, SQLException {
return skillModule.getBonusForSkill(uuid, skillID);
}
/**
* This will add a bonus with the specified parameters.
*
* @param uuid The UUID of the target player.
* @param origin The origin for the bonus. (A unique id for the plugin creating it)
* @param key A unique key for this specifically (If stuck, UUID$randomUUID() can be used)
* @param points The number of bonus points associated with this assignment.
*/
public static void addBonus(UUID uuid, String origin, String key, Integer points) {
skillModule.addBonus(uuid, origin, key, points);
}
/**
* This will remove a bonus for the target player matching the target key.
*
* @param uuid The UUID of the player to remove.
* @param key The target key.
*/
public static void removeBonus(UUID uuid, String key) {
skillModule.removeBonus(uuid, key);
}
/**
* This will remove all bonuses for the target player.
*
* @param uuid
*/
public static void removeBonuses(UUID uuid) {
skillModule.removeBonuses(uuid);
}
/**
* This will reset all of the assignments for all of the bonuses on the target player.
*
* @param uuid The UUID of the target player.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
*/
public static void resetAssignments(UUID uuid) throws InterruptedException, ExecutionException, SQLException {
skillModule.resetAssignments(uuid);
}
/**
* This will reset all skill assignments pointing towards the target skill for the target player.
* Note: This will only work online.
*
* @param uuid The UUID for the target player.
* @param skillID The ID for the target skill
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws SQLException If there is an issue fetching SQL data.
* @throws PlayerNotLoadedException If the target player is not currently loaded.
*/
public static void resetAssignments(UUID uuid, String skillID) throws InterruptedException, SQLException, ExecutionException, PlayerNotLoadedException {
skillModule.resetAssignments(uuid, skillID);
}
/**
* This will load the target player into memory.
*
* @param uuid the UUID of the target player.
* @throws FetchPlayerException If there is an issue fetching the target player from the database
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws NonExistentPlayerException If the target player does not exist inside the database.
*/
public static void loadPlayer(UUID uuid) throws FetchPlayerException, ExecutionException, NonExistentPlayerException, InterruptedException {
playerModule.loadPlayer(uuid);
}
/**
* This will add a player with default values to the database.
* Note: The player will be loaded after being added.
*
* @param uuid The UUID for the target player.
* @param classID The class to associate them with.
* @param donator The status to associate them with.
* @throws FetchPlayerException If there is an issue fetching the playerdata after it is added.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws NonExistentPlayerException This can safely be ignored. It will only error if there was an error writing to the database in which case there is a bigger issue.
*/
public static void addBasePlayer(UUID uuid, String classID, Boolean donator) throws FetchPlayerException, ExecutionException, NonExistentPlayerException, InterruptedException {
playerModule.addBasePlayer(uuid, classID, donator);
}
/**
* This will unload all players from memory.
*
* @param sync Whether or not the players should be saved before removal or not.
*/
public static void unloadAllPlayers(Boolean sync) {
playerModule.unloadAllPlayers(sync);
}
/**
* This will unload the target player from memory
*
* @param uuid The UUID of the target player.
* @param sync Whether their data should be saved before them being unloaded or not.
* @throws PlayerNotLoadedException If the player is not currently loaded.
* @throws SavePlayerException If there is an issue saving their data to the database.
*/
public static void unloadPlayer(UUID uuid, Boolean sync) throws PlayerNotLoadedException, SavePlayerException {
playerModule.unloadPlayer(uuid, sync);
}
/**
* This will sync all of the online players to the database.
* All exceptions are ignored to allow players to continue saving even if one fails.
*/
public static void syncPlayers() {
playerModule.syncPlayers();
}
/**
* This will sync the entire sPlayer object to the config given their UUID.
*
* @param uuid The UUID of the target player.
* @throws PlayerNotLoadedException If the target player is not currently loaded.
* @throws SQLException If there is an issue writing to the SQL database.
*/
public static void syncPlayer(UUID uuid) throws PlayerNotLoadedException, SQLException {
playerModule.syncPlayer(uuid);
}
/**
* This will sync all of the bonuses for the target player.
*
* @param uuid The UUID for the target player.
* @throws PlayerNotLoadedException If the target is not currently loaded.
* @throws SQLException If there is an issue writing to the SQL database.
*/
public static void syncBonuses(UUID uuid) throws PlayerNotLoadedException, SQLException {
playerModule.syncBonuses(uuid);
}
/**
* This will fetch an sPlayer object for the target UUID.
*
* @param uuid The UUID of the target player.
* @return The sPlayer object for the target.
* @throws FetchPlayerException If there is an issue fetching data from the SQL database.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
* @throws NonExistentPlayerException If the target player does not exist in the database.
*/
public static sPlayer getPlayer(UUID uuid) throws FetchPlayerException, ExecutionException, NonExistentPlayerException, InterruptedException {
return playerModule.getPlayer(uuid);
}
/**
* This will run an SQL update on the playerdata database.
*
* @param string The query to run.
*/
public static void runSQL(String string) {
skillMain.sql.runSQL(string);
}
/**
* This will get the amount of levels that the target player has. It will be given back in string format (ex: 12.5)
*
* @param uuid The UUID of the target player.
* @return The amount of levels that the target has.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
*/
public static Integer getLevelFromPlayer(UUID uuid) throws ExecutionException, InterruptedException {
return xpModule.getLevelFromPlayer(uuid);
}
/**
* This will get the amount of XP that a player has associated with them.
*
* @param uuid The UUID associated with the target player.
* @return The amount of XP the target has.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
*/
public static Double getXPFromPlayer(UUID uuid) throws ExecutionException, InterruptedException {
return xpModule.getXPFromPlayer(uuid);
}
/**
* This will turn a given XP value into the amount of levels in the format of a string (ex: 12.5)
*
* @param xp The amount of XP to translate.
* @return The amount of levels in String format.
*/
public static Integer getLevelFromXP(Double xp) {
return xpModule.getLevelFromXP(xp);
}
/**
* This will turn a given amount of levels into their equivalent XP value.
*
* @param level The amount of levels to translate.
* @return The amount of XP that corresponds with the level.
*/
public static Double getXPFromLevel(Integer level) {
return xpModule.getXPFromLevel(level);
}
/**
* This will add the specified amount of XP to the target player.
*
* @param uuid The UUID of the target player.
* @param xp The amount of levels to add.
*/
public static void addXP(UUID uuid, Double xp) {
xpModule.addXP(uuid, xp);
}
/**
* This will set the current xp to the target long for the target player.
*
* @param uuid The UUID of the target player.
* @param xp The amount of xp to set their level to.
*/
public static void setXP(UUID uuid, Double xp) {
xpModule.setXP(uuid, xp);
}
/**
* This will add the specified amount of levels to the target player.
*
* @param uuid The UUID of the target player.
* @param level The amount of levels to add.
*/
public static void addlevel(UUID uuid, Integer level) {
xpModule.addLevel(uuid, level);
}
/**
* This will check whether or not the target player is a donator
*
* @param uuid The UUID of the target player.
* @return Their donator status.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
*/
public static Boolean isDonator(UUID uuid) throws ExecutionException, InterruptedException {
return playerModule.isDonator(uuid);
}
/**
* This will set whether the target player's class status is basic or donator
*
* @param uuid The UUID of the target player.
* @param donator Whether or not you want them to have donator status.
*/
public static void setDonator(UUID uuid, boolean donator) {
playerModule.setDonator(uuid, donator);
}
/**
* This will fetch the class object associated with the supplied class ID.
*
* @param classID The ID of the target class.
* @return The full class object associated with the target ID.
* @throws ClassNotFoundException If the supplied ID is not associated with any loaded class.
*/
public static Class getClass(String classID) throws ClassNotFoundException {
return classModule.getClass(classID);
}
/**
* This will fetch the class ID for the supplied player.
*
* @param uuid The uuid of the target player.
* @return The class ID for the supplied player.
* @throws NonExistentPlayerException If the player is not loaded and does not exist in the database.
* @throws FetchPlayerException If the player data cannot be retrieved from the database. This is likely a connection issue. Note: The original SQLException can be retrieved from the exception.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
*/
public static String getClass(UUID uuid) throws NonExistentPlayerException, FetchPlayerException, ExecutionException, InterruptedException {
return classModule.getClass(uuid);
}
/**
* This will set the target player's class.
* Note: If reset is false, it will only adjust points if their current value is greater than the new max in which case it returns unused points.
*
* @param uuid This uuid of the target player.
* @param classID The ID of new class.
* @param basic Whether or not you want the basic version of that class.
* @param reset Whether or not their skills should be reset when their class changes.
* @throws SQLException If there is an error fetching a value from a result set.
* @throws FetchBPException If there is an error fetching bonus points from SQL.
* @throws NonExistentPlayerException If the target player is not loaded and does not exist in the SQL database.
* @throws RunSQLException If there is an issue executing the SQL query.
* @throws FetchPlayerException If there is an issue receiving the SQL data.
* @throws ClassNotFoundException If the target class does not exist.
* @throws ExecutionException If there is an error executing the search on a different thread.
* @throws InterruptedException If there is an issue while the task is running on a different thread.
*/
public static void setClass(UUID uuid, String classID, Boolean basic, Boolean reset) throws SQLException, FetchBPException, NonExistentPlayerException, RunSQLException, FetchPlayerException, ClassNotFoundException, ExecutionException, InterruptedException {
try {
classModule.setClass(uuid, classID, basic, reset);
} catch (LessThanZeroException | GreaterThanMaxException | NotEnoughExtraPointsException e) {
e.printStackTrace();
Util.log(Level.WARN, "An error has occurred changing a player's class. Please report this error to a developer as it should not have occurred.");
}
}
/**
* This will get the ID of a class given it's title.
*
* @param title The title of the target class. This can be the donator or basic version.
* @return The class ID of the target class.
* @throws ClassNotFoundException If there is no loaded class with a title matching the supplied one.
*/
public static String getClassID(String title) throws ClassNotFoundException {
return classModule.getClassID(title);
}
/**
* This will get the class title based on the classID and whether or not you would like the basic version or not.
*
* @param classID The ID of the target class.
* @param basic Whether or not you want the basic version.
* @return The title of the target class, either basic or donator.
* @throws ClassNotFoundException If the supplied ID does not match any loaded class.
*/
public static String getClassTitle(String classID, Boolean basic) throws ClassNotFoundException {
return classModule.getClassTitle(classID, basic);
}
/**
* This will fetch both the basic and donator title for the specified class.
* Note: String[0] is basic / String[1] is donator.
*
* @param classID The ID of the target class.
* @return A String Array of the basic and donator titles.
* @throws ClassNotFoundException If the supplied ID does not match any loaded class.
*/
public static String[] getClassTitles(String classID) throws ClassNotFoundException {
return classModule.getClassTitles(classID);
}
/**
* This will fetch the group string associated with the target class in the basic or donator form.
*
* @param classID The ID of the target class.
* @param basic Whether or not you would like the basic group.
* @return The group name associated with the target class in the basic or donator form.
* @throws ClassNotFoundException If the supplied ID does not match any loaded class.
*/
public static String getClassGroup(String classID, Boolean basic) throws ClassNotFoundException {
return classModule.getClassGroup(classID, basic);
}
/**
* This will fetch both the basic and donator groups for the target class.
* Note: String[0] is basic / String[1] is donator.
*
* @param classID The ID of the target class.
* @return A String Array of the basic and donator group names.
* @throws ClassNotFoundException If the supplied ID does not match any loaded class.
*/
public static String[] getClassGroups(String classID) throws ClassNotFoundException {
return classModule.getClassGroups(classID);
}
/**
* This will fetch the description of the target class in the form of a String List.
*
* @param classID The ID of the target class.
* @param basic Whether or not you would like the basic description.
* @return The description associated with the target class in the basic or donator form.
* @throws ClassNotFoundException If the supplied ID does not match any loaded class.
*/
public static List<String> getDescription(String classID, Boolean basic) throws ClassNotFoundException {
return classModule.getDescription(classID, basic);
}
/**
* This will fetch a map of skillIDs and their associated max for the target class.
*
* @param classID The ID of the target class.
* @param basic Whether or not you would like the basic skills.
* @return A map of skillIDs and their associated max.
* @throws ClassNotFoundException If the supplied ID does not match any loaded class.
*/
public static HashMap<String, Integer> getMaxSkills(String classID, Boolean basic) throws ClassNotFoundException {
return classModule.getMaxSkills(classID, basic);
}
/**
* This will say whether or not gang boosts can be created. It depends on whether or not GangsPlus is loaded on the server.
*
* @return Whether or not gang boosts are enabled.
*/
public static boolean gangsEnabled() {
return boostModule.gangsPresent;
}
/**
* This will fetch every loaded boost.
*
* @return All loaded boosts.
*/
public static HashMap<Integer, Boost> getBoosts() {
return boostModule.getAllBoosts();
}
/**
* This will fetch all boosts for the target player.
*
* @param uuid The UUID of the target player.
* @return All boosts for the target player.
*/
public static List<Boost> getBoostsForPlayer(UUID uuid) {
return boostModule.getBoostsForPlayer(uuid);
}
/**
* This will fetch a list of all boosts for the specified gang.
* null if gangs are disabled, an empty list if none exist.
*
* @param name The name of the target gang.
* @return A list of boosts that affect the target gang.
*/
public static List<Boost> getBoostsForGang(String name) {
if (!gangsEnabled())
return null;
return boostModule.getBoostsForGang(name);
}
/**
* This will fetch all boosts for the specified XP type.
*
* @param xpType The target xp type.
* @return The boosts that affect the target XP type.
*/
public static List<Boost> getBoostsForXPType(String xpType) {
return boostModule.getBoostsForXPType(xpType);
}
public static List<Boost> getGlobalBoosts() {
return boostModule.getGlobalBoosts();
}
/**
* Get a specific boost based on it's ID.
*
* @param id The ID of the target boost.
* @return The boost for the target id. null if it does not exist.
*/
public static Boost getBoost(Integer id) {
return boostModule.getBoost(id);
}
/**
* Add a boost for the supplied time with the supplied effects for the supplied gang.
*
* @param effects The target effects.
* @param lengthSec The time in seconds for the boost to last.
* @param target The target of the boost.
*/
public static void addPlayerBoost(HashMap<String, Float> effects, long lengthSec, UUID target) {
boostModule.createPlayerBoost(effects, lengthSec, target);
}
/**
* Add a boost for the supplied time with the supplied effects for the supplied gang.
*
* @param effects The target effects.
* @param lengthSec The time in seconds for the boost to last.
* @param target The target of the boost.
*/
public static void addGangBoost(HashMap<String, Float> effects, long lengthSec, Gang target) {
boostModule.createGangBoost(effects, lengthSec, target);
}
/**
* Add a boost for the supplied time with the supplied effects for all players.
*
* @param effects The target effects.
* @param lengthSec The time in seconds for the boost to last.
*/
public static void addGlobalBoost(HashMap<String, Float> effects, long lengthSec) {
boostModule.createGlobalBoost(effects, lengthSec);
}
/**
* Remove a boost given it's id.
*
* @param id The ID of the target boost.
* @return Whether or not one was removed.
*/
public static boolean removeBoost(Integer id) {
return boostModule.removeBoost(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment