diff --git a/src/main/java/com/gmail/nossr50/api/AbilityAPI.java b/src/main/java/com/gmail/nossr50/api/AbilityAPI.java index 6772df1ca..f440d2dff 100644 --- a/src/main/java/com/gmail/nossr50/api/AbilityAPI.java +++ b/src/main/java/com/gmail/nossr50/api/AbilityAPI.java @@ -1,89 +1,89 @@ -package com.gmail.nossr50.api; - -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.datatypes.skills.SuperAbilityType; -import com.gmail.nossr50.runnables.skills.BleedTimerTask; -import com.gmail.nossr50.util.player.UserManager; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; - -public final class AbilityAPI { - private AbilityAPI() { - } - - public static boolean berserkEnabled(Player player) { - return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.BERSERK); - } - - public static boolean gigaDrillBreakerEnabled(Player player) { - return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER); - } - - public static boolean greenTerraEnabled(Player player) { - return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GREEN_TERRA); - } - - public static boolean serratedStrikesEnabled(Player player) { - return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SERRATED_STRIKES); - } - - public static boolean skullSplitterEnabled(Player player) { - return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SKULL_SPLITTER); - } - - public static boolean superBreakerEnabled(Player player) { - return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SUPER_BREAKER); - } - - public static boolean treeFellerEnabled(Player player) { - return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.TREE_FELLER); - } - - public static boolean isAnyAbilityEnabled(Player player) { - McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); - - for (SuperAbilityType ability : SuperAbilityType.values()) { - if (mcMMOPlayer.getAbilityMode(ability)) { - return true; - } - } - - return false; - } - - public static void resetCooldowns(Player player) { - UserManager.getPlayer(player).resetCooldowns(); - } - - public static void setBerserkCooldown(Player player, long cooldown) { - UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.BERSERK, cooldown); - } - - public static void setGigaDrillBreakerCooldown(Player player, long cooldown) { - UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER, cooldown); - } - - public static void setGreenTerraCooldown(Player player, long cooldown) { - UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GREEN_TERRA, cooldown); - } - - public static void setSerratedStrikesCooldown(Player player, long cooldown) { - UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SERRATED_STRIKES, cooldown); - } - - public static void setSkullSplitterCooldown(Player player, long cooldown) { - UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SKULL_SPLITTER, cooldown); - } - - public static void setSuperBreakerCooldown(Player player, long cooldown) { - UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SUPER_BREAKER, cooldown); - } - - public static void setTreeFellerCooldown(Player player, long cooldown) { - UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.TREE_FELLER, cooldown); - } - - public static boolean isBleeding(LivingEntity entity) { - return BleedTimerTask.isBleeding(entity); - } -} +//package com.gmail.nossr50.api; +// +//import com.gmail.nossr50.datatypes.player.McMMOPlayer; +//import com.gmail.nossr50.datatypes.skills.SuperAbilityType; +//import com.gmail.nossr50.runnables.skills.BleedTimerTask; +//import com.gmail.nossr50.util.player.UserManager; +//import org.bukkit.entity.LivingEntity; +//import org.bukkit.entity.Player; +// +//public final class AbilityAPI { +// private AbilityAPI() { +// } +// +// public static boolean berserkEnabled(Player player) { +// return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.BERSERK); +// } +// +// public static boolean gigaDrillBreakerEnabled(Player player) { +// return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER); +// } +// +// public static boolean greenTerraEnabled(Player player) { +// return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GREEN_TERRA); +// } +// +// public static boolean serratedStrikesEnabled(Player player) { +// return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SERRATED_STRIKES); +// } +// +// public static boolean skullSplitterEnabled(Player player) { +// return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SKULL_SPLITTER); +// } +// +// public static boolean superBreakerEnabled(Player player) { +// return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SUPER_BREAKER); +// } +// +// public static boolean treeFellerEnabled(Player player) { +// return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.TREE_FELLER); +// } +// +// public static boolean isAnyAbilityEnabled(Player player) { +// McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); +// +// for (SuperAbilityType ability : SuperAbilityType.values()) { +// if (mcMMOPlayer.getAbilityMode(ability)) { +// return true; +// } +// } +// +// return false; +// } +// +// public static void resetCooldowns(Player player) { +// UserManager.getPlayer(player).resetCooldowns(); +// } +// +// public static void setBerserkCooldown(Player player, long cooldown) { +// UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.BERSERK, cooldown); +// } +// +// public static void setGigaDrillBreakerCooldown(Player player, long cooldown) { +// UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER, cooldown); +// } +// +// public static void setGreenTerraCooldown(Player player, long cooldown) { +// UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GREEN_TERRA, cooldown); +// } +// +// public static void setSerratedStrikesCooldown(Player player, long cooldown) { +// UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SERRATED_STRIKES, cooldown); +// } +// +// public static void setSkullSplitterCooldown(Player player, long cooldown) { +// UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SKULL_SPLITTER, cooldown); +// } +// +// public static void setSuperBreakerCooldown(Player player, long cooldown) { +// UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SUPER_BREAKER, cooldown); +// } +// +// public static void setTreeFellerCooldown(Player player, long cooldown) { +// UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.TREE_FELLER, cooldown); +// } +// +// public static boolean isBleeding(LivingEntity entity) { +// return BleedTimerTask.isBleeding(entity); +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/ChatAPI.java b/src/main/java/com/gmail/nossr50/api/ChatAPI.java index eb37c05e7..7d7aad775 100644 --- a/src/main/java/com/gmail/nossr50/api/ChatAPI.java +++ b/src/main/java/com/gmail/nossr50/api/ChatAPI.java @@ -1,154 +1,154 @@ -package com.gmail.nossr50.api; - -import com.gmail.nossr50.chat.ChatManager; -import com.gmail.nossr50.chat.ChatManagerFactory; -import com.gmail.nossr50.chat.PartyChatManager; -import com.gmail.nossr50.datatypes.chat.ChatMode; -import com.gmail.nossr50.party.PartyManager; -import com.gmail.nossr50.util.player.UserManager; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -public final class ChatAPI { - private ChatAPI() { - } - - /** - * Send a message to all members of a party - *
- * This function is designed for API usage. - * - * @param plugin The plugin sending the message - * @param sender The name of the sender - * @param displayName The display name of the sender - * @param party The name of the party to send to - * @param message The message to send - */ - public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) { - getPartyChatManager(plugin, party).handleChat(sender, displayName, message); - } - - /** - * Send a message to all members of a party - *
- * This function is designed for API usage. - * - * @param plugin The plugin sending the message - * @param sender The name of the sender to display in the chat - * @param party The name of the party to send to - * @param message The message to send - */ - public static void sendPartyChat(Plugin plugin, String sender, String party, String message) { - getPartyChatManager(plugin, party).handleChat(sender, message); - } - - /** - * Send a message to administrators - *
- * This function is designed for API usage. - * - * @param plugin The plugin sending the message - * @param sender The name of the sender - * @param displayName The display name of the sender - * @param message The message to send - */ - public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) { - ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, displayName, message); - } - - /** - * Send a message to administrators - *
- * This function is designed for API usage. - * - * @param plugin The plugin sending the message - * @param sender The name of the sender to display in the chat - * @param message The message to send - */ - public static void sendAdminChat(Plugin plugin, String sender, String message) { - ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, message); - } - - /** - * Check if a player is currently talking in party chat. - * - * @param player The player to check - * @return true if the player is using party chat, false otherwise - */ - public static boolean isUsingPartyChat(Player player) { - return UserManager.getPlayer(player).isChatEnabled(ChatMode.PARTY); - } - - /** - * Check if a player is currently talking in party chat. - * - * @param playerName The name of the player to check - * @return true if the player is using party chat, false otherwise - */ - public static boolean isUsingPartyChat(String playerName) { - return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.PARTY); - } - - /** - * Check if a player is currently talking in admin chat. - * - * @param player The player to check - * @return true if the player is using admin chat, false otherwise - */ - public static boolean isUsingAdminChat(Player player) { - return UserManager.getPlayer(player).isChatEnabled(ChatMode.ADMIN); - } - - /** - * Check if a player is currently talking in admin chat. - * - * @param playerName The name of the player to check - * @return true if the player is using admin chat, false otherwise - */ - public static boolean isUsingAdminChat(String playerName) { - return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.ADMIN); - } - - /** - * Toggle the party chat mode of a player. - * - * @param player The player to toggle party chat on. - */ - public static void togglePartyChat(Player player) { - UserManager.getPlayer(player).toggleChat(ChatMode.PARTY); - } - - /** - * Toggle the party chat mode of a player. - * - * @param playerName The name of the player to toggle party chat on. - */ - public static void togglePartyChat(String playerName) { - UserManager.getPlayer(playerName).toggleChat(ChatMode.PARTY); - } - - /** - * Toggle the admin chat mode of a player. - * - * @param player The player to toggle admin chat on. - */ - public static void toggleAdminChat(Player player) { - UserManager.getPlayer(player).toggleChat(ChatMode.ADMIN); - } - - /** - * Toggle the admin chat mode of a player. - * - * @param playerName The name of the player to toggle party chat on. - */ - public static void toggleAdminChat(String playerName) { - UserManager.getPlayer(playerName).toggleChat(ChatMode.ADMIN); - } - - private static ChatManager getPartyChatManager(Plugin plugin, String party) { - ChatManager chatManager = ChatManagerFactory.getChatManager(plugin, ChatMode.PARTY); - ((PartyChatManager) chatManager).setParty(PartyManager.getParty(party)); - - return chatManager; - } -} +//package com.gmail.nossr50.api; +// +//import com.gmail.nossr50.chat.ChatManager; +//import com.gmail.nossr50.chat.ChatManagerFactory; +//import com.gmail.nossr50.chat.PartyChatManager; +//import com.gmail.nossr50.datatypes.chat.ChatMode; +//import com.gmail.nossr50.party.PartyManager; +//import com.gmail.nossr50.util.player.UserManager; +//import org.bukkit.entity.Player; +//import org.bukkit.plugin.Plugin; +// +//public final class ChatAPI { +// private ChatAPI() { +// } +// +// /** +// * Send a message to all members of a party +// *
+// * This function is designed for API usage. +// * +// * @param plugin The plugin sending the message +// * @param sender The name of the sender +// * @param displayName The display name of the sender +// * @param party The name of the party to send to +// * @param message The message to send +// */ +// public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) { +// getPartyChatManager(plugin, party).handleChat(sender, displayName, message); +// } +// +// /** +// * Send a message to all members of a party +// *
+// * This function is designed for API usage. +// * +// * @param plugin The plugin sending the message +// * @param sender The name of the sender to display in the chat +// * @param party The name of the party to send to +// * @param message The message to send +// */ +// public static void sendPartyChat(Plugin plugin, String sender, String party, String message) { +// getPartyChatManager(plugin, party).handleChat(sender, message); +// } +// +// /** +// * Send a message to administrators +// *
+// * This function is designed for API usage. +// * +// * @param plugin The plugin sending the message +// * @param sender The name of the sender +// * @param displayName The display name of the sender +// * @param message The message to send +// */ +// public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) { +// ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, displayName, message); +// } +// +// /** +// * Send a message to administrators +// *
+// * This function is designed for API usage. +// * +// * @param plugin The plugin sending the message +// * @param sender The name of the sender to display in the chat +// * @param message The message to send +// */ +// public static void sendAdminChat(Plugin plugin, String sender, String message) { +// ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, message); +// } +// +// /** +// * Check if a player is currently talking in party chat. +// * +// * @param player The player to check +// * @return true if the player is using party chat, false otherwise +// */ +// public static boolean isUsingPartyChat(Player player) { +// return UserManager.getPlayer(player).isChatEnabled(ChatMode.PARTY); +// } +// +// /** +// * Check if a player is currently talking in party chat. +// * +// * @param playerName The name of the player to check +// * @return true if the player is using party chat, false otherwise +// */ +// public static boolean isUsingPartyChat(String playerName) { +// return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.PARTY); +// } +// +// /** +// * Check if a player is currently talking in admin chat. +// * +// * @param player The player to check +// * @return true if the player is using admin chat, false otherwise +// */ +// public static boolean isUsingAdminChat(Player player) { +// return UserManager.getPlayer(player).isChatEnabled(ChatMode.ADMIN); +// } +// +// /** +// * Check if a player is currently talking in admin chat. +// * +// * @param playerName The name of the player to check +// * @return true if the player is using admin chat, false otherwise +// */ +// public static boolean isUsingAdminChat(String playerName) { +// return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.ADMIN); +// } +// +// /** +// * Toggle the party chat mode of a player. +// * +// * @param player The player to toggle party chat on. +// */ +// public static void togglePartyChat(Player player) { +// UserManager.getPlayer(player).toggleChat(ChatMode.PARTY); +// } +// +// /** +// * Toggle the party chat mode of a player. +// * +// * @param playerName The name of the player to toggle party chat on. +// */ +// public static void togglePartyChat(String playerName) { +// UserManager.getPlayer(playerName).toggleChat(ChatMode.PARTY); +// } +// +// /** +// * Toggle the admin chat mode of a player. +// * +// * @param player The player to toggle admin chat on. +// */ +// public static void toggleAdminChat(Player player) { +// UserManager.getPlayer(player).toggleChat(ChatMode.ADMIN); +// } +// +// /** +// * Toggle the admin chat mode of a player. +// * +// * @param playerName The name of the player to toggle party chat on. +// */ +// public static void toggleAdminChat(String playerName) { +// UserManager.getPlayer(playerName).toggleChat(ChatMode.ADMIN); +// } +// +// private static ChatManager getPartyChatManager(Plugin plugin, String party) { +// ChatManager chatManager = ChatManagerFactory.getChatManager(plugin, ChatMode.PARTY); +// ((PartyChatManager) chatManager).setParty(PartyManager.getParty(party)); +// +// return chatManager; +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/DatabaseAPI.java b/src/main/java/com/gmail/nossr50/api/DatabaseAPI.java index 76caad65b..205baeba4 100644 --- a/src/main/java/com/gmail/nossr50/api/DatabaseAPI.java +++ b/src/main/java/com/gmail/nossr50/api/DatabaseAPI.java @@ -1,33 +1,33 @@ -package com.gmail.nossr50.api; - -import com.gmail.nossr50.datatypes.player.PlayerProfile; -import com.gmail.nossr50.mcMMO; - -import java.util.UUID; - -public class DatabaseAPI { - - /** - * Checks if a player exists in the mcMMO Database - * @param uuid player UUID - * @return true if the player exists in the DB, false if they do not - */ - public boolean doesPlayerExistInDB(String uuid) { - return doesPlayerExistInDB(UUID.fromString(uuid)); - } - - /** - * Checks if a player exists in the mcMMO Database - * @param uuid player UUID - * @return true if the player exists in the DB, false if they do not - */ - public boolean doesPlayerExistInDB(UUID uuid) { - PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid); - - if(playerProfile.isLoaded()) - return true; - else - return false; - } - -} +//package com.gmail.nossr50.api; +// +//import com.gmail.nossr50.datatypes.player.PlayerProfile; +//import com.gmail.nossr50.mcMMO; +// +//import java.util.UUID; +// +//public class DatabaseAPI { +// +// /** +// * Checks if a player exists in the mcMMO Database +// * @param uuid player UUID +// * @return true if the player exists in the DB, false if they do not +// */ +// public boolean doesPlayerExistInDB(String uuid) { +// return doesPlayerExistInDB(UUID.fromString(uuid)); +// } +// +// /** +// * Checks if a player exists in the mcMMO Database +// * @param uuid player UUID +// * @return true if the player exists in the DB, false if they do not +// */ +// public boolean doesPlayerExistInDB(UUID uuid) { +// PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid); +// +// if(playerProfile.isLoaded()) +// return true; +// else +// return false; +// } +// +//} diff --git a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java index 24a3be024..775d59461 100644 --- a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java +++ b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java @@ -1,1152 +1,1152 @@ -package com.gmail.nossr50.api; - -import com.gmail.nossr50.api.exceptions.*; -import com.gmail.nossr50.datatypes.experience.FormulaType; -import com.gmail.nossr50.datatypes.experience.XPGainReason; -import com.gmail.nossr50.datatypes.experience.XPGainSource; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.datatypes.player.PlayerProfile; -import com.gmail.nossr50.datatypes.skills.PrimarySkillType; -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.skills.child.FamilyTree; -import com.gmail.nossr50.util.player.UserManager; -import org.bukkit.block.BlockState; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.Set; -import java.util.UUID; - -public final class ExperienceAPI { - private ExperienceAPI() { - } - - /** - * Returns whether given string is a valid type of skill suitable for the - * other API calls in this class. - *
- * This function is designed for API usage. - * - * @param skillType A string that may or may not be a skill - * @return true if this is a valid mcMMO skill - */ - public static boolean isValidSkillType(String skillType) { - return PrimarySkillType.getSkill(skillType) != null; - } - - /** - * Grabs the XP multiplier for a player for this specific skill - * The multiplier will default to 1.0 and will be over written by any XP perks - * - * @param player target player - * @param primarySkillType target skill - * @return this players personal XP rate for target PrimarySkillType - */ - public double getPlayersPersonalXPRate(McMMOPlayer player, PrimarySkillType primarySkillType) { - //First check if the player has ANY of the custom perks - return player.getPlayerSpecificXPMult(primarySkillType); - } - - /** - * Returns whether the given skill type string is both valid and not a - * child skill. (Child skills have no XP of their own, and their level is - * derived from the parent(s).) - *
- * This function is designed for API usage. - * - * @param skillType the skill to check - * @return true if this is a valid, non-child mcMMO skill - */ - public static boolean isNonChildSkill(String skillType) { - PrimarySkillType skill = PrimarySkillType.getSkill(skillType); - - return skill != null && !skill.isChildSkill(); - } - - @Deprecated - public static void addRawXP(Player player, String skillType, int XP) { - addRawXP(player, skillType, (double) XP); - } - - /** - * Adds raw XP to the player. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @throws InvalidSkillException if the given skill is not valid - */ - @Deprecated - public static void addRawXP(Player player, String skillType, double XP) { - addRawXP(player, skillType, XP, "UNKNOWN"); - } - - /** - * Adds raw XP to the player. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @param xpGainReason The reason to gain XP - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidXPGainReasonException if the given xpGainReason is not valid - */ - public static void addRawXP(Player player, String skillType, double XP, String xpGainReason) { - addRawXP(player, skillType, XP, xpGainReason, false); - } - - /** - * Adds raw XP to the player. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @param xpGainReason The reason to gain XP - * @param isUnshared true if the XP cannot be shared with party members - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidXPGainReasonException if the given xpGainReason is not valid - */ - public static void addRawXP(Player player, String skillType, double XP, String xpGainReason, boolean isUnshared) { - if (isUnshared) { - getPlayer(player).beginUnsharedXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); - return; - } - - getPlayer(player).applyXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); - } - - /** - * Adds raw XP to an offline player. - *
- * This function is designed for API usage. - * - * @deprecated We're using double for our XP values now - * replaced by {@link #addRawXPOffline(String playerName, String skillType, double XP)} - */ - @Deprecated - public static void addRawXPOffline(String playerName, String skillType, int XP) { - addRawXPOffline(playerName, skillType, (double) XP); - } - - /** - * Adds raw XP to an offline player. - *
- * This function is designed for API usage. - * - * @param playerName The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @deprecated We're using uuids to get an offline player - * replaced by {@link #addRawXPOffline(UUID uuid, String skillType, double XP)} - */ - @Deprecated - public static void addRawXPOffline(String playerName, String skillType, double XP) { - addOfflineXP(playerName, getSkillType(skillType), (int) Math.floor(XP)); - } - - /** - * Adds raw XP to an offline player. - *
- * This function is designed for API usage. - * - * @param uuid The UUID of player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - */ - public static void addRawXPOffline(UUID uuid, String skillType, double XP) { - addOfflineXP(uuid, getSkillType(skillType), (int) Math.floor(XP)); - } - - /** - * Adds XP to the player, calculates for XP Rate only. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @throws InvalidSkillException if the given skill is not valid - */ - @Deprecated - public static void addMultipliedXP(Player player, String skillType, int XP) { - addMultipliedXP(player, skillType, XP, "UNKNOWN"); - } - - /** - * Adds XP to the player, calculates for XP Rate only. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @param xpGainReason The reason to gain XP - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidXPGainReasonException if the given xpGainReason is not valid - */ - public static void addMultipliedXP(Player player, String skillType, int XP, String xpGainReason) { - getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM); - } - - /** - * Adds XP to an offline player, calculates for XP Rate only. - *
- * This function is designed for API usage. - * - * @param playerName The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - */ - @Deprecated - public static void addMultipliedXPOffline(String playerName, String skillType, int XP) { - addOfflineXP(playerName, getSkillType(skillType), (int) (XP * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult())); - } - - /** - * Adds XP to the player, calculates for XP Rate and skill modifier. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @throws InvalidSkillException if the given skill is not valid - */ - @Deprecated - public static void addModifiedXP(Player player, String skillType, int XP) { - addModifiedXP(player, skillType, XP, "UNKNOWN"); - } - - /** - * Adds XP to the player, calculates for XP Rate and skill modifier. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @param xpGainReason The reason to gain XP - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidXPGainReasonException if the given xpGainReason is not valid - */ - public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason) { - addModifiedXP(player, skillType, XP, xpGainReason, false); - } - - /** - * Adds XP to the player, calculates for XP Rate and skill modifier. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @param xpGainReason The reason to gain XP - * @param isUnshared true if the XP cannot be shared with party members - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidXPGainReasonException if the given xpGainReason is not valid - */ - public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) { - PrimarySkillType skill = getSkillType(skillType); - - if (isUnshared) { - getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM); - return; - } - - getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM); - } - - /** - * Adds XP to an offline player, calculates for XP Rate and skill modifier. - *
- * This function is designed for API usage. - * - * @param playerName The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - */ - @Deprecated - public static void addModifiedXPOffline(String playerName, String skillType, int XP) { - PrimarySkillType skill = getSkillType(skillType); - - addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult())); - } - - /** - * Adds XP to the player, calculates for XP Rate, skill modifiers, perks, child skills, - * and party sharing. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @throws InvalidSkillException if the given skill is not valid - */ - @Deprecated - public static void addXP(Player player, String skillType, int XP) { - addXP(player, skillType, XP, "UNKNOWN"); - } - - /** - * Adds XP to the player, calculates for XP Rate, skill modifiers, perks, child skills, - * and party sharing. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @param xpGainReason The reason to gain XP - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidXPGainReasonException if the given xpGainReason is not valid - */ - public static void addXP(Player player, String skillType, int XP, String xpGainReason) { - addXP(player, skillType, XP, xpGainReason, false); - } - - /** - * Adds XP to the player, calculates for XP Rate, skill modifiers, perks, child skills, - * and party sharing. - *
- * This function is designed for API usage. - * - * @param player The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add - * @param xpGainReason The reason to gain XP - * @param isUnshared true if the XP cannot be shared with party members - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidXPGainReasonException if the given xpGainReason is not valid - */ - public static void addXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) { - if (isUnshared) { - getPlayer(player).beginUnsharedXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); - return; - } - - getPlayer(player).beginXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); - } - - /** - * Get the amount of XP a player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param player The player to get XP for - * @param skillType The skill to get XP for - * @return the amount of XP in a given skill - * @throws InvalidSkillException if the given skill is not valid - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static int getXP(Player player, String skillType) { - return getPlayer(player).getSkillXpLevel(getNonChildSkillType(skillType)); - } - - /** - * Get the amount of XP an offline player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param playerName The player to get XP for - * @param skillType The skill to get XP for - * @return the amount of XP in a given skill - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - @Deprecated - public static int getOfflineXP(String playerName, String skillType) { - return getOfflineProfile(playerName).getSkillXpLevel(getNonChildSkillType(skillType)); - } - - /** - * Get the amount of XP an offline player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param uuid The player to get XP for - * @param skillType The skill to get XP for - * @return the amount of XP in a given skill - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static int getOfflineXP(UUID uuid, String skillType) { - return getOfflineProfile(uuid).getSkillXpLevel(getNonChildSkillType(skillType)); - } - - /** - * Get the raw amount of XP a player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param player The player to get XP for - * @param skillType The skill to get XP for - * @return the amount of XP in a given skill - * @throws InvalidSkillException if the given skill is not valid - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static double getXPRaw(Player player, String skillType) { - return getPlayer(player).getSkillXpLevelRaw(getNonChildSkillType(skillType)); - } - - /** - * Get the raw amount of XP an offline player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param playerName The player to get XP for - * @param skillType The skill to get XP for - * @return the amount of XP in a given skill - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - @Deprecated - public static double getOfflineXPRaw(String playerName, String skillType) { - return getOfflineProfile(playerName).getSkillXpLevelRaw(getNonChildSkillType(skillType)); - } - - /** - * Get the raw amount of XP an offline player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param uuid The player to get XP for - * @param skillType The skill to get XP for - * @return the amount of XP in a given skill - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static double getOfflineXPRaw(UUID uuid, String skillType) { - return getOfflineProfile(uuid).getSkillXpLevelRaw(getNonChildSkillType(skillType)); - } - - /** - * Get the total amount of XP needed to reach the next level. - *
- * This function is designed for API usage. - * - * @param player The player to get the XP amount for - * @param skillType The skill to get the XP amount for - * @return the total amount of XP needed to reach the next level - * @throws InvalidSkillException if the given skill is not valid - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static int getXPToNextLevel(Player player, String skillType) { - return getPlayer(player).getXpToLevel(getNonChildSkillType(skillType)); - } - - /** - * Get the total amount of XP an offline player needs to reach the next level. - *
- * This function is designed for API usage. - * - * @param playerName The player to get XP for - * @param skillType The skill to get XP for - * @return the total amount of XP needed to reach the next level - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - @Deprecated - public static int getOfflineXPToNextLevel(String playerName, String skillType) { - return getOfflineProfile(playerName).getXpToLevel(getNonChildSkillType(skillType)); - } - - /** - * Get the total amount of XP an offline player needs to reach the next level. - *
- * This function is designed for API usage. - * - * @param uuid The player to get XP for - * @param skillType The skill to get XP for - * @return the total amount of XP needed to reach the next level - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static int getOfflineXPToNextLevel(UUID uuid, String skillType) { - return getOfflineProfile(uuid).getXpToLevel(getNonChildSkillType(skillType)); - } - - /** - * Get the amount of XP remaining until the next level. - *
- * This function is designed for API usage. - * - * @param player The player to get the XP amount for - * @param skillType The skill to get the XP amount for - * @return the amount of XP remaining until the next level - * @throws InvalidSkillException if the given skill is not valid - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static int getXPRemaining(Player player, String skillType) { - PrimarySkillType skill = getNonChildSkillType(skillType); - - PlayerProfile profile = getPlayer(player).getProfile(); - - return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill); - } - - /** - * Get the amount of XP an offline player has left before leveling up. - *
- * This function is designed for API usage. - * - * @param playerName The player to get XP for - * @param skillType The skill to get XP for - * @return the amount of XP needed to reach the next level - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - @Deprecated - public static int getOfflineXPRemaining(String playerName, String skillType) { - PrimarySkillType skill = getNonChildSkillType(skillType); - PlayerProfile profile = getOfflineProfile(playerName); - - return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill); - } - - /** - * Get the amount of XP an offline player has left before leveling up. - *
- * This function is designed for API usage. - * - * @param uuid The player to get XP for - * @param skillType The skill to get XP for - * @return the amount of XP needed to reach the next level - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static double getOfflineXPRemaining(UUID uuid, String skillType) { - PrimarySkillType skill = getNonChildSkillType(skillType); - PlayerProfile profile = getOfflineProfile(uuid); - - return profile.getXpToLevel(skill) - profile.getSkillXpLevelRaw(skill); - } - - /** - * Add levels to a skill. - *
- * This function is designed for API usage. - * - * @param player The player to add levels to - * @param skillType Type of skill to add levels to - * @param levels Number of levels to add - * @throws InvalidSkillException if the given skill is not valid - */ - public static void addLevel(Player player, String skillType, int levels) { - getPlayer(player).addLevels(getSkillType(skillType), levels); - } - - /** - * Add levels to a skill for an offline player. - *
- * This function is designed for API usage. - * - * @param playerName The player to add levels to - * @param skillType Type of skill to add levels to - * @param levels Number of levels to add - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - */ - @Deprecated - public static void addLevelOffline(String playerName, String skillType, int levels) { - PlayerProfile profile = getOfflineProfile(playerName); - PrimarySkillType skill = getSkillType(skillType); - - if (skill.isChildSkill()) { - Set parentSkills = FamilyTree.getParents(skill); - - for (PrimarySkillType parentSkill : parentSkills) { - profile.addLevels(parentSkill, (levels / parentSkills.size())); - } - - profile.scheduleAsyncSave(); - return; - } - - profile.addLevels(skill, levels); - profile.scheduleAsyncSave(); - } - - /** - * Add levels to a skill for an offline player. - *
- * This function is designed for API usage. - * - * @param uuid The player to add levels to - * @param skillType Type of skill to add levels to - * @param levels Number of levels to add - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - */ - public static void addLevelOffline(UUID uuid, String skillType, int levels) { - PlayerProfile profile = getOfflineProfile(uuid); - PrimarySkillType skill = getSkillType(skillType); - - if (skill.isChildSkill()) { - Set parentSkills = FamilyTree.getParents(skill); - - for (PrimarySkillType parentSkill : parentSkills) { - profile.addLevels(parentSkill, (levels / parentSkills.size())); - } - - profile.scheduleAsyncSave(); - return; - } - - profile.addLevels(skill, levels); - profile.scheduleAsyncSave(); - } - - /** - * Get the level a player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param player The player to get the level for - * @param skillType The skill to get the level for - * @return the level of a given skill - * @throws InvalidSkillException if the given skill is not valid - */ - @Deprecated - public static int getLevel(Player player, String skillType) { - return getPlayer(player).getSkillLevel(getSkillType(skillType)); - } - - /** - * Get the level a player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param player The player to get the level for - * @param skillType The skill to get the level for - * @return the level of a given skill - * - * @throws InvalidSkillException if the given skill is not valid - */ - public static int getLevel(Player player, PrimarySkillType skillType) { - return getPlayer(player).getSkillLevel(skillType); - } - - /** - * Get the level an offline player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param playerName The player to get the level for - * @param skillType The skill to get the level for - * @return the level of a given skill - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - */ - @Deprecated - public static int getLevelOffline(String playerName, String skillType) { - return getOfflineProfile(playerName).getSkillLevel(getSkillType(skillType)); - } - - /** - * Get the level an offline player has in a specific skill. - *
- * This function is designed for API usage. - * - * @param uuid The player to get the level for - * @param skillType The skill to get the level for - * @return the level of a given skill - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - */ - public static int getLevelOffline(UUID uuid, String skillType) { - return getOfflineProfile(uuid).getSkillLevel(getSkillType(skillType)); - } - - /** - * Gets the power level of a player. - *
- * This function is designed for API usage. - * - * @param player The player to get the power level for - * @return the power level of the player - */ - public static int getPowerLevel(Player player) { - return getPlayer(player).getPowerLevel(); - } - - /** - * Gets the power level of an offline player. - *
- * This function is designed for API usage. - * - * @param playerName The player to get the power level for - * @return the power level of the player - * @throws InvalidPlayerException if the given player does not exist in the database - */ - @Deprecated - public static int getPowerLevelOffline(String playerName) { - int powerLevel = 0; - PlayerProfile profile = getOfflineProfile(playerName); - - for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) { - powerLevel += profile.getSkillLevel(type); - } - - return powerLevel; - } - - /** - * Gets the power level of an offline player. - *
- * This function is designed for API usage. - * - * @param uuid The player to get the power level for - * @return the power level of the player - * @throws InvalidPlayerException if the given player does not exist in the database - */ - public static int getPowerLevelOffline(UUID uuid) { - int powerLevel = 0; - PlayerProfile profile = getOfflineProfile(uuid); - - for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) { - powerLevel += profile.getSkillLevel(type); - } - - return powerLevel; - } - - /** - * Get the level cap of a specific skill. - *
- * This function is designed for API usage. - * - * @param skillType The skill to get the level cap for - * @return the level cap of a given skill - * @throws InvalidSkillException if the given skill is not valid - */ - public static int getLevelCap(String skillType) { - return mcMMO.getPlayerLevelingSettings().getSkillLevelCap(getSkillType(skillType)); - } - - /** - * Get the level cap of a specific skill. - *
- * This function is designed for API usage. - * - * @param skillType The skill to get the level cap for - * @return the level cap of a given skill - * @throws InvalidSkillException if the given skill is not valid - */ - public static int getLevelCap(PrimarySkillType skillType) { - return mcMMO.getPlayerLevelingSettings().getSkillLevelCap(skillType); - } - - /** - * Checks whether or not a specific skill is level capped - * - * @param skillType target skill - * @return true if the skill has a level cap - */ - public static boolean isSkillLevelCapped(PrimarySkillType skillType) { - return mcMMO.getPlayerLevelingSettings().isSkillLevelCapEnabled(skillType); - } - - /** - * Get the power level cap. - *
- * This function is designed for API usage. - * - * @return the overall power level cap - */ - public static int getPowerLevelCap() { - return mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevelSettings().getLevelCap(); - } - - /** - * Get the position on the leaderboard of a player. - *
- * This function is designed for API usage. - * - * @param playerName The name of the player to check - * @param skillType The skill to check - * @return the position on the leaderboard - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - @Deprecated - public static int getPlayerRankSkill(String playerName, String skillType) { - return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(playerName).getName()).get(getNonChildSkillType(skillType)); - } - - /** - * Get the position on the leaderboard of a player. - *
- * This function is designed for API usage. - * - * @param uuid The name of the player to check - * @param skillType The skill to check - * @return the position on the leaderboard - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static int getPlayerRankSkill(UUID uuid, String skillType) { - return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(uuid).getName()).get(getNonChildSkillType(skillType)); - } - - /** - * Get the position on the power level leaderboard of a player. - *
- * This function is designed for API usage. - * - * @param playerName The name of the player to check - * @return the position on the power level leaderboard - * @throws InvalidPlayerException if the given player does not exist in the database - */ - @Deprecated - public static int getPlayerRankOverall(String playerName) { - return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(playerName).getName()).get(null); - } - - /** - * Get the position on the power level leaderboard of a player. - *
- * This function is designed for API usage. - * - * @param uuid The name of the player to check - * @return the position on the power level leaderboard - * @throws InvalidPlayerException if the given player does not exist in the database - */ - public static int getPlayerRankOverall(UUID uuid) { - return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(uuid).getName()).get(null); - } - - /** - * Sets the level of a player in a specific skill type. - *
- * This function is designed for API usage. - * - * @param player The player to set the level of - * @param skillType The skill to set the level for - * @param skillLevel The value to set the level to - * @throws InvalidSkillException if the given skill is not valid - */ - public static void setLevel(Player player, String skillType, int skillLevel) { - getPlayer(player).modifySkill(getSkillType(skillType), skillLevel); - } - - /** - * Sets the level of an offline player in a specific skill type. - *
- * This function is designed for API usage. - * - * @param playerName The player to set the level of - * @param skillType The skill to set the level for - * @param skillLevel The value to set the level to - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - */ - @Deprecated - public static void setLevelOffline(String playerName, String skillType, int skillLevel) { - getOfflineProfile(playerName).modifySkill(getSkillType(skillType), skillLevel); - } - - /** - * Sets the level of an offline player in a specific skill type. - *
- * This function is designed for API usage. - * - * @param uuid The player to set the level of - * @param skillType The skill to set the level for - * @param skillLevel The value to set the level to - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - */ - public static void setLevelOffline(UUID uuid, String skillType, int skillLevel) { - getOfflineProfile(uuid).modifySkill(getSkillType(skillType), skillLevel); - } - - /** - * Sets the XP of a player in a specific skill type. - *
- * This function is designed for API usage. - * - * @param player The player to set the XP of - * @param skillType The skill to set the XP for - * @param newValue The value to set the XP to - * @throws InvalidSkillException if the given skill is not valid - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static void setXP(Player player, String skillType, int newValue) { - getPlayer(player).setSkillXpLevel(getNonChildSkillType(skillType), newValue); - } - - /** - * Sets the XP of an offline player in a specific skill type. - *
- * This function is designed for API usage. - * - * @param playerName The player to set the XP of - * @param skillType The skill to set the XP for - * @param newValue The value to set the XP to - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - @Deprecated - public static void setXPOffline(String playerName, String skillType, int newValue) { - getOfflineProfile(playerName).setSkillXpLevel(getNonChildSkillType(skillType), newValue); - } - - /** - * Sets the XP of an offline player in a specific skill type. - *
- * This function is designed for API usage. - * - * @param uuid The player to set the XP of - * @param skillType The skill to set the XP for - * @param newValue The value to set the XP to - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static void setXPOffline(UUID uuid, String skillType, int newValue) { - getOfflineProfile(uuid).setSkillXpLevel(getNonChildSkillType(skillType), newValue); - } - - /** - * Removes XP from a player in a specific skill type. - *
- * This function is designed for API usage. - * - * @param player The player to change the XP of - * @param skillType The skill to change the XP for - * @param xp The amount of XP to remove - * @throws InvalidSkillException if the given skill is not valid - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static void removeXP(Player player, String skillType, int xp) { - getPlayer(player).removeXp(getNonChildSkillType(skillType), xp); - } - - /** - * Removes XP from an offline player in a specific skill type. - *
- * This function is designed for API usage. - * - * @param playerName The player to change the XP of - * @param skillType The skill to change the XP for - * @param xp The amount of XP to remove - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - @Deprecated - public static void removeXPOffline(String playerName, String skillType, int xp) { - getOfflineProfile(playerName).removeXp(getNonChildSkillType(skillType), xp); - } - - /** - * Removes XP from an offline player in a specific skill type. - *
- * This function is designed for API usage. - * - * @param uuid The player to change the XP of - * @param skillType The skill to change the XP for - * @param xp The amount of XP to remove - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidPlayerException if the given player does not exist in the database - * @throws UnsupportedOperationException if the given skill is a child skill - */ - public static void removeXPOffline(UUID uuid, String skillType, int xp) { - getOfflineProfile(uuid).removeXp(getNonChildSkillType(skillType), xp); - } - - /** - * Check how much XP is needed for a specific level with the selected level curve. - *
- * This function is designed for API usage. - * - * @param level The level to get the amount of XP for - * @throws InvalidFormulaTypeException if the given formulaType is not valid - */ - public static int getXpNeededToLevel(int level) { - return mcMMO.getFormulaManager().getXPtoNextLevel(level, mcMMO.getConfigManager().getConfigLeveling().getFormulaType()); - } - - /** - * Check how much XP is needed for a specific level with the provided level curve. - *
- * This function is designed for API usage. - * - * @param level The level to get the amount of XP for - * @param formulaType The formula type to get the amount of XP for - * @throws InvalidFormulaTypeException if the given formulaType is not valid - * @deprecated Discouraged - Most the time you do not want to provide the formula type yourself, use the other method - */ - public static int getXpNeededToLevel(int level, FormulaType formulaType) { - return mcMMO.getFormulaManager().getXPtoNextLevel(level, formulaType); - } - - /** - * Will add the appropriate type of XP from the block to the player based on the material of the blocks given - * - * @param blockStates the blocks to reward XP for - * @param mcMMOPlayer the target player - */ - public static void addXpFromBlocks(ArrayList blockStates, McMMOPlayer mcMMOPlayer) { - for (BlockState bs : blockStates) { - for (PrimarySkillType skillType : PrimarySkillType.values()) { - if (mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, bs.getType()) > 0) { - mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF); - } - } - } - } - - /** - * Will add the appropriate type of XP from the block to the player based on the material of the blocks given if it matches the given skillType - * - * @param blockStates the blocks to reward XP for - * @param mcMMOPlayer the target player - * @param skillType target primary skill - */ - public static void addXpFromBlocksBySkill(ArrayList blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) { - for (BlockState bs : blockStates) { - if (mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, bs.getType()) > 0) { - mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF); - } - } - } - - /** - * Will add the appropriate type of XP from the block to the player based on the material of the blocks given - * - * @param blockState The target blockstate - * @param mcMMOPlayer The target player - */ - public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) { - for (PrimarySkillType skillType : PrimarySkillType.values()) { - if (mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, blockState.getType()) > 0) { - mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF); - } - } - } - - /** - * Will add the appropriate type of XP from the block to the player based on the material of the blocks given if it matches the given skillType - * - * @param blockState The target blockstate - * @param mcMMOPlayer The target player - * @param skillType target primary skill - */ - public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) { - if (mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, blockState.getType()) > 0) { - mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF); - } - } - - - // Utility methods follow. - private static void addOfflineXP(UUID playerUniqueId, PrimarySkillType skill, int XP) { - PlayerProfile profile = getOfflineProfile(playerUniqueId); - - profile.addXp(skill, XP); - profile.save(true); - } - - @Deprecated - private static void addOfflineXP(String playerName, PrimarySkillType skill, int XP) { - PlayerProfile profile = getOfflineProfile(playerName); - - profile.addXp(skill, XP); - profile.scheduleAsyncSave(); - } - - private static PlayerProfile getOfflineProfile(UUID uuid) { - PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid); - - if (!profile.isLoaded()) { - throw new InvalidPlayerException(); - } - - return profile; - } - - @Deprecated - private static PlayerProfile getOfflineProfile(String playerName) { - UUID uuid = mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(); - PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid); - - if (!profile.isLoaded()) { - throw new InvalidPlayerException(); - } - - return profile; - } - - private static PrimarySkillType getSkillType(String skillType) throws InvalidSkillException { - PrimarySkillType skill = PrimarySkillType.getSkill(skillType); - - if (skill == null) { - throw new InvalidSkillException(skillType); - } - - return skill; - } - - private static PrimarySkillType getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException { - PrimarySkillType skill = getSkillType(skillType); - - if (skill.isChildSkill()) { - throw new UnsupportedOperationException("Child skills do not have XP"); - } - - return skill; - } - - private static XPGainReason getXPGainReason(String reason) throws InvalidXPGainReasonException { - XPGainReason xpGainReason = XPGainReason.getXPGainReason(reason); - - if (xpGainReason == null) { - throw new InvalidXPGainReasonException(); - } - - return xpGainReason; - } - - /** - * @param player target player - * @return McMMOPlayer for that player if the profile is loaded, otherwise null - * @throws McMMOPlayerNotFoundException - * @deprecated Use UserManager::getPlayer(Player player) instead - */ - @Deprecated - private static McMMOPlayer getPlayer(Player player) throws McMMOPlayerNotFoundException { - if (!UserManager.hasPlayerDataKey(player)) { - throw new McMMOPlayerNotFoundException(player); - } - - return UserManager.getPlayer(player); - } -} +//package com.gmail.nossr50.api; +// +//import com.gmail.nossr50.api.exceptions.*; +//import com.gmail.nossr50.datatypes.experience.FormulaType; +//import com.gmail.nossr50.datatypes.experience.XPGainReason; +//import com.gmail.nossr50.datatypes.experience.XPGainSource; +//import com.gmail.nossr50.datatypes.player.McMMOPlayer; +//import com.gmail.nossr50.datatypes.player.PlayerProfile; +//import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +//import com.gmail.nossr50.mcMMO; +//import com.gmail.nossr50.skills.child.FamilyTree; +//import com.gmail.nossr50.util.player.UserManager; +//import org.bukkit.block.BlockState; +//import org.bukkit.entity.Player; +// +//import java.util.ArrayList; +//import java.util.Set; +//import java.util.UUID; +// +//public final class ExperienceAPI { +// private ExperienceAPI() { +// } +// +// /** +// * Returns whether given string is a valid type of skill suitable for the +// * other API calls in this class. +// *
+// * This function is designed for API usage. +// * +// * @param skillType A string that may or may not be a skill +// * @return true if this is a valid mcMMO skill +// */ +// public static boolean isValidSkillType(String skillType) { +// return PrimarySkillType.getSkill(skillType) != null; +// } +// +// /** +// * Grabs the XP multiplier for a player for this specific skill +// * The multiplier will default to 1.0 and will be over written by any XP perks +// * +// * @param player target player +// * @param primarySkillType target skill +// * @return this players personal XP rate for target PrimarySkillType +// */ +// public double getPlayersPersonalXPRate(McMMOPlayer player, PrimarySkillType primarySkillType) { +// //First check if the player has ANY of the custom perks +// return player.getPlayerSpecificXPMult(primarySkillType); +// } +// +// /** +// * Returns whether the given skill type string is both valid and not a +// * child skill. (Child skills have no XP of their own, and their level is +// * derived from the parent(s).) +// *
+// * This function is designed for API usage. +// * +// * @param skillType the skill to check +// * @return true if this is a valid, non-child mcMMO skill +// */ +// public static boolean isNonChildSkill(String skillType) { +// PrimarySkillType skill = PrimarySkillType.getSkill(skillType); +// +// return skill != null && !skill.isChildSkill(); +// } +// +// @Deprecated +// public static void addRawXP(Player player, String skillType, int XP) { +// addRawXP(player, skillType, (double) XP); +// } +// +// /** +// * Adds raw XP to the player. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @throws InvalidSkillException if the given skill is not valid +// */ +// @Deprecated +// public static void addRawXP(Player player, String skillType, double XP) { +// addRawXP(player, skillType, XP, "UNKNOWN"); +// } +// +// /** +// * Adds raw XP to the player. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @param xpGainReason The reason to gain XP +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidXPGainReasonException if the given xpGainReason is not valid +// */ +// public static void addRawXP(Player player, String skillType, double XP, String xpGainReason) { +// addRawXP(player, skillType, XP, xpGainReason, false); +// } +// +// /** +// * Adds raw XP to the player. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @param xpGainReason The reason to gain XP +// * @param isUnshared true if the XP cannot be shared with party members +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidXPGainReasonException if the given xpGainReason is not valid +// */ +// public static void addRawXP(Player player, String skillType, double XP, String xpGainReason, boolean isUnshared) { +// if (isUnshared) { +// getPlayer(player).beginUnsharedXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); +// return; +// } +// +// getPlayer(player).applyXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); +// } +// +// /** +// * Adds raw XP to an offline player. +// *
+// * This function is designed for API usage. +// * +// * @deprecated We're using double for our XP values now +// * replaced by {@link #addRawXPOffline(String playerName, String skillType, double XP)} +// */ +// @Deprecated +// public static void addRawXPOffline(String playerName, String skillType, int XP) { +// addRawXPOffline(playerName, skillType, (double) XP); +// } +// +// /** +// * Adds raw XP to an offline player. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @deprecated We're using uuids to get an offline player +// * replaced by {@link #addRawXPOffline(UUID uuid, String skillType, double XP)} +// */ +// @Deprecated +// public static void addRawXPOffline(String playerName, String skillType, double XP) { +// addOfflineXP(playerName, getSkillType(skillType), (int) Math.floor(XP)); +// } +// +// /** +// * Adds raw XP to an offline player. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The UUID of player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// public static void addRawXPOffline(UUID uuid, String skillType, double XP) { +// addOfflineXP(uuid, getSkillType(skillType), (int) Math.floor(XP)); +// } +// +// /** +// * Adds XP to the player, calculates for XP Rate only. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @throws InvalidSkillException if the given skill is not valid +// */ +// @Deprecated +// public static void addMultipliedXP(Player player, String skillType, int XP) { +// addMultipliedXP(player, skillType, XP, "UNKNOWN"); +// } +// +// /** +// * Adds XP to the player, calculates for XP Rate only. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @param xpGainReason The reason to gain XP +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidXPGainReasonException if the given xpGainReason is not valid +// */ +// public static void addMultipliedXP(Player player, String skillType, int XP, String xpGainReason) { +// getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM); +// } +// +// /** +// * Adds XP to an offline player, calculates for XP Rate only. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// @Deprecated +// public static void addMultipliedXPOffline(String playerName, String skillType, int XP) { +// addOfflineXP(playerName, getSkillType(skillType), (int) (XP * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult())); +// } +// +// /** +// * Adds XP to the player, calculates for XP Rate and skill modifier. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @throws InvalidSkillException if the given skill is not valid +// */ +// @Deprecated +// public static void addModifiedXP(Player player, String skillType, int XP) { +// addModifiedXP(player, skillType, XP, "UNKNOWN"); +// } +// +// /** +// * Adds XP to the player, calculates for XP Rate and skill modifier. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @param xpGainReason The reason to gain XP +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidXPGainReasonException if the given xpGainReason is not valid +// */ +// public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason) { +// addModifiedXP(player, skillType, XP, xpGainReason, false); +// } +// +// /** +// * Adds XP to the player, calculates for XP Rate and skill modifier. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @param xpGainReason The reason to gain XP +// * @param isUnshared true if the XP cannot be shared with party members +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidXPGainReasonException if the given xpGainReason is not valid +// */ +// public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) { +// PrimarySkillType skill = getSkillType(skillType); +// +// if (isUnshared) { +// getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM); +// return; +// } +// +// getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM); +// } +// +// /** +// * Adds XP to an offline player, calculates for XP Rate and skill modifier. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// @Deprecated +// public static void addModifiedXPOffline(String playerName, String skillType, int XP) { +// PrimarySkillType skill = getSkillType(skillType); +// +// addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult())); +// } +// +// /** +// * Adds XP to the player, calculates for XP Rate, skill modifiers, perks, child skills, +// * and party sharing. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @throws InvalidSkillException if the given skill is not valid +// */ +// @Deprecated +// public static void addXP(Player player, String skillType, int XP) { +// addXP(player, skillType, XP, "UNKNOWN"); +// } +// +// /** +// * Adds XP to the player, calculates for XP Rate, skill modifiers, perks, child skills, +// * and party sharing. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @param xpGainReason The reason to gain XP +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidXPGainReasonException if the given xpGainReason is not valid +// */ +// public static void addXP(Player player, String skillType, int XP, String xpGainReason) { +// addXP(player, skillType, XP, xpGainReason, false); +// } +// +// /** +// * Adds XP to the player, calculates for XP Rate, skill modifiers, perks, child skills, +// * and party sharing. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add XP to +// * @param skillType The skill to add XP to +// * @param XP The amount of XP to add +// * @param xpGainReason The reason to gain XP +// * @param isUnshared true if the XP cannot be shared with party members +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidXPGainReasonException if the given xpGainReason is not valid +// */ +// public static void addXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) { +// if (isUnshared) { +// getPlayer(player).beginUnsharedXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); +// return; +// } +// +// getPlayer(player).beginXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason), XPGainSource.CUSTOM); +// } +// +// /** +// * Get the amount of XP a player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to get XP for +// * @param skillType The skill to get XP for +// * @return the amount of XP in a given skill +// * @throws InvalidSkillException if the given skill is not valid +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static int getXP(Player player, String skillType) { +// return getPlayer(player).getSkillXpLevel(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the amount of XP an offline player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to get XP for +// * @param skillType The skill to get XP for +// * @return the amount of XP in a given skill +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// @Deprecated +// public static int getOfflineXP(String playerName, String skillType) { +// return getOfflineProfile(playerName).getSkillXpLevel(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the amount of XP an offline player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to get XP for +// * @param skillType The skill to get XP for +// * @return the amount of XP in a given skill +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static int getOfflineXP(UUID uuid, String skillType) { +// return getOfflineProfile(uuid).getSkillXpLevel(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the raw amount of XP a player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to get XP for +// * @param skillType The skill to get XP for +// * @return the amount of XP in a given skill +// * @throws InvalidSkillException if the given skill is not valid +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static double getXPRaw(Player player, String skillType) { +// return getPlayer(player).getSkillXpLevelRaw(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the raw amount of XP an offline player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to get XP for +// * @param skillType The skill to get XP for +// * @return the amount of XP in a given skill +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// @Deprecated +// public static double getOfflineXPRaw(String playerName, String skillType) { +// return getOfflineProfile(playerName).getSkillXpLevelRaw(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the raw amount of XP an offline player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to get XP for +// * @param skillType The skill to get XP for +// * @return the amount of XP in a given skill +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static double getOfflineXPRaw(UUID uuid, String skillType) { +// return getOfflineProfile(uuid).getSkillXpLevelRaw(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the total amount of XP needed to reach the next level. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to get the XP amount for +// * @param skillType The skill to get the XP amount for +// * @return the total amount of XP needed to reach the next level +// * @throws InvalidSkillException if the given skill is not valid +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static int getXPToNextLevel(Player player, String skillType) { +// return getPlayer(player).getXpToLevel(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the total amount of XP an offline player needs to reach the next level. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to get XP for +// * @param skillType The skill to get XP for +// * @return the total amount of XP needed to reach the next level +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// @Deprecated +// public static int getOfflineXPToNextLevel(String playerName, String skillType) { +// return getOfflineProfile(playerName).getXpToLevel(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the total amount of XP an offline player needs to reach the next level. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to get XP for +// * @param skillType The skill to get XP for +// * @return the total amount of XP needed to reach the next level +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static int getOfflineXPToNextLevel(UUID uuid, String skillType) { +// return getOfflineProfile(uuid).getXpToLevel(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the amount of XP remaining until the next level. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to get the XP amount for +// * @param skillType The skill to get the XP amount for +// * @return the amount of XP remaining until the next level +// * @throws InvalidSkillException if the given skill is not valid +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static int getXPRemaining(Player player, String skillType) { +// PrimarySkillType skill = getNonChildSkillType(skillType); +// +// PlayerProfile profile = getPlayer(player).getProfile(); +// +// return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill); +// } +// +// /** +// * Get the amount of XP an offline player has left before leveling up. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to get XP for +// * @param skillType The skill to get XP for +// * @return the amount of XP needed to reach the next level +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// @Deprecated +// public static int getOfflineXPRemaining(String playerName, String skillType) { +// PrimarySkillType skill = getNonChildSkillType(skillType); +// PlayerProfile profile = getOfflineProfile(playerName); +// +// return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill); +// } +// +// /** +// * Get the amount of XP an offline player has left before leveling up. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to get XP for +// * @param skillType The skill to get XP for +// * @return the amount of XP needed to reach the next level +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static double getOfflineXPRemaining(UUID uuid, String skillType) { +// PrimarySkillType skill = getNonChildSkillType(skillType); +// PlayerProfile profile = getOfflineProfile(uuid); +// +// return profile.getXpToLevel(skill) - profile.getSkillXpLevelRaw(skill); +// } +// +// /** +// * Add levels to a skill. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add levels to +// * @param skillType Type of skill to add levels to +// * @param levels Number of levels to add +// * @throws InvalidSkillException if the given skill is not valid +// */ +// public static void addLevel(Player player, String skillType, int levels) { +// getPlayer(player).addLevels(getSkillType(skillType), levels); +// } +// +// /** +// * Add levels to a skill for an offline player. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to add levels to +// * @param skillType Type of skill to add levels to +// * @param levels Number of levels to add +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// @Deprecated +// public static void addLevelOffline(String playerName, String skillType, int levels) { +// PlayerProfile profile = getOfflineProfile(playerName); +// PrimarySkillType skill = getSkillType(skillType); +// +// if (skill.isChildSkill()) { +// Set parentSkills = FamilyTree.getParents(skill); +// +// for (PrimarySkillType parentSkill : parentSkills) { +// profile.addLevels(parentSkill, (levels / parentSkills.size())); +// } +// +// profile.scheduleAsyncSave(); +// return; +// } +// +// profile.addLevels(skill, levels); +// profile.scheduleAsyncSave(); +// } +// +// /** +// * Add levels to a skill for an offline player. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to add levels to +// * @param skillType Type of skill to add levels to +// * @param levels Number of levels to add +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// public static void addLevelOffline(UUID uuid, String skillType, int levels) { +// PlayerProfile profile = getOfflineProfile(uuid); +// PrimarySkillType skill = getSkillType(skillType); +// +// if (skill.isChildSkill()) { +// Set parentSkills = FamilyTree.getParents(skill); +// +// for (PrimarySkillType parentSkill : parentSkills) { +// profile.addLevels(parentSkill, (levels / parentSkills.size())); +// } +// +// profile.scheduleAsyncSave(); +// return; +// } +// +// profile.addLevels(skill, levels); +// profile.scheduleAsyncSave(); +// } +// +// /** +// * Get the level a player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to get the level for +// * @param skillType The skill to get the level for +// * @return the level of a given skill +// * @throws InvalidSkillException if the given skill is not valid +// */ +// @Deprecated +// public static int getLevel(Player player, String skillType) { +// return getPlayer(player).getSkillLevel(getSkillType(skillType)); +// } +// +// /** +// * Get the level a player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to get the level for +// * @param skillType The skill to get the level for +// * @return the level of a given skill +// * +// * @throws InvalidSkillException if the given skill is not valid +// */ +// public static int getLevel(Player player, PrimarySkillType skillType) { +// return getPlayer(player).getSkillLevel(skillType); +// } +// +// /** +// * Get the level an offline player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to get the level for +// * @param skillType The skill to get the level for +// * @return the level of a given skill +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// @Deprecated +// public static int getLevelOffline(String playerName, String skillType) { +// return getOfflineProfile(playerName).getSkillLevel(getSkillType(skillType)); +// } +// +// /** +// * Get the level an offline player has in a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to get the level for +// * @param skillType The skill to get the level for +// * @return the level of a given skill +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// public static int getLevelOffline(UUID uuid, String skillType) { +// return getOfflineProfile(uuid).getSkillLevel(getSkillType(skillType)); +// } +// +// /** +// * Gets the power level of a player. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to get the power level for +// * @return the power level of the player +// */ +// public static int getPowerLevel(Player player) { +// return getPlayer(player).getPowerLevel(); +// } +// +// /** +// * Gets the power level of an offline player. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to get the power level for +// * @return the power level of the player +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// @Deprecated +// public static int getPowerLevelOffline(String playerName) { +// int powerLevel = 0; +// PlayerProfile profile = getOfflineProfile(playerName); +// +// for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) { +// powerLevel += profile.getSkillLevel(type); +// } +// +// return powerLevel; +// } +// +// /** +// * Gets the power level of an offline player. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to get the power level for +// * @return the power level of the player +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// public static int getPowerLevelOffline(UUID uuid) { +// int powerLevel = 0; +// PlayerProfile profile = getOfflineProfile(uuid); +// +// for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) { +// powerLevel += profile.getSkillLevel(type); +// } +// +// return powerLevel; +// } +// +// /** +// * Get the level cap of a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param skillType The skill to get the level cap for +// * @return the level cap of a given skill +// * @throws InvalidSkillException if the given skill is not valid +// */ +// public static int getLevelCap(String skillType) { +// return mcMMO.getPlayerLevelingSettings().getSkillLevelCap(getSkillType(skillType)); +// } +// +// /** +// * Get the level cap of a specific skill. +// *
+// * This function is designed for API usage. +// * +// * @param skillType The skill to get the level cap for +// * @return the level cap of a given skill +// * @throws InvalidSkillException if the given skill is not valid +// */ +// public static int getLevelCap(PrimarySkillType skillType) { +// return mcMMO.getPlayerLevelingSettings().getSkillLevelCap(skillType); +// } +// +// /** +// * Checks whether or not a specific skill is level capped +// * +// * @param skillType target skill +// * @return true if the skill has a level cap +// */ +// public static boolean isSkillLevelCapped(PrimarySkillType skillType) { +// return mcMMO.getPlayerLevelingSettings().isSkillLevelCapEnabled(skillType); +// } +// +// /** +// * Get the power level cap. +// *
+// * This function is designed for API usage. +// * +// * @return the overall power level cap +// */ +// public static int getPowerLevelCap() { +// return mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevelSettings().getLevelCap(); +// } +// +// /** +// * Get the position on the leaderboard of a player. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The name of the player to check +// * @param skillType The skill to check +// * @return the position on the leaderboard +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// @Deprecated +// public static int getPlayerRankSkill(String playerName, String skillType) { +// return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(playerName).getName()).get(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the position on the leaderboard of a player. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The name of the player to check +// * @param skillType The skill to check +// * @return the position on the leaderboard +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static int getPlayerRankSkill(UUID uuid, String skillType) { +// return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(uuid).getName()).get(getNonChildSkillType(skillType)); +// } +// +// /** +// * Get the position on the power level leaderboard of a player. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The name of the player to check +// * @return the position on the power level leaderboard +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// @Deprecated +// public static int getPlayerRankOverall(String playerName) { +// return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(playerName).getName()).get(null); +// } +// +// /** +// * Get the position on the power level leaderboard of a player. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The name of the player to check +// * @return the position on the power level leaderboard +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// public static int getPlayerRankOverall(UUID uuid) { +// return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(uuid).getName()).get(null); +// } +// +// /** +// * Sets the level of a player in a specific skill type. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to set the level of +// * @param skillType The skill to set the level for +// * @param skillLevel The value to set the level to +// * @throws InvalidSkillException if the given skill is not valid +// */ +// public static void setLevel(Player player, String skillType, int skillLevel) { +// getPlayer(player).modifySkill(getSkillType(skillType), skillLevel); +// } +// +// /** +// * Sets the level of an offline player in a specific skill type. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to set the level of +// * @param skillType The skill to set the level for +// * @param skillLevel The value to set the level to +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// @Deprecated +// public static void setLevelOffline(String playerName, String skillType, int skillLevel) { +// getOfflineProfile(playerName).modifySkill(getSkillType(skillType), skillLevel); +// } +// +// /** +// * Sets the level of an offline player in a specific skill type. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to set the level of +// * @param skillType The skill to set the level for +// * @param skillLevel The value to set the level to +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// */ +// public static void setLevelOffline(UUID uuid, String skillType, int skillLevel) { +// getOfflineProfile(uuid).modifySkill(getSkillType(skillType), skillLevel); +// } +// +// /** +// * Sets the XP of a player in a specific skill type. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to set the XP of +// * @param skillType The skill to set the XP for +// * @param newValue The value to set the XP to +// * @throws InvalidSkillException if the given skill is not valid +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static void setXP(Player player, String skillType, int newValue) { +// getPlayer(player).setSkillXpLevel(getNonChildSkillType(skillType), newValue); +// } +// +// /** +// * Sets the XP of an offline player in a specific skill type. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to set the XP of +// * @param skillType The skill to set the XP for +// * @param newValue The value to set the XP to +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// @Deprecated +// public static void setXPOffline(String playerName, String skillType, int newValue) { +// getOfflineProfile(playerName).setSkillXpLevel(getNonChildSkillType(skillType), newValue); +// } +// +// /** +// * Sets the XP of an offline player in a specific skill type. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to set the XP of +// * @param skillType The skill to set the XP for +// * @param newValue The value to set the XP to +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static void setXPOffline(UUID uuid, String skillType, int newValue) { +// getOfflineProfile(uuid).setSkillXpLevel(getNonChildSkillType(skillType), newValue); +// } +// +// /** +// * Removes XP from a player in a specific skill type. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to change the XP of +// * @param skillType The skill to change the XP for +// * @param xp The amount of XP to remove +// * @throws InvalidSkillException if the given skill is not valid +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static void removeXP(Player player, String skillType, int xp) { +// getPlayer(player).removeXp(getNonChildSkillType(skillType), xp); +// } +// +// /** +// * Removes XP from an offline player in a specific skill type. +// *
+// * This function is designed for API usage. +// * +// * @param playerName The player to change the XP of +// * @param skillType The skill to change the XP for +// * @param xp The amount of XP to remove +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// @Deprecated +// public static void removeXPOffline(String playerName, String skillType, int xp) { +// getOfflineProfile(playerName).removeXp(getNonChildSkillType(skillType), xp); +// } +// +// /** +// * Removes XP from an offline player in a specific skill type. +// *
+// * This function is designed for API usage. +// * +// * @param uuid The player to change the XP of +// * @param skillType The skill to change the XP for +// * @param xp The amount of XP to remove +// * @throws InvalidSkillException if the given skill is not valid +// * @throws InvalidPlayerException if the given player does not exist in the database +// * @throws UnsupportedOperationException if the given skill is a child skill +// */ +// public static void removeXPOffline(UUID uuid, String skillType, int xp) { +// getOfflineProfile(uuid).removeXp(getNonChildSkillType(skillType), xp); +// } +// +// /** +// * Check how much XP is needed for a specific level with the selected level curve. +// *
+// * This function is designed for API usage. +// * +// * @param level The level to get the amount of XP for +// * @throws InvalidFormulaTypeException if the given formulaType is not valid +// */ +// public static int getXpNeededToLevel(int level) { +// return mcMMO.getFormulaManager().getXPtoNextLevel(level, mcMMO.getConfigManager().getConfigLeveling().getFormulaType()); +// } +// +// /** +// * Check how much XP is needed for a specific level with the provided level curve. +// *
+// * This function is designed for API usage. +// * +// * @param level The level to get the amount of XP for +// * @param formulaType The formula type to get the amount of XP for +// * @throws InvalidFormulaTypeException if the given formulaType is not valid +// * @deprecated Discouraged - Most the time you do not want to provide the formula type yourself, use the other method +// */ +// public static int getXpNeededToLevel(int level, FormulaType formulaType) { +// return mcMMO.getFormulaManager().getXPtoNextLevel(level, formulaType); +// } +// +// /** +// * Will add the appropriate type of XP from the block to the player based on the material of the blocks given +// * +// * @param blockStates the blocks to reward XP for +// * @param mcMMOPlayer the target player +// */ +// public static void addXpFromBlocks(ArrayList blockStates, McMMOPlayer mcMMOPlayer) { +// for (BlockState bs : blockStates) { +// for (PrimarySkillType skillType : PrimarySkillType.values()) { +// if (mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, bs.getType()) > 0) { +// mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF); +// } +// } +// } +// } +// +// /** +// * Will add the appropriate type of XP from the block to the player based on the material of the blocks given if it matches the given skillType +// * +// * @param blockStates the blocks to reward XP for +// * @param mcMMOPlayer the target player +// * @param skillType target primary skill +// */ +// public static void addXpFromBlocksBySkill(ArrayList blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) { +// for (BlockState bs : blockStates) { +// if (mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, bs.getType()) > 0) { +// mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF); +// } +// } +// } +// +// /** +// * Will add the appropriate type of XP from the block to the player based on the material of the blocks given +// * +// * @param blockState The target blockstate +// * @param mcMMOPlayer The target player +// */ +// public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) { +// for (PrimarySkillType skillType : PrimarySkillType.values()) { +// if (mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, blockState.getType()) > 0) { +// mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF); +// } +// } +// } +// +// /** +// * Will add the appropriate type of XP from the block to the player based on the material of the blocks given if it matches the given skillType +// * +// * @param blockState The target blockstate +// * @param mcMMOPlayer The target player +// * @param skillType target primary skill +// */ +// public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) { +// if (mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, blockState.getType()) > 0) { +// mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceManager().getBlockBreakXpValue(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF); +// } +// } +// +// +// // Utility methods follow. +// private static void addOfflineXP(UUID playerUniqueId, PrimarySkillType skill, int XP) { +// PlayerProfile profile = getOfflineProfile(playerUniqueId); +// +// profile.addXp(skill, XP); +// profile.save(true); +// } +// +// @Deprecated +// private static void addOfflineXP(String playerName, PrimarySkillType skill, int XP) { +// PlayerProfile profile = getOfflineProfile(playerName); +// +// profile.addXp(skill, XP); +// profile.scheduleAsyncSave(); +// } +// +// private static PlayerProfile getOfflineProfile(UUID uuid) { +// PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid); +// +// if (!profile.isLoaded()) { +// throw new InvalidPlayerException(); +// } +// +// return profile; +// } +// +// @Deprecated +// private static PlayerProfile getOfflineProfile(String playerName) { +// UUID uuid = mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(); +// PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid); +// +// if (!profile.isLoaded()) { +// throw new InvalidPlayerException(); +// } +// +// return profile; +// } +// +// private static PrimarySkillType getSkillType(String skillType) throws InvalidSkillException { +// PrimarySkillType skill = PrimarySkillType.getSkill(skillType); +// +// if (skill == null) { +// throw new InvalidSkillException(skillType); +// } +// +// return skill; +// } +// +// private static PrimarySkillType getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException { +// PrimarySkillType skill = getSkillType(skillType); +// +// if (skill.isChildSkill()) { +// throw new UnsupportedOperationException("Child skills do not have XP"); +// } +// +// return skill; +// } +// +// private static XPGainReason getXPGainReason(String reason) throws InvalidXPGainReasonException { +// XPGainReason xpGainReason = XPGainReason.getXPGainReason(reason); +// +// if (xpGainReason == null) { +// throw new InvalidXPGainReasonException(); +// } +// +// return xpGainReason; +// } +// +// /** +// * @param player target player +// * @return McMMOPlayer for that player if the profile is loaded, otherwise null +// * @throws McMMOPlayerNotFoundException +// * @deprecated Use UserManager::getPlayer(Player player) instead +// */ +// @Deprecated +// private static McMMOPlayer getPlayer(Player player) throws McMMOPlayerNotFoundException { +// if (!UserManager.hasPlayerDataKey(player)) { +// throw new McMMOPlayerNotFoundException(player); +// } +// +// return UserManager.getPlayer(player); +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/PartyAPI.java b/src/main/java/com/gmail/nossr50/api/PartyAPI.java index e55eafc59..432bd78ba 100644 --- a/src/main/java/com/gmail/nossr50/api/PartyAPI.java +++ b/src/main/java/com/gmail/nossr50/api/PartyAPI.java @@ -1,265 +1,265 @@ -package com.gmail.nossr50.api; - -import com.gmail.nossr50.datatypes.interactions.NotificationType; -import com.gmail.nossr50.datatypes.party.Party; -import com.gmail.nossr50.datatypes.party.PartyLeader; -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.party.PartyManager; -import com.gmail.nossr50.util.player.UserManager; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; - -import java.util.*; - -public final class PartyAPI { - private PartyAPI() { - } - - /** - * Get the name of the party a player is in. - *
- * This function is designed for API usage. - * - * @param player The player to check the party name of - * @return the name of the player's party, or null if not in a party - */ - public static String getPartyName(Player player) { - if (!inParty(player)) { - return null; - } - - return UserManager.getPlayer(player).getParty().getName(); - } - - /** - * Checks if a player is in a party. - *
- * This function is designed for API usage. - * - * @param player The player to check - * @return true if the player is in a party, false otherwise - */ - public static boolean inParty(Player player) { - if (UserManager.getPlayer(player) == null) - return false; - - return UserManager.getPlayer(player).inParty(); - } - - /** - * Check if two players are in the same party. - *
- * This function is designed for API usage. - * - * @param playera The first player to check - * @param playerb The second player to check - * @return true if the two players are in the same party, false otherwise - */ - public static boolean inSameParty(Player playera, Player playerb) { - return PartyManager.inSameParty(playera, playerb); - } - - /** - * Get a list of all current parties. - *
- * This function is designed for API usage. - * - * @return the list of parties. - */ - public static List getParties() { - return PartyManager.getParties(); - } - - /** - * Add a player to a party. - *
- * This function is designed for API usage. - * - * @param player The player to add to the party - * @param partyName The party to add the player to - * @deprecated parties can have limits, use the other method - */ - @Deprecated - public static void addToParty(Player player, String partyName) { - //Check if player profile is loaded - if (UserManager.getPlayer(player) == null) - return; - - Party party = PartyManager.getParty(partyName); - - if (party == null) { - party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); - } else if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) { - if (PartyManager.isPartyFull(player, party)) { - mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString()); - return; - } - } - - PartyManager.addToParty(UserManager.getPlayer(player), party); - } - - /** - * The max party size of the server - * Limits are only enforced if the enforcement setting is on - * - * @return the max party size on this server - */ - public static int getMaxPartySize() { - return mcMMO.getConfigManager().getConfigParty().getPartySizeLimit(); - } - - /** - * Checks if parties are currently size capped which is determined by the user config - * - * @return true if parties are size capped - */ - public static boolean isPartySizeCapped() { - return mcMMO.getConfigManager().getConfigParty().isPartySizeCapped(); - } - - /** - * Add a player to a party. - *
- * This function is designed for API usage. - * - * @param player The player to add to the party - * @param partyName The party to add the player to - * @param bypassLimit if true bypasses party size limits - */ - //TODO: bypasslimit not used? - public static void addToParty(Player player, String partyName, boolean bypassLimit) { - //Check if player profile is loaded - if (UserManager.getPlayer(player) == null) - return; - - Party party = PartyManager.getParty(partyName); - - if (party == null) { - party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); - } - - PartyManager.addToParty(UserManager.getPlayer(player), party); - } - - /** - * Remove a player from a party. - *
- * This function is designed for API usage. - * - * @param player The player to remove - */ - public static void removeFromParty(Player player) { - //Check if player profile is loaded - if (UserManager.getPlayer(player) == null) - return; - - PartyManager.removeFromParty(UserManager.getPlayer(player)); - } - - /** - * Get the leader of a party. - *
- * This function is designed for API usage. - * - * @param partyName The party name - * @return the leader of the party - */ - public static String getPartyLeader(String partyName) { - return PartyManager.getPartyLeaderName(partyName); - } - - /** - * Set the leader of a party. - *
- * This function is designed for API usage. - * - * @param partyName The name of the party to set the leader of - * @param playerName The playerName to set as leader - */ - @Deprecated - public static void setPartyLeader(String partyName, String playerName) { - PartyManager.setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), PartyManager.getParty(partyName)); - } - - /** - * Get a list of all players in this player's party. - *
- * This function is designed for API usage. - * - * @param player The player to check - * @return all the players in the player's party - */ - @Deprecated - public static List getOnlineAndOfflineMembers(Player player) { - List members = new ArrayList<>(); - - for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) { - OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId); - members.add(member); - } - return members; - } - - /** - * Get a list of all player names in this player's party. - *
- * This function is designed for API usage. - * - * @param player The player to check - * @return all the player names in the player's party - */ - @Deprecated - public static LinkedHashSet getMembers(Player player) { - return (LinkedHashSet) PartyManager.getAllMembers(player).values(); - } - - /** - * Get a list of all player names and uuids in this player's party. - *
- * This function is designed for API usage. - * - * @param player The player to check - * @return all the player names and uuids in the player's party - */ - public static LinkedHashMap getMembersMap(Player player) { - return PartyManager.getAllMembers(player); - } - - /** - * Get a list of all online players in this party. - *
- * This function is designed for API usage. - * - * @param partyName The party to check - * @return all online players in this party - */ - public static List getOnlineMembers(String partyName) { - return PartyManager.getOnlineMembers(partyName); - } - - /** - * Get a list of all online players in this player's party. - *
- * This function is designed for API usage. - * - * @param player The player to check - * @return all online players in the player's party - */ - public static List getOnlineMembers(Player player) { - return PartyManager.getOnlineMembers(player); - } - - public static boolean hasAlly(String partyName) { - return getAllyName(partyName) != null; - } - - public static String getAllyName(String partyName) { - Party ally = PartyManager.getParty(partyName).getAlly(); - if (ally != null) { - return ally.getName(); - } - - return null; - } -} +//package com.gmail.nossr50.api; +// +//import com.gmail.nossr50.datatypes.interactions.NotificationType; +//import com.gmail.nossr50.datatypes.party.Party; +//import com.gmail.nossr50.datatypes.party.PartyLeader; +//import com.gmail.nossr50.mcMMO; +//import com.gmail.nossr50.party.PartyManager; +//import com.gmail.nossr50.util.player.UserManager; +//import org.bukkit.OfflinePlayer; +//import org.bukkit.entity.Player; +// +//import java.util.*; +// +//public final class PartyAPI { +// private PartyAPI() { +// } +// +// /** +// * Get the name of the party a player is in. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to check the party name of +// * @return the name of the player's party, or null if not in a party +// */ +// public static String getPartyName(Player player) { +// if (!inParty(player)) { +// return null; +// } +// +// return UserManager.getPlayer(player).getParty().getName(); +// } +// +// /** +// * Checks if a player is in a party. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to check +// * @return true if the player is in a party, false otherwise +// */ +// public static boolean inParty(Player player) { +// if (UserManager.getPlayer(player) == null) +// return false; +// +// return UserManager.getPlayer(player).inParty(); +// } +// +// /** +// * Check if two players are in the same party. +// *
+// * This function is designed for API usage. +// * +// * @param playera The first player to check +// * @param playerb The second player to check +// * @return true if the two players are in the same party, false otherwise +// */ +// public static boolean inSameParty(Player playera, Player playerb) { +// return PartyManager.inSameParty(playera, playerb); +// } +// +// /** +// * Get a list of all current parties. +// *
+// * This function is designed for API usage. +// * +// * @return the list of parties. +// */ +// public static List getParties() { +// return PartyManager.getParties(); +// } +// +// /** +// * Add a player to a party. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add to the party +// * @param partyName The party to add the player to +// * @deprecated parties can have limits, use the other method +// */ +// @Deprecated +// public static void addToParty(Player player, String partyName) { +// //Check if player profile is loaded +// if (UserManager.getPlayer(player) == null) +// return; +// +// Party party = PartyManager.getParty(partyName); +// +// if (party == null) { +// party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); +// } else if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) { +// if (PartyManager.isPartyFull(player, party)) { +// mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString()); +// return; +// } +// } +// +// PartyManager.addToParty(UserManager.getPlayer(player), party); +// } +// +// /** +// * The max party size of the server +// * Limits are only enforced if the enforcement setting is on +// * +// * @return the max party size on this server +// */ +// public static int getMaxPartySize() { +// return mcMMO.getConfigManager().getConfigParty().getPartySizeLimit(); +// } +// +// /** +// * Checks if parties are currently size capped which is determined by the user config +// * +// * @return true if parties are size capped +// */ +// public static boolean isPartySizeCapped() { +// return mcMMO.getConfigManager().getConfigParty().isPartySizeCapped(); +// } +// +// /** +// * Add a player to a party. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to add to the party +// * @param partyName The party to add the player to +// * @param bypassLimit if true bypasses party size limits +// */ +// //TODO: bypasslimit not used? +// public static void addToParty(Player player, String partyName, boolean bypassLimit) { +// //Check if player profile is loaded +// if (UserManager.getPlayer(player) == null) +// return; +// +// Party party = PartyManager.getParty(partyName); +// +// if (party == null) { +// party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); +// } +// +// PartyManager.addToParty(UserManager.getPlayer(player), party); +// } +// +// /** +// * Remove a player from a party. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to remove +// */ +// public static void removeFromParty(Player player) { +// //Check if player profile is loaded +// if (UserManager.getPlayer(player) == null) +// return; +// +// PartyManager.removeFromParty(UserManager.getPlayer(player)); +// } +// +// /** +// * Get the leader of a party. +// *
+// * This function is designed for API usage. +// * +// * @param partyName The party name +// * @return the leader of the party +// */ +// public static String getPartyLeader(String partyName) { +// return PartyManager.getPartyLeaderName(partyName); +// } +// +// /** +// * Set the leader of a party. +// *
+// * This function is designed for API usage. +// * +// * @param partyName The name of the party to set the leader of +// * @param playerName The playerName to set as leader +// */ +// @Deprecated +// public static void setPartyLeader(String partyName, String playerName) { +// PartyManager.setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), PartyManager.getParty(partyName)); +// } +// +// /** +// * Get a list of all players in this player's party. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to check +// * @return all the players in the player's party +// */ +// @Deprecated +// public static List getOnlineAndOfflineMembers(Player player) { +// List members = new ArrayList<>(); +// +// for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) { +// OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId); +// members.add(member); +// } +// return members; +// } +// +// /** +// * Get a list of all player names in this player's party. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to check +// * @return all the player names in the player's party +// */ +// @Deprecated +// public static LinkedHashSet getMembers(Player player) { +// return (LinkedHashSet) PartyManager.getAllMembers(player).values(); +// } +// +// /** +// * Get a list of all player names and uuids in this player's party. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to check +// * @return all the player names and uuids in the player's party +// */ +// public static LinkedHashMap getMembersMap(Player player) { +// return PartyManager.getAllMembers(player); +// } +// +// /** +// * Get a list of all online players in this party. +// *
+// * This function is designed for API usage. +// * +// * @param partyName The party to check +// * @return all online players in this party +// */ +// public static List getOnlineMembers(String partyName) { +// return PartyManager.getOnlineMembers(partyName); +// } +// +// /** +// * Get a list of all online players in this player's party. +// *
+// * This function is designed for API usage. +// * +// * @param player The player to check +// * @return all online players in the player's party +// */ +// public static List getOnlineMembers(Player player) { +// return PartyManager.getOnlineMembers(player); +// } +// +// public static boolean hasAlly(String partyName) { +// return getAllyName(partyName) != null; +// } +// +// public static String getAllyName(String partyName) { +// Party ally = PartyManager.getParty(partyName).getAlly(); +// if (ally != null) { +// return ally.getName(); +// } +// +// return null; +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/SkillAPI.java b/src/main/java/com/gmail/nossr50/api/SkillAPI.java index 4f6ec998c..a8478ab0e 100644 --- a/src/main/java/com/gmail/nossr50/api/SkillAPI.java +++ b/src/main/java/com/gmail/nossr50/api/SkillAPI.java @@ -1,94 +1,94 @@ -package com.gmail.nossr50.api; - -import com.gmail.nossr50.datatypes.skills.PrimarySkillType; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public final class SkillAPI { - private SkillAPI() { - } - - /** - * Returns a list of strings with mcMMO's skills - * This includes parent and child skills - *
- * This function is designed for API usage. - * - * @return a list of strings with valid skill names - */ - public static List getSkills() { - return getListFromEnum(Arrays.asList(PrimarySkillType.values())); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes parent skills - *
- * This function is designed for API usage. - * - * @return a list of strings with valid skill names - */ - public static List getNonChildSkills() { - return getListFromEnum(PrimarySkillType.NON_CHILD_SKILLS); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes child skills - *
- * This function is designed for API usage. - * - * @return a list of strings with valid skill names - */ - public static List getChildSkills() { - return getListFromEnum(PrimarySkillType.CHILD_SKILLS); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes combat skills - *
- * This function is designed for API usage. - * - * @return a list of strings with valid skill names - */ - public static List getCombatSkills() { - return getListFromEnum(PrimarySkillType.COMBAT_SKILLS); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes gathering skills - *
- * This function is designed for API usage. - * - * @return a list of strings with valid skill names - */ - public static List getGatheringSkills() { - return getListFromEnum(PrimarySkillType.GATHERING_SKILLS); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes misc skills - *
- * This function is designed for API usage. - * - * @return a list of strings with valid skill names - */ - public static List getMiscSkills() { - return getListFromEnum(PrimarySkillType.MISC_SKILLS); - } - - private static List getListFromEnum(List skillsTypes) { - List skills = new ArrayList<>(); - - for (PrimarySkillType primarySkillType : skillsTypes) { - skills.add(primarySkillType.name()); - } - - return skills; - } -} +//package com.gmail.nossr50.api; +// +//import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +// +//import java.util.ArrayList; +//import java.util.Arrays; +//import java.util.List; +// +//public final class SkillAPI { +// private SkillAPI() { +// } +// +// /** +// * Returns a list of strings with mcMMO's skills +// * This includes parent and child skills +// *
+// * This function is designed for API usage. +// * +// * @return a list of strings with valid skill names +// */ +// public static List getSkills() { +// return getListFromEnum(Arrays.asList(PrimarySkillType.values())); +// } +// +// /** +// * Returns a list of strings with mcMMO's skills +// * This only includes parent skills +// *
+// * This function is designed for API usage. +// * +// * @return a list of strings with valid skill names +// */ +// public static List getNonChildSkills() { +// return getListFromEnum(PrimarySkillType.NON_CHILD_SKILLS); +// } +// +// /** +// * Returns a list of strings with mcMMO's skills +// * This only includes child skills +// *
+// * This function is designed for API usage. +// * +// * @return a list of strings with valid skill names +// */ +// public static List getChildSkills() { +// return getListFromEnum(PrimarySkillType.CHILD_SKILLS); +// } +// +// /** +// * Returns a list of strings with mcMMO's skills +// * This only includes combat skills +// *
+// * This function is designed for API usage. +// * +// * @return a list of strings with valid skill names +// */ +// public static List getCombatSkills() { +// return getListFromEnum(PrimarySkillType.COMBAT_SKILLS); +// } +// +// /** +// * Returns a list of strings with mcMMO's skills +// * This only includes gathering skills +// *
+// * This function is designed for API usage. +// * +// * @return a list of strings with valid skill names +// */ +// public static List getGatheringSkills() { +// return getListFromEnum(PrimarySkillType.GATHERING_SKILLS); +// } +// +// /** +// * Returns a list of strings with mcMMO's skills +// * This only includes misc skills +// *
+// * This function is designed for API usage. +// * +// * @return a list of strings with valid skill names +// */ +// public static List getMiscSkills() { +// return getListFromEnum(PrimarySkillType.MISC_SKILLS); +// } +// +// private static List getListFromEnum(List skillsTypes) { +// List skills = new ArrayList<>(); +// +// for (PrimarySkillType primarySkillType : skillsTypes) { +// skills.add(primarySkillType.name()); +// } +// +// return skills; +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/exceptions/InvalidFormulaTypeException.java b/src/main/java/com/gmail/nossr50/api/exceptions/InvalidFormulaTypeException.java index c46332b99..2fee51fd7 100644 --- a/src/main/java/com/gmail/nossr50/api/exceptions/InvalidFormulaTypeException.java +++ b/src/main/java/com/gmail/nossr50/api/exceptions/InvalidFormulaTypeException.java @@ -1,9 +1,9 @@ -package com.gmail.nossr50.api.exceptions; - -public class InvalidFormulaTypeException extends RuntimeException { - private static final long serialVersionUID = 3368670229490121886L; - - public InvalidFormulaTypeException() { - super("That is not a valid FormulaType."); - } -} +//package com.gmail.nossr50.api.exceptions; +// +//public class InvalidFormulaTypeException extends RuntimeException { +// private static final long serialVersionUID = 3368670229490121886L; +// +// public InvalidFormulaTypeException() { +// super("That is not a valid FormulaType."); +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/exceptions/InvalidPlayerException.java b/src/main/java/com/gmail/nossr50/api/exceptions/InvalidPlayerException.java index 47d065e4a..12a8635cf 100644 --- a/src/main/java/com/gmail/nossr50/api/exceptions/InvalidPlayerException.java +++ b/src/main/java/com/gmail/nossr50/api/exceptions/InvalidPlayerException.java @@ -1,9 +1,9 @@ -package com.gmail.nossr50.api.exceptions; - -public class InvalidPlayerException extends RuntimeException { - private static final long serialVersionUID = 907213002618581385L; - - public InvalidPlayerException() { - super("That player does not exist in the database."); - } -} +//package com.gmail.nossr50.api.exceptions; +// +//public class InvalidPlayerException extends RuntimeException { +// private static final long serialVersionUID = 907213002618581385L; +// +// public InvalidPlayerException() { +// super("That player does not exist in the database."); +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/exceptions/InvalidSkillException.java b/src/main/java/com/gmail/nossr50/api/exceptions/InvalidSkillException.java index 598a44d7e..d1ce509a4 100644 --- a/src/main/java/com/gmail/nossr50/api/exceptions/InvalidSkillException.java +++ b/src/main/java/com/gmail/nossr50/api/exceptions/InvalidSkillException.java @@ -1,9 +1,9 @@ -package com.gmail.nossr50.api.exceptions; - -public class InvalidSkillException extends RuntimeException { - private static final long serialVersionUID = 942705284195791157L; - - public InvalidSkillException(String s) { - super(s + " does not match a valid skill."); - } -} +//package com.gmail.nossr50.api.exceptions; +// +//public class InvalidSkillException extends RuntimeException { +// private static final long serialVersionUID = 942705284195791157L; +// +// public InvalidSkillException(String s) { +// super(s + " does not match a valid skill."); +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/exceptions/InvalidXPGainReasonException.java b/src/main/java/com/gmail/nossr50/api/exceptions/InvalidXPGainReasonException.java index b2c1232b2..842504756 100644 --- a/src/main/java/com/gmail/nossr50/api/exceptions/InvalidXPGainReasonException.java +++ b/src/main/java/com/gmail/nossr50/api/exceptions/InvalidXPGainReasonException.java @@ -1,9 +1,9 @@ -package com.gmail.nossr50.api.exceptions; - -public class InvalidXPGainReasonException extends RuntimeException { - private static final long serialVersionUID = 4427052841957931157L; - - public InvalidXPGainReasonException() { - super("That is not a valid XPGainReason."); - } -} +//package com.gmail.nossr50.api.exceptions; +// +//public class InvalidXPGainReasonException extends RuntimeException { +// private static final long serialVersionUID = 4427052841957931157L; +// +// public InvalidXPGainReasonException() { +// super("That is not a valid XPGainReason."); +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/exceptions/McMMOPlayerNotFoundException.java b/src/main/java/com/gmail/nossr50/api/exceptions/McMMOPlayerNotFoundException.java index b0b0f0087..03d15718f 100644 --- a/src/main/java/com/gmail/nossr50/api/exceptions/McMMOPlayerNotFoundException.java +++ b/src/main/java/com/gmail/nossr50/api/exceptions/McMMOPlayerNotFoundException.java @@ -1,11 +1,11 @@ -package com.gmail.nossr50.api.exceptions; - -import org.bukkit.entity.Player; - -public class McMMOPlayerNotFoundException extends RuntimeException { - private static final long serialVersionUID = 761917904993202836L; - - public McMMOPlayerNotFoundException(Player player) { - super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId()); - } -} +//package com.gmail.nossr50.api.exceptions; +// +//import org.bukkit.entity.Player; +// +//public class McMMOPlayerNotFoundException extends RuntimeException { +// private static final long serialVersionUID = 761917904993202836L; +// +// public McMMOPlayerNotFoundException(Player player) { +// super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId()); +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/exceptions/MissingSkillPropertyDefinition.java b/src/main/java/com/gmail/nossr50/api/exceptions/MissingSkillPropertyDefinition.java index e0aada6a4..4f32ea256 100644 --- a/src/main/java/com/gmail/nossr50/api/exceptions/MissingSkillPropertyDefinition.java +++ b/src/main/java/com/gmail/nossr50/api/exceptions/MissingSkillPropertyDefinition.java @@ -1,7 +1,7 @@ -package com.gmail.nossr50.api.exceptions; - -public class MissingSkillPropertyDefinition extends RuntimeException { - public MissingSkillPropertyDefinition(String details) { - super("A skill property is undefined! Details: " + details); - } -} +//package com.gmail.nossr50.api.exceptions; +// +//public class MissingSkillPropertyDefinition extends RuntimeException { +// public MissingSkillPropertyDefinition(String details) { +// super("A skill property is undefined! Details: " + details); +// } +//} diff --git a/src/main/java/com/gmail/nossr50/api/exceptions/UndefinedSkillBehaviour.java b/src/main/java/com/gmail/nossr50/api/exceptions/UndefinedSkillBehaviour.java index 29bfd2855..f4d11fd53 100644 --- a/src/main/java/com/gmail/nossr50/api/exceptions/UndefinedSkillBehaviour.java +++ b/src/main/java/com/gmail/nossr50/api/exceptions/UndefinedSkillBehaviour.java @@ -1,9 +1,9 @@ -package com.gmail.nossr50.api.exceptions; - -import com.gmail.nossr50.datatypes.skills.PrimarySkillType; - -public class UndefinedSkillBehaviour extends RuntimeException { - public UndefinedSkillBehaviour(PrimarySkillType primarySkillType) { - super("Undefined behaviour for skill! - " + primarySkillType.toString()); - } -} +//package com.gmail.nossr50.api.exceptions; +// +//import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +// +//public class UndefinedSkillBehaviour extends RuntimeException { +// public UndefinedSkillBehaviour(PrimarySkillType primarySkillType) { +// super("Undefined behaviour for skill! - " + primarySkillType.toString()); +// } +//}