mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
My formatter picked this up
This commit is contained in:
parent
e8e2dcff46
commit
c211874a27
@ -18,11 +18,11 @@ public final class ChatAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender
|
||||
* @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
|
||||
* @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);
|
||||
@ -33,9 +33,9 @@ public final class ChatAPI {
|
||||
* </br>
|
||||
* 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 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) {
|
||||
@ -47,10 +47,10 @@ public final class ChatAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender
|
||||
* @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
|
||||
* @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);
|
||||
@ -61,8 +61,8 @@ public final class ChatAPI {
|
||||
* </br>
|
||||
* 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 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) {
|
||||
@ -73,6 +73,7 @@ public final class ChatAPI {
|
||||
* 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) {
|
||||
@ -83,6 +84,7 @@ public final class ChatAPI {
|
||||
* 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) {
|
||||
@ -93,6 +95,7 @@ public final class ChatAPI {
|
||||
* 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) {
|
||||
@ -103,6 +106,7 @@ public final class ChatAPI {
|
||||
* 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) {
|
||||
|
@ -24,6 +24,7 @@ public final class ExperienceAPI {
|
||||
* 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) {
|
||||
@ -38,12 +39,15 @@ public final class ExperienceAPI {
|
||||
* 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) {
|
||||
SkillType skill = SkillType.getSkill(skillType);
|
||||
|
||||
if (skill == null) return false;
|
||||
if (skill == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !skill.isChildSkill();
|
||||
}
|
||||
@ -58,9 +62,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @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 XP The amount of XP to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
@ -79,10 +83,10 @@ public final class ExperienceAPI {
|
||||
* 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
|
||||
* @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 InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static void addRawXPOffline(String playerName, String skillType, float XP) {
|
||||
@ -94,9 +98,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @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 XP The amount of XP to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
@ -110,10 +114,10 @@ public final class ExperienceAPI {
|
||||
* 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
|
||||
* @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 InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static void addMultipliedXPOffline(String playerName, String skillType, int XP) {
|
||||
@ -125,9 +129,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @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 XP The amount of XP to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
@ -143,10 +147,10 @@ public final class ExperienceAPI {
|
||||
* 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
|
||||
* @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 InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static void addModifiedXPOffline(String playerName, String skillType, int XP) {
|
||||
@ -161,9 +165,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @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 XP The amount of XP to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
@ -176,11 +180,12 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get XP for
|
||||
* @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 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) {
|
||||
@ -193,11 +198,12 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to get XP for
|
||||
* @param skillType The skill 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 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(String playerName, String skillType) {
|
||||
@ -209,11 +215,12 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get XP for
|
||||
* @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 InvalidSkillException if the given skill is not valid
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static float getXPRaw(Player player, String skillType) {
|
||||
@ -226,11 +233,12 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to get XP for
|
||||
* @param skillType The skill 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 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 float getOfflineXPRaw(String playerName, String skillType) {
|
||||
@ -242,11 +250,12 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get the XP amount for
|
||||
* @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 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) {
|
||||
@ -259,11 +268,12 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to get XP for
|
||||
* @param skillType The skill 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 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(String playerName, String skillType) {
|
||||
@ -275,11 +285,12 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get the XP amount for
|
||||
* @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 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) {
|
||||
@ -296,11 +307,12 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to get XP for
|
||||
* @param skillType The skill 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 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 getOfflineXPRemaining(String playerName, String skillType) {
|
||||
@ -316,9 +328,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add levels to
|
||||
* @param player The player to add levels to
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
* @param levels Number of levels to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
@ -332,10 +344,10 @@ public final class ExperienceAPI {
|
||||
* 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
|
||||
* @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 InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static void addLevelOffline(String playerName, String skillType, int levels) {
|
||||
@ -362,8 +374,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get the level for
|
||||
* @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
|
||||
@ -378,10 +391,11 @@ public final class ExperienceAPI {
|
||||
* 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
|
||||
* @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 InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static int getLevelOffline(String playerName, String skillType) {
|
||||
@ -394,6 +408,7 @@ public final class ExperienceAPI {
|
||||
* 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) {
|
||||
@ -406,6 +421,7 @@ public final class ExperienceAPI {
|
||||
* 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
|
||||
@ -427,6 +443,7 @@ public final class ExperienceAPI {
|
||||
* 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
|
||||
@ -452,13 +469,13 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
* @param skillType The skill to check
|
||||
*
|
||||
* @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
|
||||
* @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(String playerName, String skillType) {
|
||||
return mcMMO.getDatabaseManager().readRank(getOfflineProfile(playerName).getPlayerName()).get(getNonChildSkillType(skillType).toString());
|
||||
@ -472,9 +489,9 @@ public final class ExperienceAPI {
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
*
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*
|
||||
* @return the position on the power level leaderboard
|
||||
*
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static int getPlayerRankOverall(String playerName) {
|
||||
return mcMMO.getDatabaseManager().readRank(getOfflineProfile(playerName).getPlayerName()).get("ALL");
|
||||
@ -485,8 +502,8 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* 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 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
|
||||
@ -501,10 +518,10 @@ public final class ExperienceAPI {
|
||||
* 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 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 InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static void setLevelOffline(String playerName, String skillType, int skillLevel) {
|
||||
@ -516,11 +533,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to set the XP of
|
||||
* @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
|
||||
* @param newValue The value to set the XP to
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @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) {
|
||||
@ -533,11 +550,11 @@ public final class ExperienceAPI {
|
||||
* 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
|
||||
* @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 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(String playerName, String skillType, int newValue) {
|
||||
@ -549,11 +566,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to change the XP of
|
||||
* @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
|
||||
* @param xp The amount of XP to remove
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @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) {
|
||||
@ -566,11 +583,11 @@ public final class ExperienceAPI {
|
||||
* 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
|
||||
* @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 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(String playerName, String skillType, int xp) {
|
||||
|
@ -21,6 +21,7 @@ public final class PartyAPI {
|
||||
* 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) {
|
||||
@ -37,6 +38,7 @@ public final class PartyAPI {
|
||||
* 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) {
|
||||
@ -50,6 +52,7 @@ public final class PartyAPI {
|
||||
*
|
||||
* @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) {
|
||||
@ -72,7 +75,7 @@ public final class PartyAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add to the party
|
||||
* @param player The player to add to the party
|
||||
* @param partyName The party to add the player to
|
||||
*/
|
||||
public static void addToParty(Player player, String partyName) {
|
||||
@ -102,6 +105,7 @@ public final class PartyAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param partyName The party name
|
||||
*
|
||||
* @return the leader of the party
|
||||
*/
|
||||
public static String getPartyLeader(String partyName) {
|
||||
@ -114,7 +118,7 @@ public final class PartyAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param partyName The name of the party to set the leader of
|
||||
* @param player The player to set as leader
|
||||
* @param player The player to set as leader
|
||||
*/
|
||||
public static void setPartyLeader(String partyName, String player) {
|
||||
PartyManager.setPartyLeader(player, PartyManager.getParty(partyName));
|
||||
@ -126,6 +130,7 @@ public final class PartyAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check
|
||||
*
|
||||
* @return all the players in the player's party
|
||||
*/
|
||||
@Deprecated
|
||||
@ -145,6 +150,7 @@ public final class PartyAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check
|
||||
*
|
||||
* @return all the player names in the player's party
|
||||
*/
|
||||
public static LinkedHashSet<String> getMembers(Player player) {
|
||||
@ -157,6 +163,7 @@ public final class PartyAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param partyName The party to check
|
||||
*
|
||||
* @return all online players in this party
|
||||
*/
|
||||
public static List<Player> getOnlineMembers(String partyName) {
|
||||
@ -169,6 +176,7 @@ public final class PartyAPI {
|
||||
* 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<Player> getOnlineMembers(Player player) {
|
||||
|
@ -15,6 +15,7 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class MobhealthCommand implements TabExecutor {
|
||||
|
@ -80,7 +80,10 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected abstract boolean hasOtherPermission(CommandSender sender);
|
||||
|
||||
protected abstract boolean hasSelfPermission(CommandSender sender);
|
||||
|
||||
protected abstract void applyCommandAction();
|
||||
|
||||
protected abstract void sendSuccessMessage(CommandSender sender);
|
||||
}
|
||||
|
@ -108,9 +108,13 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected abstract boolean permissionsCheckSelf(CommandSender sender);
|
||||
|
||||
protected abstract boolean permissionsCheckOthers(CommandSender sender);
|
||||
|
||||
protected abstract void handleCommand(SkillType skill);
|
||||
|
||||
protected abstract void handlePlayerMessageAll();
|
||||
|
||||
protected abstract void handlePlayerMessageSkill();
|
||||
|
||||
private boolean validateArguments(CommandSender sender, String skillName, String value) {
|
||||
|
@ -129,10 +129,15 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected abstract boolean checkTogglePermissions();
|
||||
|
||||
protected abstract boolean checkModifyPermissions();
|
||||
|
||||
protected abstract boolean checkEnabled(String skill);
|
||||
|
||||
protected abstract void enable(String skill);
|
||||
|
||||
protected abstract void disable(String skill);
|
||||
|
||||
protected abstract void modify();
|
||||
|
||||
private boolean isInvalidPercentage(CommandSender sender, String value) {
|
||||
|
@ -150,7 +150,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
length = Math.min(length, maxLength);
|
||||
}
|
||||
|
||||
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
|
||||
return new String[]{String.valueOf(length), String.valueOf(enduranceLength)};
|
||||
}
|
||||
|
||||
protected void luckyEffectsDisplay() {
|
||||
|
@ -26,6 +26,7 @@ public interface DatabaseManager {
|
||||
* Remove a user from the database.
|
||||
*
|
||||
* @param playerName The name of the user to remove
|
||||
*
|
||||
* @return true if the user was successfully removed, false otherwise
|
||||
*/
|
||||
public boolean removeUser(String playerName);
|
||||
@ -34,24 +35,27 @@ public interface DatabaseManager {
|
||||
* Save a user to the database.
|
||||
*
|
||||
* @param profile The profile of the player to save
|
||||
*
|
||||
* @return true if successful, false on failure
|
||||
*/
|
||||
public boolean saveUser(PlayerProfile profile);
|
||||
|
||||
/**
|
||||
* Retrieve leaderboard info.
|
||||
*
|
||||
* @param skillName The skill to retrieve info on
|
||||
* @param pageNumber Which page in the leaderboards to retrieve
|
||||
* @param statsPerPage The number of stats per page
|
||||
* @return the requested leaderboard information
|
||||
*/
|
||||
* Retrieve leaderboard info.
|
||||
*
|
||||
* @param skillName The skill to retrieve info on
|
||||
* @param pageNumber Which page in the leaderboards to retrieve
|
||||
* @param statsPerPage The number of stats per page
|
||||
*
|
||||
* @return the requested leaderboard information
|
||||
*/
|
||||
public List<PlayerStat> readLeaderboard(String skillName, int pageNumber, int statsPerPage);
|
||||
|
||||
/**
|
||||
* Retrieve rank info.
|
||||
*
|
||||
* @param playerName The name of the user to retrieve the rankings for
|
||||
*
|
||||
* @return the requested rank information
|
||||
*/
|
||||
public Map<String, Integer> readRank(String playerName);
|
||||
@ -67,10 +71,11 @@ public interface DatabaseManager {
|
||||
* Load a player from the database.
|
||||
*
|
||||
* @param playerName The name of the player to load from the database
|
||||
* @param createNew Whether to create a new record if the player is not
|
||||
* found
|
||||
* @param createNew Whether to create a new record if the player is not
|
||||
* found
|
||||
*
|
||||
* @return The player's data, or an unloaded PlayerProfile if not found
|
||||
* and createNew is false
|
||||
* and createNew is false
|
||||
*/
|
||||
public PlayerProfile loadPlayerProfile(String playerName, boolean createNew);
|
||||
|
||||
|
@ -477,20 +477,20 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check connection status and re-establish if dead or stale.
|
||||
*
|
||||
* If the very first immediate attempt fails, further attempts
|
||||
* will be made in progressively larger intervals up to MAX_WAIT
|
||||
* intervals.
|
||||
*
|
||||
* This allows for MySQL to time out idle connections as needed by
|
||||
* server operator, without affecting McMMO, while still providing
|
||||
* protection against a database outage taking down Bukkit's tick
|
||||
* processing loop due to attempting a database connection each
|
||||
* time McMMO needs the database.
|
||||
*
|
||||
* @return the boolean value for whether or not we are connected
|
||||
*/
|
||||
* Check connection status and re-establish if dead or stale.
|
||||
* <p/>
|
||||
* If the very first immediate attempt fails, further attempts
|
||||
* will be made in progressively larger intervals up to MAX_WAIT
|
||||
* intervals.
|
||||
* <p/>
|
||||
* This allows for MySQL to time out idle connections as needed by
|
||||
* server operator, without affecting McMMO, while still providing
|
||||
* protection against a database outage taking down Bukkit's tick
|
||||
* processing loop due to attempting a database connection each
|
||||
* time McMMO needs the database.
|
||||
*
|
||||
* @return the boolean value for whether or not we are connected
|
||||
*/
|
||||
public boolean checkConnected() {
|
||||
boolean isClosed = true;
|
||||
boolean isValid = false;
|
||||
@ -846,6 +846,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
* Attempt to write the SQL query.
|
||||
*
|
||||
* @param sql Query to write.
|
||||
*
|
||||
* @return true if the query was successfully written, false otherwise.
|
||||
*/
|
||||
private boolean write(String sql) {
|
||||
@ -881,6 +882,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
* Returns the number of rows affected by either a DELETE or UPDATE query
|
||||
*
|
||||
* @param sql SQL query to execute
|
||||
*
|
||||
* @return the number of rows affected
|
||||
*/
|
||||
private int update(String sql) {
|
||||
@ -915,6 +917,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
* Read SQL query.
|
||||
*
|
||||
* @param sql SQL query to read
|
||||
*
|
||||
* @return the rows in this SQL query
|
||||
*/
|
||||
private HashMap<Integer, ArrayList<String>> read(String sql) {
|
||||
@ -960,6 +963,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
* Get the Integer. Only return first row / first field.
|
||||
*
|
||||
* @param statement SQL query to execute
|
||||
*
|
||||
* @return the value in the first row / first field
|
||||
*/
|
||||
private int readInt(PreparedStatement statement) {
|
||||
@ -1103,6 +1107,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
* Retrieve the database id for a player
|
||||
*
|
||||
* @param playerName The name of the user to retrieve the id for
|
||||
*
|
||||
* @return the requested id or -1 if not found
|
||||
*/
|
||||
private int readId(String playerName) {
|
||||
|
@ -7,6 +7,5 @@ public enum DatabaseUpdateType {
|
||||
MOB_HEALTHBARS,
|
||||
PARTY_NAMES,
|
||||
KILL_ORPHANS,
|
||||
DROPPED_SPOUT
|
||||
;
|
||||
DROPPED_SPOUT;
|
||||
}
|
||||
|
@ -266,6 +266,7 @@ public class McMMOPlayer {
|
||||
* Get the mode of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
*
|
||||
* @return true if the ability is enabled, false otherwise
|
||||
*/
|
||||
public boolean getAbilityMode(AbilityType ability) {
|
||||
@ -275,7 +276,7 @@ public class McMMOPlayer {
|
||||
/**
|
||||
* Set the mode of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @param ability The ability to check
|
||||
* @param isActive True if the ability is active, false otherwise
|
||||
*/
|
||||
public void setAbilityMode(AbilityType ability, boolean isActive) {
|
||||
@ -286,6 +287,7 @@ public class McMMOPlayer {
|
||||
* Get the informed state of an ability
|
||||
*
|
||||
* @param ability The ability to check
|
||||
*
|
||||
* @return true if the ability is informed, false otherwise
|
||||
*/
|
||||
public boolean getAbilityInformed(AbilityType ability) {
|
||||
@ -295,7 +297,7 @@ public class McMMOPlayer {
|
||||
/**
|
||||
* Set the informed state of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @param ability The ability to check
|
||||
* @param isInformed True if the ability is informed, false otherwise
|
||||
*/
|
||||
public void setAbilityInformed(AbilityType ability, boolean isInformed) {
|
||||
@ -306,6 +308,7 @@ public class McMMOPlayer {
|
||||
* Get the current prep mode of a tool.
|
||||
*
|
||||
* @param tool Tool to get the mode for
|
||||
*
|
||||
* @return true if the tool is prepped, false otherwise
|
||||
*/
|
||||
public boolean getToolPreparationMode(ToolType tool) {
|
||||
@ -336,7 +339,7 @@ public class McMMOPlayer {
|
||||
/**
|
||||
* Set the current prep mode of a tool.
|
||||
*
|
||||
* @param tool Tool to set the mode for
|
||||
* @param tool Tool to set the mode for
|
||||
* @param isPrepared true if the tool should be prepped, false otherwise
|
||||
*/
|
||||
public void setToolPreparationMode(ToolType tool, boolean isPrepared) {
|
||||
@ -347,6 +350,7 @@ public class McMMOPlayer {
|
||||
* Get the current prep ATS of a tool.
|
||||
*
|
||||
* @param tool Tool to get the ATS for
|
||||
*
|
||||
* @return the ATS for the tool
|
||||
*/
|
||||
public long getToolPreparationATS(ToolType tool) {
|
||||
@ -357,7 +361,7 @@ public class McMMOPlayer {
|
||||
* Set the current prep ATS of a tool.
|
||||
*
|
||||
* @param tool Tool to set the ATS for
|
||||
* @param ATS the ATS of the tool
|
||||
* @param ATS the ATS of the tool
|
||||
*/
|
||||
public void setToolPreparationATS(ToolType tool, long ATS) {
|
||||
int startTime = (int) (ATS / Misc.TIME_CONVERSION_FACTOR);
|
||||
@ -532,7 +536,7 @@ public class McMMOPlayer {
|
||||
* Begins an experience gain. The amount will be affected by skill modifiers, global rate, perks, and may be shared with the party
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param xp Experience amount to process
|
||||
* @param xp Experience amount to process
|
||||
*/
|
||||
public void beginXpGain(SkillType skillType, float xp) {
|
||||
if (xp == 0) {
|
||||
@ -563,7 +567,7 @@ public class McMMOPlayer {
|
||||
* Begins an experience gain. The amount will be affected by skill modifiers, global rate and perks
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param xp Experience amount to process
|
||||
* @param xp Experience amount to process
|
||||
*/
|
||||
public void beginUnsharedXpGain(SkillType skillType, float xp) {
|
||||
xp = modifyXpGain(skillType, xp);
|
||||
@ -575,7 +579,7 @@ public class McMMOPlayer {
|
||||
* Applies an experience gain
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param xp Experience amount to add
|
||||
* @param xp Experience amount to add
|
||||
*/
|
||||
public void applyXpGain(SkillType skillType, float xp) {
|
||||
if (!Permissions.skillEnabled(player, skillType)) {
|
||||
@ -781,7 +785,8 @@ public class McMMOPlayer {
|
||||
* Modifies an experience gain using skill modifiers, global rate and perks
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param xp Experience amount to process
|
||||
* @param xp Experience amount to process
|
||||
*
|
||||
* @return Modified experience
|
||||
*/
|
||||
private float modifyXpGain(SkillType skillType, float xp) {
|
||||
|
@ -116,6 +116,7 @@ public class PlayerProfile {
|
||||
* Get the current DATS of a skill.
|
||||
*
|
||||
* @param abilityType Ability to get the DATS for
|
||||
*
|
||||
* @return the DATS for the ability
|
||||
*/
|
||||
public long getSkillDATS(AbilityType abilityType) {
|
||||
@ -125,8 +126,8 @@ public class PlayerProfile {
|
||||
/**
|
||||
* Set the current DATS of a skill.
|
||||
*
|
||||
* @param abilityType Ability to set the DATS for
|
||||
* @param DATS the DATS of the ability
|
||||
* @param abilityType Ability to set the DATS for
|
||||
* @param DATS the DATS of the ability
|
||||
*/
|
||||
public void setSkillDATS(AbilityType abilityType, long DATS) {
|
||||
int wearsOff = (int) (DATS * .001D);
|
||||
@ -181,7 +182,7 @@ public class PlayerProfile {
|
||||
* Remove Xp from a skill.
|
||||
*
|
||||
* @param skillType Type of skill to modify
|
||||
* @param xp Amount of xp to remove
|
||||
* @param xp Amount of xp to remove
|
||||
*/
|
||||
public void removeXp(SkillType skillType, int xp) {
|
||||
if (skillType.isChildSkill()) {
|
||||
@ -197,7 +198,7 @@ public class PlayerProfile {
|
||||
* Modify a skill level.
|
||||
*
|
||||
* @param skillType Type of skill to modify
|
||||
* @param newValue New level value for the skill
|
||||
* @param newValue New level value for the skill
|
||||
*/
|
||||
public void modifySkill(SkillType skillType, int newValue) {
|
||||
if (skillType.isChildSkill()) {
|
||||
@ -214,7 +215,7 @@ public class PlayerProfile {
|
||||
* Add levels to a skill.
|
||||
*
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
* @param levels Number of levels to add
|
||||
*/
|
||||
public void addLevels(SkillType skillType, int levels) {
|
||||
if (skillType.isChildSkill()) {
|
||||
@ -230,7 +231,7 @@ public class PlayerProfile {
|
||||
/**
|
||||
* Add Experience to a skill.
|
||||
*
|
||||
* @param skillType Type of skill to add experience to
|
||||
* @param skillType Type of skill to add experience to
|
||||
* @param experience Number of experience to add
|
||||
*/
|
||||
public void addExperience(SkillType skillType, int experience) {
|
||||
@ -247,6 +248,7 @@ public class PlayerProfile {
|
||||
* Get the total amount of Xp before the next level.
|
||||
*
|
||||
* @param skillType Type of skill to check
|
||||
*
|
||||
* @return the total amount of Xp until next level
|
||||
*/
|
||||
public int getXpToLevel(SkillType skillType) {
|
||||
|
@ -150,6 +150,7 @@ public enum AbilityType {
|
||||
* Get the permissions for this ability.
|
||||
*
|
||||
* @param player Player to check permissions for
|
||||
*
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
@ -193,6 +194,7 @@ public enum AbilityType {
|
||||
* Check if a block is affected by this ability.
|
||||
*
|
||||
* @param blockState the block to check
|
||||
*
|
||||
* @return true if the block is affected by this ability, false otherwise
|
||||
*/
|
||||
public boolean blockCheck(BlockState blockState) {
|
||||
@ -227,7 +229,8 @@ public enum AbilityType {
|
||||
* Check to see if ability should be triggered.
|
||||
*
|
||||
* @param player The player using the ability
|
||||
* @param block The block modified by the ability
|
||||
* @param block The block modified by the ability
|
||||
*
|
||||
* @return true if the ability should activate, false otherwise
|
||||
*/
|
||||
public boolean triggerCheck(Player player, Block block) {
|
||||
|
@ -34,6 +34,7 @@ public enum ToolType {
|
||||
* Check to see if the item is of the appropriate type.
|
||||
*
|
||||
* @param itemStack The item to check
|
||||
*
|
||||
* @return true if the item is the right type, false otherwise
|
||||
*/
|
||||
public boolean inHand(ItemStack itemStack) {
|
||||
|
@ -69,7 +69,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Monitor PlayerTeleportEvents.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are monitored for the purpose of setting the
|
||||
* player's last teleportation timestamp, in order to prevent
|
||||
* possible Acrobatics exploitation.
|
||||
@ -89,7 +89,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Handle PlayerDeathEvents at the lowest priority.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are used to modify the death message of a player when
|
||||
* needed to correct issues potentially caused by the custom naming used
|
||||
* for mob healthbars.
|
||||
@ -115,7 +115,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Monitor PlayerDeathEvents.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are monitored for the purpose of dealing the penalties
|
||||
* associated with hardcore and vampirism modes. If neither of these
|
||||
* modes are enabled, or if the player who died has hardcore bypass
|
||||
@ -151,7 +151,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Monitor PlayerChangedWorldEvents.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are monitored for the purpose of removing god mode or
|
||||
* player parties if they are not allowed on the world the player has
|
||||
* changed to.
|
||||
@ -174,7 +174,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Monitor PlayerDropItemEvents.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are monitored for the purpose of flagging sharable
|
||||
* dropped items, as well as removing ability buffs from pickaxes
|
||||
* and shovels.
|
||||
@ -195,7 +195,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Handle PlayerFishEvents at the highest priority.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are used for the purpose of handling our anti-exploit
|
||||
* code, as well as dealing with ice fishing.
|
||||
*
|
||||
@ -240,7 +240,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Monitor PlayerFishEvents.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are monitored for the purpose of handling the various
|
||||
* Fishing skills and abilities.
|
||||
*
|
||||
@ -281,7 +281,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Handle PlayerPickupItemEvents at the highest priority.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are used to handle item sharing between party members and
|
||||
* are also used to handle item pickup for the Unarmed skill.
|
||||
*
|
||||
@ -322,7 +322,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Monitor PlayerQuitEvents.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are monitored for the purpose of resetting player
|
||||
* variables and other garbage collection tasks that must take place when
|
||||
* a player exits the server.
|
||||
@ -347,7 +347,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Monitor PlayerJoinEvents.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are monitored for the purpose of initializing player
|
||||
* variables, as well as handling the MOTD display and other important
|
||||
* join messages.
|
||||
@ -381,7 +381,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Monitor PlayerRespawnEvents.
|
||||
* <p>
|
||||
* <p/>
|
||||
* These events are monitored for the purpose of setting the
|
||||
* player's last respawn timestamp, in order to prevent
|
||||
* possible exploitation.
|
||||
|
@ -14,7 +14,7 @@ public final class LocaleLoader {
|
||||
private static ResourceBundle bundle = null;
|
||||
private static ResourceBundle enBundle = null;
|
||||
|
||||
private LocaleLoader() {};
|
||||
private LocaleLoader() {}
|
||||
|
||||
public static String getString(String key) {
|
||||
return getString(key, (Object[]) null);
|
||||
@ -23,8 +23,9 @@ public final class LocaleLoader {
|
||||
/**
|
||||
* Gets the appropriate string from the Locale files.
|
||||
*
|
||||
* @param key The key to look up the string with
|
||||
* @param key The key to look up the string with
|
||||
* @param messageArguments Any arguments to be added to the string
|
||||
*
|
||||
* @return The properly formatted locale string
|
||||
*/
|
||||
public static String getString(String key, Object... messageArguments) {
|
||||
|
@ -186,7 +186,8 @@ public class mcMMO extends JavaPlugin {
|
||||
placeStore.saveAll(); // Save our metadata
|
||||
placeStore.cleanUp(); // Cleanup empty metadata stores
|
||||
}
|
||||
catch (NullPointerException e) {}
|
||||
catch (NullPointerException e) {
|
||||
}
|
||||
|
||||
getServer().getScheduler().cancelTasks(this); // This removes our tasks
|
||||
HandlerList.unregisterAll(this); // Cancel event registrations
|
||||
|
@ -31,8 +31,9 @@ public final class PartyManager {
|
||||
/**
|
||||
* Check if a party with a given name already exists.
|
||||
*
|
||||
* @param player The player to notify
|
||||
* @param player The player to notify
|
||||
* @param partyName The name of the party to check
|
||||
*
|
||||
* @return true if a party with that name exists, false otherwise
|
||||
*/
|
||||
public static boolean checkPartyExistence(Player player, String partyName) {
|
||||
@ -47,8 +48,9 @@ public final class PartyManager {
|
||||
/**
|
||||
* Attempt to change parties or join a new party.
|
||||
*
|
||||
* @param mcMMOPlayer The player changing or joining parties
|
||||
* @param mcMMOPlayer The player changing or joining parties
|
||||
* @param newPartyName The name of the party being joined
|
||||
*
|
||||
* @return true if the party was joined successfully, false otherwise
|
||||
*/
|
||||
public static boolean changeOrJoinParty(McMMOPlayer mcMMOPlayer, String newPartyName) {
|
||||
@ -73,8 +75,9 @@ public final class PartyManager {
|
||||
/**
|
||||
* Check if two online players are in the same party.
|
||||
*
|
||||
* @param firstPlayer The first player
|
||||
* @param firstPlayer The first player
|
||||
* @param secondPlayer The second player
|
||||
*
|
||||
* @return true if they are in the same party, false otherwise
|
||||
*/
|
||||
public static boolean inSameParty(Player firstPlayer, Player secondPlayer) {
|
||||
@ -92,6 +95,7 @@ public final class PartyManager {
|
||||
* Get the near party members.
|
||||
*
|
||||
* @param mcMMOPlayer The player to check
|
||||
*
|
||||
* @return the near party members
|
||||
*/
|
||||
public static List<Player> getNearMembers(McMMOPlayer mcMMOPlayer) {
|
||||
@ -116,6 +120,7 @@ public final class PartyManager {
|
||||
* Get a list of all players in this player's party.
|
||||
*
|
||||
* @param player The player to check
|
||||
*
|
||||
* @return all the players in the player's party
|
||||
*/
|
||||
public static LinkedHashSet<String> getAllMembers(Player player) {
|
||||
@ -128,6 +133,7 @@ public final class PartyManager {
|
||||
* Get a list of all online players in this party.
|
||||
*
|
||||
* @param partyName The party to check
|
||||
*
|
||||
* @return all online players in this party
|
||||
*/
|
||||
public static List<Player> getOnlineMembers(String partyName) {
|
||||
@ -138,6 +144,7 @@ public final class PartyManager {
|
||||
* Get a list of all online players in this party.
|
||||
*
|
||||
* @param player The player to check
|
||||
*
|
||||
* @return all online players in this party
|
||||
*/
|
||||
public static List<Player> getOnlineMembers(Player player) {
|
||||
@ -152,6 +159,7 @@ public final class PartyManager {
|
||||
* Retrieve a party by its name
|
||||
*
|
||||
* @param partyName The party name
|
||||
*
|
||||
* @return the existing party, null otherwise
|
||||
*/
|
||||
public static Party getParty(String partyName) {
|
||||
@ -168,6 +176,7 @@ public final class PartyManager {
|
||||
* Retrieve a party by a members name
|
||||
*
|
||||
* @param playerName The members name
|
||||
*
|
||||
* @return the existing party, null otherwise
|
||||
*/
|
||||
public static Party getPlayerParty(String playerName) {
|
||||
@ -184,6 +193,7 @@ public final class PartyManager {
|
||||
* Retrieve a party by member
|
||||
*
|
||||
* @param player The member
|
||||
*
|
||||
* @return the existing party, null otherwise
|
||||
*/
|
||||
public static Party getParty(Player player) {
|
||||
@ -205,7 +215,7 @@ public final class PartyManager {
|
||||
* Remove a player from a party.
|
||||
*
|
||||
* @param player The player to remove
|
||||
* @param party The party
|
||||
* @param party The party
|
||||
*/
|
||||
public static void removeFromParty(OfflinePlayer player, Party party) {
|
||||
LinkedHashSet<String> members = party.getMembers();
|
||||
@ -253,8 +263,8 @@ public final class PartyManager {
|
||||
* Create a new party
|
||||
*
|
||||
* @param mcMMOPlayer The player to add to the party
|
||||
* @param partyName The party to add the player to
|
||||
* @param password The password for this party, null if there was no password
|
||||
* @param partyName The party to add the player to
|
||||
* @param password The password for this party, null if there was no password
|
||||
*/
|
||||
public static void createParty(McMMOPlayer mcMMOPlayer, String partyName, String password) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
@ -275,9 +285,10 @@ public final class PartyManager {
|
||||
/**
|
||||
* Check if a player can join a party
|
||||
*
|
||||
* @param player The player trying to join a party
|
||||
* @param party The party
|
||||
* @param player The player trying to join a party
|
||||
* @param party The party
|
||||
* @param password The password provided by the player
|
||||
*
|
||||
* @return true if the player can join the party
|
||||
*/
|
||||
public static boolean checkPartyPassword(Player player, Party party, String password) {
|
||||
@ -326,7 +337,7 @@ public final class PartyManager {
|
||||
* Add a player to a party
|
||||
*
|
||||
* @param mcMMOPlayer The player to add to the party
|
||||
* @param party The party
|
||||
* @param party The party
|
||||
*/
|
||||
public static void addToParty(McMMOPlayer mcMMOPlayer, Party party) {
|
||||
String playerName = mcMMOPlayer.getPlayer().getName();
|
||||
@ -340,6 +351,7 @@ public final class PartyManager {
|
||||
* Get the leader of a party.
|
||||
*
|
||||
* @param partyName The party name
|
||||
*
|
||||
* @return the leader of the party
|
||||
*/
|
||||
public static String getPartyLeader(String partyName) {
|
||||
@ -352,7 +364,7 @@ public final class PartyManager {
|
||||
* Set the leader of a party.
|
||||
*
|
||||
* @param playerName The name of the player to set as leader
|
||||
* @param party The party
|
||||
* @param party The party
|
||||
*/
|
||||
public static void setPartyLeader(String playerName, Party party) {
|
||||
String leaderName = party.getLeader();
|
||||
@ -389,6 +401,7 @@ public final class PartyManager {
|
||||
* Check if a string is a valid party name.
|
||||
*
|
||||
* @param partyName The party name to check
|
||||
*
|
||||
* @return true if this is a valid party, false otherwise
|
||||
*/
|
||||
public static boolean isParty(String partyName) {
|
||||
@ -474,10 +487,11 @@ public final class PartyManager {
|
||||
/**
|
||||
* Handle party change event.
|
||||
*
|
||||
* @param player The player changing parties
|
||||
* @param player The player changing parties
|
||||
* @param oldPartyName The name of the old party
|
||||
* @param newPartyName The name of the new party
|
||||
* @param reason The reason for changing parties
|
||||
* @param reason The reason for changing parties
|
||||
*
|
||||
* @return true if the change event was successful, false otherwise
|
||||
*/
|
||||
public static boolean handlePartyChangeEvent(Player player, String oldPartyName, String newPartyName, EventReason reason) {
|
||||
@ -501,7 +515,7 @@ public final class PartyManager {
|
||||
/**
|
||||
* Notify party members when a player joins.
|
||||
*
|
||||
* @param party The concerned party
|
||||
* @param party The concerned party
|
||||
* @param playerName The name of the player that joined
|
||||
*/
|
||||
private static void informPartyMembersJoin(Party party, String playerName) {
|
||||
@ -513,7 +527,7 @@ public final class PartyManager {
|
||||
/**
|
||||
* Notify party members when a party member quits.
|
||||
*
|
||||
* @param party The concerned party
|
||||
* @param party The concerned party
|
||||
* @param playerName The name of the player that left
|
||||
*/
|
||||
private static void informPartyMembersQuit(Party party, String playerName) {
|
||||
|
@ -22,9 +22,10 @@ public final class ShareHandler {
|
||||
/**
|
||||
* Distribute Xp amongst party members.
|
||||
*
|
||||
* @param xp Xp without party sharing
|
||||
* @param xp Xp without party sharing
|
||||
* @param mcMMOPlayer Player initiating the Xp gain
|
||||
* @param skillType Skill being used
|
||||
* @param skillType Skill being used
|
||||
*
|
||||
* @return True is the xp has been shared
|
||||
*/
|
||||
public static boolean handleXpShare(float xp, McMMOPlayer mcMMOPlayer, SkillType skillType) {
|
||||
@ -56,8 +57,9 @@ public final class ShareHandler {
|
||||
/**
|
||||
* Distribute Items amongst party members.
|
||||
*
|
||||
* @param drop Item that will get shared
|
||||
* @param drop Item that will get shared
|
||||
* @param mcMMOPlayer Player who picked up the item
|
||||
*
|
||||
* @return True if the item has been shared
|
||||
*/
|
||||
public static boolean handleItemShare(Item drop, McMMOPlayer mcMMOPlayer) {
|
||||
|
@ -28,5 +28,5 @@ public class DatabaseConversionTask extends BukkitRunnable {
|
||||
sender.sendMessage(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
* Add a LivingEntity to the bleedList if it is not in it.
|
||||
*
|
||||
* @param entity LivingEntity to add
|
||||
* @param ticks Number of bleeding ticks
|
||||
* @param ticks Number of bleeding ticks
|
||||
*/
|
||||
public static void add(LivingEntity entity, int ticks) {
|
||||
int newTicks = ticks;
|
||||
|
@ -26,7 +26,7 @@ public final class Acrobatics {
|
||||
public static boolean afkLevelingDisabled = Config.getInstance().getAcrobaticsAFKDisabled();
|
||||
public static boolean dodgeLightningDisabled = Config.getInstance().getDodgeLightningDisabled();
|
||||
|
||||
private Acrobatics() {};
|
||||
private Acrobatics() {}
|
||||
|
||||
protected static double calculateModifiedDodgeDamage(double damage, double damageModifier) {
|
||||
return Math.max(damage / damageModifier, 1.0);
|
||||
|
@ -44,6 +44,7 @@ public class AcrobaticsManager extends SkillManager {
|
||||
* Handle the damage reduction and XP gain from the Dodge ability
|
||||
*
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
*
|
||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||
*/
|
||||
public double dodgeCheck(double damage) {
|
||||
@ -72,6 +73,7 @@ public class AcrobaticsManager extends SkillManager {
|
||||
* Handle the damage reduction and XP gain from the Roll ability
|
||||
*
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
*
|
||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||
*/
|
||||
public double rollCheck(double damage) {
|
||||
@ -100,6 +102,7 @@ public class AcrobaticsManager extends SkillManager {
|
||||
* Handle the damage reduction and XP gain from the Graceful Roll ability
|
||||
*
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
*
|
||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||
*/
|
||||
private double gracefulRollCheck(double damage) {
|
||||
|
@ -40,7 +40,7 @@ public class ArcheryManager extends SkillManager {
|
||||
/**
|
||||
* Calculate bonus XP awarded for Archery when hitting a far-away target.
|
||||
*
|
||||
* @param target The {@link LivingEntity} damaged by the arrow
|
||||
* @param target The {@link LivingEntity} damaged by the arrow
|
||||
* @param damager The {@link Entity} who shot the arrow
|
||||
*/
|
||||
public void distanceXpBonus(LivingEntity target, Entity damager) {
|
||||
@ -69,7 +69,7 @@ public class ArcheryManager extends SkillManager {
|
||||
* Handle the effects of the Daze ability
|
||||
*
|
||||
* @param defender The {@link Player} being affected by the ability
|
||||
* @param arrow The {@link Arrow} that was fired
|
||||
* @param arrow The {@link Arrow} that was fired
|
||||
*/
|
||||
public double daze(Player defender, Arrow arrow) {
|
||||
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel)) {
|
||||
@ -98,7 +98,7 @@ public class ArcheryManager extends SkillManager {
|
||||
*
|
||||
* @param target The {@link LivingEntity} being affected by the ability
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @param arrow The {@link Arrow} that was fired
|
||||
* @param arrow The {@link Arrow} that was fired
|
||||
*/
|
||||
public double skillShot(LivingEntity target, double damage, Arrow arrow) {
|
||||
double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage);
|
||||
|
@ -16,6 +16,7 @@ public class Excavation {
|
||||
* Get the list of possible {@link ExcavationTreasure|ExcavationTreasures} obtained from a given block.
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check.
|
||||
*
|
||||
* @return the list of treasures that could be found
|
||||
*/
|
||||
protected static List<ExcavationTreasure> getTreasures(BlockState blockState) {
|
||||
|
@ -62,6 +62,7 @@ public final class Fishing {
|
||||
* Finds the possible drops of an entity
|
||||
*
|
||||
* @param target Targeted entity
|
||||
*
|
||||
* @return possibleDrops List of ItemStack that can be dropped
|
||||
*/
|
||||
protected static List<ShakeTreasure> findPossibleDrops(LivingEntity target) {
|
||||
@ -135,6 +136,7 @@ public final class Fishing {
|
||||
* Randomly chooses a drop among the list
|
||||
*
|
||||
* @param possibleDrops List of ItemStack that can be dropped
|
||||
*
|
||||
* @return Chosen ItemStack
|
||||
*/
|
||||
protected static ItemStack chooseDrop(List<ShakeTreasure> possibleDrops) {
|
||||
|
@ -33,6 +33,7 @@ public class Herbalism {
|
||||
* Convert blocks affected by the Green Thumb & Green Terra abilities.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
protected static boolean convertGreenTerraBlocks(BlockState blockState) {
|
||||
@ -62,6 +63,7 @@ public class Herbalism {
|
||||
* Calculate the drop amounts for cacti & sugar cane based on the blocks above them.
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the bottom block of the plant
|
||||
*
|
||||
* @return the number of bonus drops to award from the blocks in this plant
|
||||
*/
|
||||
protected static int calculateCatciAndSugarDrops(BlockState blockState) {
|
||||
@ -92,6 +94,7 @@ public class Herbalism {
|
||||
* Convert blocks affected by the Green Thumb & Green Terra abilities.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
protected static boolean convertShroomThumb(BlockState blockState) {
|
||||
|
@ -78,8 +78,9 @@ public class HerbalismManager extends SkillManager {
|
||||
/**
|
||||
* Handle the Farmer's Diet ability
|
||||
*
|
||||
* @param rankChange The # of levels to change rank for the food
|
||||
* @param rankChange The # of levels to change rank for the food
|
||||
* @param eventFoodLevel The initial change in hunger from the event
|
||||
*
|
||||
* @return the modified change in hunger for the event
|
||||
*/
|
||||
public int farmersDiet(int rankChange, int eventFoodLevel) {
|
||||
@ -90,6 +91,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* Process the Green Terra ability.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public boolean processGreenTerra(BlockState blockState) {
|
||||
@ -114,8 +116,6 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*/
|
||||
public void herbalismBlockCheck(BlockState blockState) {
|
||||
@ -180,6 +180,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* Process the Green Thumb ability for blocks.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public boolean processGreenThumbBlocks(BlockState blockState) {
|
||||
@ -195,6 +196,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* Process the Hylian Luck ability.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public boolean processHylianLuck(BlockState blockState) {
|
||||
@ -246,6 +248,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* Process the Shroom Thumb ability.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public boolean processShroomThumb(BlockState blockState) {
|
||||
|
@ -173,6 +173,7 @@ public class MiningManager extends SkillManager {
|
||||
* Increases the blast radius of the explosion.
|
||||
*
|
||||
* @param radius to modify
|
||||
*
|
||||
* @return modified radius
|
||||
*/
|
||||
public float biggerBombs(float radius) {
|
||||
|
@ -253,8 +253,9 @@ public class RepairManager extends SkillManager {
|
||||
/**
|
||||
* Computes repair bonuses.
|
||||
*
|
||||
* @param durability The durability of the item being repaired
|
||||
* @param durability The durability of the item being repaired
|
||||
* @param repairAmount The base amount of durability repaired to the item
|
||||
*
|
||||
* @return The final amount of durability repaired to the item
|
||||
*/
|
||||
private short repairCalculate(short durability, int repairAmount) {
|
||||
|
@ -13,6 +13,7 @@ public enum RepairItemType {
|
||||
* Get the base permissions associated with this RepairItemType.
|
||||
*
|
||||
* @param player The player to check the permissions for
|
||||
*
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
|
@ -41,7 +41,7 @@ public interface Repairable {
|
||||
|
||||
/**
|
||||
* Gets the minimum quantity of repair materials ignoring all other repair bonuses
|
||||
*
|
||||
* <p/>
|
||||
* This is typically set to the number of items needed to create that item, for example 5 for helmets or 2 for swords
|
||||
*
|
||||
* @return the minimum number of items
|
||||
@ -57,7 +57,7 @@ public interface Repairable {
|
||||
|
||||
/**
|
||||
* Gets the base repair durability on which to calculate bonuses.
|
||||
*
|
||||
* <p/>
|
||||
* This is actually the maximum durability divided by the minimum quantity
|
||||
*
|
||||
* @return the base repair durability
|
||||
|
@ -35,6 +35,7 @@ public class SmeltingManager extends SkillManager {
|
||||
* Process the Flux Mining ability.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public boolean processFluxMining(BlockState blockState) {
|
||||
|
@ -70,7 +70,7 @@ public class SwordsManager extends SkillManager {
|
||||
* Handle the effects of the Counter Attack ability
|
||||
*
|
||||
* @param attacker The {@link LivingEntity} being affected by the ability
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
*/
|
||||
public void counterAttackChecks(LivingEntity attacker, double damage) {
|
||||
if (Swords.counterAttackRequiresBlock && !getPlayer().isBlocking()) {
|
||||
|
@ -69,7 +69,7 @@ public class Taming {
|
||||
|
||||
case WOLF:
|
||||
return LocaleLoader.getString("Taming.Summon.Fail.Wolf");
|
||||
|
||||
|
||||
case HORSE:
|
||||
return LocaleLoader.getString("Taming.Summon.Fail.Horse");
|
||||
|
||||
|
@ -2,10 +2,10 @@ package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -87,7 +87,7 @@ public class TamingManager extends SkillManager {
|
||||
/**
|
||||
* Apply the Fast Food Service ability.
|
||||
*
|
||||
* @param wolf The wolf using the ability
|
||||
* @param wolf The wolf using the ability
|
||||
* @param damage The damage being absorbed by the wolf
|
||||
*/
|
||||
public void fastFoodService(Wolf wolf, double damage) {
|
||||
@ -108,7 +108,7 @@ public class TamingManager extends SkillManager {
|
||||
*
|
||||
* @param target The LivingEntity to apply Gore on
|
||||
* @param damage The initial damage
|
||||
* @param wolf The wolf using the ability
|
||||
* @param wolf The wolf using the ability
|
||||
*/
|
||||
public double gore(LivingEntity target, double damage, Wolf wolf) {
|
||||
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Taming.goreMaxChance, Taming.goreMaxBonusLevel)) {
|
||||
@ -197,7 +197,7 @@ public class TamingManager extends SkillManager {
|
||||
/**
|
||||
* Handle the Call of the Wild ability.
|
||||
*
|
||||
* @param type The type of entity to summon.
|
||||
* @param type The type of entity to summon.
|
||||
* @param summonAmount The amount of material needed to summon the entity
|
||||
*/
|
||||
private void callOfTheWild(EntityType type, int summonAmount) {
|
||||
|
@ -80,7 +80,8 @@ public class Unarmed {
|
||||
|
||||
nextSlot++;
|
||||
}
|
||||
} else if (firstEmpty != -1) {
|
||||
}
|
||||
else if (firstEmpty != -1) {
|
||||
drop.remove();
|
||||
dropStack.setAmount(dropAmount);
|
||||
inventory.setItem(firstEmpty, dropStack);
|
||||
|
@ -132,6 +132,7 @@ public class UnarmedManager extends SkillManager {
|
||||
* Check Iron Grip ability success
|
||||
*
|
||||
* @param defender The defending player
|
||||
*
|
||||
* @return true if the defender was not disarmed, false otherwise
|
||||
*/
|
||||
private boolean hasIronGrip(Player defender) {
|
||||
|
@ -32,15 +32,16 @@ public final class Woodcutting {
|
||||
protected enum ExperienceGainMethod {
|
||||
DEFAULT,
|
||||
TREE_FELLER,
|
||||
};
|
||||
}
|
||||
|
||||
private Woodcutting() {}
|
||||
|
||||
/**
|
||||
* Retrieves the experience reward from a log
|
||||
*
|
||||
* @param blockState Log being broken
|
||||
* @param blockState Log being broken
|
||||
* @param experienceGainMethod How the log is being broken
|
||||
*
|
||||
* @return Amount of experience
|
||||
*/
|
||||
protected static int getExperienceFromLog(BlockState blockState, ExperienceGainMethod experienceGainMethod) {
|
||||
@ -140,7 +141,7 @@ public final class Woodcutting {
|
||||
/**
|
||||
* Processes Tree Feller in a recursive manner
|
||||
*
|
||||
* @param blockState Block being checked
|
||||
* @param blockState Block being checked
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
*/
|
||||
/*
|
||||
@ -208,7 +209,8 @@ public final class Woodcutting {
|
||||
* Handles the durability loss
|
||||
*
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
* @param inHand tool being used
|
||||
* @param inHand tool being used
|
||||
*
|
||||
* @return True if the tool can sustain the durability loss
|
||||
*/
|
||||
protected static boolean handleDurabilityLoss(Set<BlockState> treeFellerBlocks, ItemStack inHand) {
|
||||
@ -240,12 +242,13 @@ public final class Woodcutting {
|
||||
* list of blocks used for future recursive calls of
|
||||
* 'processTree()'
|
||||
*
|
||||
* @param blockState Block to be added
|
||||
* @param blockState Block to be added
|
||||
* @param futureCenterBlocks List of blocks that will be used to call
|
||||
* 'processTree()'
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
* 'processTree()'
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
*
|
||||
* @return true if and only if the given blockState was a Log not already
|
||||
* in treeFellerBlocks.
|
||||
* in treeFellerBlocks.
|
||||
*/
|
||||
private static boolean handleBlock(BlockState blockState, List<BlockState> futureCenterBlocks, Set<BlockState> treeFellerBlocks) {
|
||||
if (treeFellerBlocks.contains(blockState) || mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
|
@ -21,6 +21,7 @@ public final class BlockUtils {
|
||||
* Checks to see if a given block awards XP.
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block awards XP, false otherwise
|
||||
*/
|
||||
public static boolean shouldBeWatched(BlockState blockState) {
|
||||
@ -31,6 +32,7 @@ public final class BlockUtils {
|
||||
* Check if a given block should allow for the activation of abilities
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block should allow ability activation, false otherwise
|
||||
*/
|
||||
public static boolean canActivateAbilities(BlockState blockState) {
|
||||
@ -72,6 +74,7 @@ public final class BlockUtils {
|
||||
* Check if a given block is an ore
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block is an ore, false otherwise
|
||||
*/
|
||||
public static boolean isOre(BlockState blockState) {
|
||||
@ -96,6 +99,7 @@ public final class BlockUtils {
|
||||
* Determine if a given block can be made mossy
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block can be made mossy, false otherwise
|
||||
*/
|
||||
public static boolean canMakeMossy(BlockState blockState) {
|
||||
@ -119,6 +123,7 @@ public final class BlockUtils {
|
||||
* Determine if a given block should be affected by Green Terra
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block should affected by Green Terra, false otherwise
|
||||
*/
|
||||
public static boolean affectedByGreenTerra(BlockState blockState) {
|
||||
@ -157,6 +162,7 @@ public final class BlockUtils {
|
||||
* Determine if a given block should be affected by Super Breaker
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block should affected by Super Breaker, false otherwise
|
||||
*/
|
||||
public static Boolean affectedBySuperBreaker(BlockState blockState) {
|
||||
@ -179,6 +185,7 @@ public final class BlockUtils {
|
||||
* Determine if a given block should be affected by Giga Drill Breaker
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block should affected by Giga Drill Breaker, false otherwise
|
||||
*/
|
||||
public static boolean affectedByGigaDrillBreaker(BlockState blockState) {
|
||||
@ -203,6 +210,7 @@ public final class BlockUtils {
|
||||
* Check if a given block is a log
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block is a log, false otherwise
|
||||
*/
|
||||
public static boolean isLog(BlockState blockState) {
|
||||
@ -221,6 +229,7 @@ public final class BlockUtils {
|
||||
* Check if a given block is a leaf
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block is a leaf, false otherwise
|
||||
*/
|
||||
public static boolean isLeaves(BlockState blockState) {
|
||||
@ -237,6 +246,7 @@ public final class BlockUtils {
|
||||
* Determine if a given block should be affected by Flux Mining
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block should affected by Flux Mining, false otherwise
|
||||
*/
|
||||
public static boolean affectedByFluxMining(BlockState blockState) {
|
||||
@ -254,6 +264,7 @@ public final class BlockUtils {
|
||||
* Determine if a given block can activate Herbalism abilities
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block can be activate Herbalism abilities, false otherwise
|
||||
*/
|
||||
public static boolean canActivateHerbalism(BlockState blockState) {
|
||||
@ -272,6 +283,7 @@ public final class BlockUtils {
|
||||
* Determine if a given block should be affected by Block Cracker
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block should affected by Block Cracker, false otherwise
|
||||
*/
|
||||
public static boolean affectedByBlockCracker(BlockState blockState) {
|
||||
@ -288,6 +300,7 @@ public final class BlockUtils {
|
||||
* Determine if a given block can be made into Mycelium
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block can be made in Mycelium, false otherwise
|
||||
*/
|
||||
public static boolean canMakeShroomy(BlockState blockState) {
|
||||
@ -305,6 +318,7 @@ public final class BlockUtils {
|
||||
* Determine if a given block is an mcMMO anvil
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
*
|
||||
* @return true if the block is an mcMMO anvil, false otherwise
|
||||
*/
|
||||
public static boolean isMcMMOAnvil(BlockState blockState) {
|
||||
|
@ -66,7 +66,7 @@ public final class ChimaeraWing {
|
||||
long lastTeleport = mcMMOPlayer.getChimeraWingLastUse();
|
||||
int cooldown = Config.getInstance().getChimaeraCooldown();
|
||||
|
||||
if (cooldown > 0 ) {
|
||||
if (cooldown > 0) {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(lastTeleport * Misc.TIME_CONVERSION_FACTOR, cooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
|
@ -68,9 +68,10 @@ public class EventUtils {
|
||||
/**
|
||||
* Simulate a block break event.
|
||||
*
|
||||
* @param block The block to break
|
||||
* @param player The player breaking the block
|
||||
* @param block The block to break
|
||||
* @param player The player breaking the block
|
||||
* @param shouldArmSwing true if an armswing event should be fired, false otherwise
|
||||
*
|
||||
* @return true if the event wasn't cancelled, false otherwise
|
||||
*/
|
||||
public static boolean simulateBlockBreak(Block block, Player player, boolean shouldArmSwing) {
|
||||
|
@ -19,6 +19,7 @@ public class ItemUtils {
|
||||
* Checks if the item is a bow.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a bow, false otherwise
|
||||
*/
|
||||
public static boolean isBow(ItemStack item) {
|
||||
@ -37,6 +38,7 @@ public class ItemUtils {
|
||||
* Checks if the item is a sword.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a sword, false otherwise
|
||||
*/
|
||||
public static boolean isSword(ItemStack item) {
|
||||
@ -59,6 +61,7 @@ public class ItemUtils {
|
||||
* Checks if the item is a hoe.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a hoe, false otherwise
|
||||
*/
|
||||
public static boolean isHoe(ItemStack item) {
|
||||
@ -81,6 +84,7 @@ public class ItemUtils {
|
||||
* Checks if the item is a shovel.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a shovel, false otherwise
|
||||
*/
|
||||
public static boolean isShovel(ItemStack item) {
|
||||
@ -103,6 +107,7 @@ public class ItemUtils {
|
||||
* Checks if the item is an axe.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is an axe, false otherwise
|
||||
*/
|
||||
public static boolean isAxe(ItemStack item) {
|
||||
@ -125,6 +130,7 @@ public class ItemUtils {
|
||||
* Checks if the item is a pickaxe.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a pickaxe, false otherwise
|
||||
*/
|
||||
public static boolean isPickaxe(ItemStack item) {
|
||||
@ -147,6 +153,7 @@ public class ItemUtils {
|
||||
* Checks if the item is a helmet.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a helmet, false otherwise
|
||||
*/
|
||||
public static boolean isHelmet(ItemStack item) {
|
||||
@ -169,6 +176,7 @@ public class ItemUtils {
|
||||
* Checks if the item is a chestplate.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a chestplate, false otherwise
|
||||
*/
|
||||
public static boolean isChestplate(ItemStack item) {
|
||||
@ -191,6 +199,7 @@ public class ItemUtils {
|
||||
* Checks if the item is a pair of pants.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a pair of pants, false otherwise
|
||||
*/
|
||||
public static boolean isLeggings(ItemStack item) {
|
||||
@ -213,6 +222,7 @@ public class ItemUtils {
|
||||
* Checks if the item is a pair of boots.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a pair of boots, false otherwise
|
||||
*/
|
||||
public static boolean isBoots(ItemStack item) {
|
||||
@ -235,6 +245,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a wearable armor piece.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is armor, false otherwise
|
||||
*/
|
||||
public static boolean isArmor(ItemStack item) {
|
||||
@ -245,6 +256,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a wearable *vanilla* armor piece.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is armor, false otherwise
|
||||
*/
|
||||
public static boolean isMinecraftArmor(ItemStack item) {
|
||||
@ -255,6 +267,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a leather armor piece.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is leather armor, false otherwise
|
||||
*/
|
||||
public static boolean isLeatherArmor(ItemStack item) {
|
||||
@ -274,6 +287,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a gold armor piece.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is gold armor, false otherwise
|
||||
*/
|
||||
public static boolean isGoldArmor(ItemStack item) {
|
||||
@ -293,6 +307,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is an iron armor piece.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is iron armor, false otherwise
|
||||
*/
|
||||
public static boolean isIronArmor(ItemStack item) {
|
||||
@ -312,6 +327,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a diamond armor piece.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is diamond armor, false otherwise
|
||||
*/
|
||||
public static boolean isDiamondArmor(ItemStack item) {
|
||||
@ -331,6 +347,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a chainmail armor piece.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is chainmail armor, false otherwise
|
||||
*/
|
||||
public static boolean isChainmailArmor(ItemStack item) {
|
||||
@ -350,6 +367,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a *vanilla* tool.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a tool, false otherwise
|
||||
*/
|
||||
public static boolean isMinecraftTool(ItemStack item) {
|
||||
@ -360,6 +378,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a stone tool.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a stone tool, false otherwise
|
||||
*/
|
||||
public static boolean isStoneTool(ItemStack item) {
|
||||
@ -380,6 +399,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a wooden tool.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a wooden tool, false otherwise
|
||||
*/
|
||||
public static boolean isWoodTool(ItemStack item) {
|
||||
@ -400,6 +420,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a string tool.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a string tool, false otherwise
|
||||
*/
|
||||
public static boolean isStringTool(ItemStack item) {
|
||||
@ -418,6 +439,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a gold tool.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a stone tool, false otherwise
|
||||
*/
|
||||
public static boolean isGoldTool(ItemStack item) {
|
||||
@ -438,6 +460,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is an iron tool.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is an iron tool, false otherwise
|
||||
*/
|
||||
public static boolean isIronTool(ItemStack item) {
|
||||
@ -461,6 +484,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a diamond tool.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a diamond tool, false otherwise
|
||||
*/
|
||||
public static boolean isDiamondTool(ItemStack item) {
|
||||
@ -481,6 +505,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is enchantable.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is enchantable, false otherwise
|
||||
*/
|
||||
public static boolean isEnchantable(ItemStack item) {
|
||||
@ -545,6 +570,7 @@ public class ItemUtils {
|
||||
* Check if an item is sharable.
|
||||
*
|
||||
* @param item Item that will get shared
|
||||
*
|
||||
* @return True if the item can be shared.
|
||||
*/
|
||||
public static boolean isSharable(ItemStack item) {
|
||||
@ -559,6 +585,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a mining drop.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a mining drop, false otherwise
|
||||
*/
|
||||
public static boolean isMiningDrop(ItemStack item) {
|
||||
@ -591,6 +618,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a herbalism drop.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a herbalism drop, false otherwise
|
||||
*/
|
||||
public static boolean isHerbalismDrop(ItemStack item) {
|
||||
@ -626,6 +654,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a mob drop.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a mob drop, false otherwise
|
||||
*/
|
||||
public static boolean isMobDrop(ItemStack item) {
|
||||
@ -668,6 +697,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a woodcutting drop.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a woodcutting drop, false otherwise
|
||||
*/
|
||||
public static boolean isWoodcuttingDrop(ItemStack item) {
|
||||
@ -687,6 +717,7 @@ public class ItemUtils {
|
||||
* Checks to see if an item is a miscellaneous drop. These items are read from the config file
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a miscellaneous drop, false otherwise
|
||||
*/
|
||||
public static boolean isMiscDrop(ItemStack item) {
|
||||
|
@ -22,8 +22,8 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
@ -47,7 +47,7 @@ public final class Misc {
|
||||
public static final float LEVELUP_PITCH = 0.5F; // Reduced to differentiate between vanilla level-up
|
||||
public static final float LEVELUP_VOLUME = 0.75F; // Use max volume always
|
||||
|
||||
private Misc() {};
|
||||
private Misc() {}
|
||||
|
||||
public static float getFizzPitch() {
|
||||
return 2.6F + (getRandom().nextFloat() - getRandom().nextFloat()) * 0.8F;
|
||||
@ -69,6 +69,7 @@ public final class Misc {
|
||||
* Get the upgrade tier of the item in hand.
|
||||
*
|
||||
* @param inHand The item to check the tier of
|
||||
*
|
||||
* @return the tier of the item
|
||||
*/
|
||||
public static int getTier(ItemStack inHand) {
|
||||
@ -99,9 +100,10 @@ public final class Misc {
|
||||
/**
|
||||
* Determine if two locations are near each other.
|
||||
*
|
||||
* @param first The first location
|
||||
* @param second The second location
|
||||
* @param first The first location
|
||||
* @param second The second location
|
||||
* @param maxDistance The max distance apart
|
||||
*
|
||||
* @return true if the distance between {@code first} and {@code second} is less than {@code maxDistance}, false otherwise
|
||||
*/
|
||||
public static boolean isNear(Location first, Location second, double maxDistance) {
|
||||
@ -122,7 +124,7 @@ public final class Misc {
|
||||
* Drop items at a given location.
|
||||
*
|
||||
* @param location The location to drop the items at
|
||||
* @param is The items to drop
|
||||
* @param is The items to drop
|
||||
* @param quantity The amount of items to drop
|
||||
*/
|
||||
public static void dropItems(Location location, ItemStack is, int quantity) {
|
||||
@ -135,8 +137,8 @@ public final class Misc {
|
||||
* Randomly drop an item at a given location.
|
||||
*
|
||||
* @param location The location to drop the items at
|
||||
* @param is The item to drop
|
||||
* @param chance The percentage chance for the item to drop
|
||||
* @param is The item to drop
|
||||
* @param chance The percentage chance for the item to drop
|
||||
*/
|
||||
public static void randomDropItem(Location location, ItemStack is, double chance) {
|
||||
if (random.nextInt(100) < chance) {
|
||||
@ -148,7 +150,7 @@ public final class Misc {
|
||||
* Drop items with random quantity at a given location.
|
||||
*
|
||||
* @param location The location to drop the items at
|
||||
* @param is The item to drop
|
||||
* @param is The item to drop
|
||||
* @param quantity The amount of items to drop
|
||||
*/
|
||||
public static void randomDropItems(Location location, ItemStack is, int quantity) {
|
||||
@ -169,7 +171,7 @@ public final class Misc {
|
||||
/**
|
||||
* Drop an item at a given location.
|
||||
*
|
||||
* @param location The location to drop the item at
|
||||
* @param location The location to drop the item at
|
||||
* @param itemStack The item to drop
|
||||
*/
|
||||
public static void dropItem(Location location, ItemStack itemStack) {
|
||||
@ -258,11 +260,12 @@ public final class Misc {
|
||||
|
||||
/**
|
||||
* Attempts to match any player names with the given name, and returns a list of all possibly matches.
|
||||
*
|
||||
* <p/>
|
||||
* This list is not sorted in any particular order.
|
||||
* If an exact match is found, the returned list will only contain a single result.
|
||||
*
|
||||
* @param partialName Name to match
|
||||
*
|
||||
* @return List of all possible names
|
||||
*/
|
||||
public static List<String> matchPlayer(String partialName) {
|
||||
|
@ -16,13 +16,14 @@ import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public final class MobHealthbarUtils {
|
||||
private MobHealthbarUtils() {};
|
||||
private MobHealthbarUtils() {}
|
||||
|
||||
/**
|
||||
* Fix issues with death messages caused by the mob healthbars.
|
||||
*
|
||||
* @param deathMessage The original death message
|
||||
* @param player The player who died
|
||||
* @param player The player who died
|
||||
*
|
||||
* @return the fixed death message
|
||||
*/
|
||||
public static String fixDeathMessage(String deathMessage, Player player) {
|
||||
@ -158,6 +159,7 @@ public final class MobHealthbarUtils {
|
||||
* Check if a given LivingEntity is a boss.
|
||||
*
|
||||
* @param livingEntity The {@link LivingEntity} of the livingEntity to check
|
||||
*
|
||||
* @return true if the livingEntity is a boss, false otherwise
|
||||
*/
|
||||
public static boolean isBoss(LivingEntity livingEntity) {
|
||||
|
@ -31,6 +31,7 @@ public final class ModUtils {
|
||||
* Get the custom tool associated with an item.
|
||||
*
|
||||
* @param item The item to check
|
||||
*
|
||||
* @return the tool if it exists, null otherwise
|
||||
*/
|
||||
public static CustomTool getToolFromItemStack(ItemStack item) {
|
||||
@ -41,6 +42,7 @@ public final class ModUtils {
|
||||
* Get the custom entity associated with an entity.
|
||||
*
|
||||
* @param entity The entity to check
|
||||
*
|
||||
* @return the entity is if exists, null otherwise
|
||||
*/
|
||||
public static CustomEntity getCustomEntity(Entity entity) {
|
||||
@ -51,6 +53,7 @@ public final class ModUtils {
|
||||
* Get the custom block associated with an block.
|
||||
*
|
||||
* @param blockState The BlockState of the bloc to check
|
||||
*
|
||||
* @return the block if it exists, null otherwise
|
||||
*/
|
||||
public static CustomBlock getCustomBlock(BlockState blockState) {
|
||||
@ -61,6 +64,7 @@ public final class ModUtils {
|
||||
* Check if a custom block is a woodcutting block.
|
||||
*
|
||||
* @param blockState The BlockState of the block to check
|
||||
*
|
||||
* @return true if the block represents a custom woodcutting block, false otherwise
|
||||
*/
|
||||
public static boolean isCustomWoodcuttingBlock(BlockState blockState) {
|
||||
@ -71,6 +75,7 @@ public final class ModUtils {
|
||||
* Check if a custom block should not activate abilites.
|
||||
*
|
||||
* @param blockState The BlockState of the block to check
|
||||
*
|
||||
* @return true if the block represents an ability block, false otherwise
|
||||
*/
|
||||
public static boolean isCustomAbilityBlock(BlockState blockState) {
|
||||
@ -81,6 +86,7 @@ public final class ModUtils {
|
||||
* Check if a custom block is a mining block.
|
||||
*
|
||||
* @param blockState The BlockState of the block to check
|
||||
*
|
||||
* @return true if the block represents a custom mining block, false otherwise
|
||||
*/
|
||||
public static boolean isCustomMiningBlock(BlockState blockState) {
|
||||
@ -91,6 +97,7 @@ public final class ModUtils {
|
||||
* Check if a custom block is an excavation block.
|
||||
*
|
||||
* @param blockState The BlockState of the block to check
|
||||
*
|
||||
* @return true if the block represents a custom excavation block, false otherwise
|
||||
*/
|
||||
public static boolean isCustomExcavationBlock(BlockState blockState) {
|
||||
@ -101,6 +108,7 @@ public final class ModUtils {
|
||||
* Check if a custom block is an herbalism block.
|
||||
*
|
||||
* @param blockState The BlockState of the block to check
|
||||
*
|
||||
* @return true if the block represents a custom herbalism block, false otherwise
|
||||
*/
|
||||
public static boolean isCustomHerbalismBlock(BlockState blockState) {
|
||||
@ -111,6 +119,7 @@ public final class ModUtils {
|
||||
* Check if a custom block is a leaf block.
|
||||
*
|
||||
* @param blockState The BlockState of the block to check
|
||||
*
|
||||
* @return true if the block represents leaves, false otherwise
|
||||
*/
|
||||
public static boolean isCustomLeafBlock(BlockState blockState) {
|
||||
@ -121,6 +130,7 @@ public final class ModUtils {
|
||||
* Check if a custom block is a log block.
|
||||
*
|
||||
* @param blockState The BlockState of the block to check
|
||||
*
|
||||
* @return true if the block represents a log, false otherwise
|
||||
*/
|
||||
public static boolean isCustomLogBlock(BlockState blockState) {
|
||||
@ -131,6 +141,7 @@ public final class ModUtils {
|
||||
* Check if a custom block is an ore block.
|
||||
*
|
||||
* @param blockState The BlockState of the block to check
|
||||
*
|
||||
* @return true if the block represents an ore, false otherwise
|
||||
*/
|
||||
public static boolean isCustomOreBlock(BlockState blockState) {
|
||||
@ -141,6 +152,7 @@ public final class ModUtils {
|
||||
* Checks to see if an item is a custom tool.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is a custom tool, false otherwise
|
||||
*/
|
||||
public static boolean isCustomTool(ItemStack item) {
|
||||
@ -151,6 +163,7 @@ public final class ModUtils {
|
||||
* Checks to see if an entity is a custom entity.
|
||||
*
|
||||
* @param entity Entity to check
|
||||
*
|
||||
* @return true if the entity is a custom entity, false otherwise
|
||||
*/
|
||||
public static boolean isCustomEntity(Entity entity) {
|
||||
@ -161,6 +174,7 @@ public final class ModUtils {
|
||||
* Check if a custom entity is a boss.
|
||||
*
|
||||
* @param entity The entity to check
|
||||
*
|
||||
* @return true if the entity represents a boss, false otherwise
|
||||
*/
|
||||
public static boolean isCustomBossEntity(Entity entity) {
|
||||
|
@ -8,6 +8,7 @@ public class StringUtils {
|
||||
* Gets a capitalized version of the target string.
|
||||
*
|
||||
* @param target String to capitalize
|
||||
*
|
||||
* @return the capitalized string
|
||||
*/
|
||||
public static String getCapitalized(String target) {
|
||||
@ -44,6 +45,7 @@ public class StringUtils {
|
||||
* Gets the int represented by this string.
|
||||
*
|
||||
* @param string The string to parse
|
||||
*
|
||||
* @return the int represented by this string
|
||||
*/
|
||||
public static int getInt(String string) {
|
||||
@ -59,6 +61,7 @@ public class StringUtils {
|
||||
* Gets the long represented by this string.
|
||||
*
|
||||
* @param string The string to parse
|
||||
*
|
||||
* @return the long represented by this string
|
||||
*/
|
||||
public static long getLong(String string) {
|
||||
@ -74,6 +77,7 @@ public class StringUtils {
|
||||
* Determine if a string represents an Integer
|
||||
*
|
||||
* @param string String to check
|
||||
*
|
||||
* @return true if the string is an Integer, false otherwise
|
||||
*/
|
||||
public static boolean isInt(String string) {
|
||||
@ -90,6 +94,7 @@ public class StringUtils {
|
||||
* Determine if a string represents a Double
|
||||
*
|
||||
* @param string String to check
|
||||
*
|
||||
* @return true if the string is a Double, false otherwise
|
||||
*/
|
||||
public static boolean isDouble(String string) {
|
||||
|
@ -7,9 +7,9 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Loads a specific chunklet
|
||||
*
|
||||
* @param cx Chunklet X coordinate that needs to be loaded
|
||||
* @param cy Chunklet Y coordinate that needs to be loaded
|
||||
* @param cz Chunklet Z coordinate that needs to be loaded
|
||||
* @param cx Chunklet X coordinate that needs to be loaded
|
||||
* @param cy Chunklet Y coordinate that needs to be loaded
|
||||
* @param cz Chunklet Z coordinate that needs to be loaded
|
||||
* @param world World that the chunklet needs to be loaded in
|
||||
*/
|
||||
public void loadChunklet(int cx, int cy, int cz, World world);
|
||||
@ -17,9 +17,9 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Unload a specific chunklet
|
||||
*
|
||||
* @param cx Chunklet X coordinate that needs to be unloaded
|
||||
* @param cy Chunklet Y coordinate that needs to be unloaded
|
||||
* @param cz Chunklet Z coordinate that needs to be unloaded
|
||||
* @param cx Chunklet X coordinate that needs to be unloaded
|
||||
* @param cy Chunklet Y coordinate that needs to be unloaded
|
||||
* @param cz Chunklet Z coordinate that needs to be unloaded
|
||||
* @param world World that the chunklet needs to be unloaded from
|
||||
*/
|
||||
public void unloadChunklet(int cx, int cy, int cz, World world);
|
||||
@ -27,8 +27,8 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Load a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be loaded
|
||||
* @param cz Chunk Z coordinate that is to be loaded
|
||||
* @param cx Chunk X coordinate that is to be loaded
|
||||
* @param cz Chunk Z coordinate that is to be loaded
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void loadChunk(int cx, int cz, World world);
|
||||
@ -36,8 +36,8 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Unload a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be unloaded
|
||||
* @param cz Chunk Z coordinate that is to be unloaded
|
||||
* @param cx Chunk X coordinate that is to be unloaded
|
||||
* @param cz Chunk Z coordinate that is to be unloaded
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void unloadChunk(int cx, int cz, World world);
|
||||
@ -45,8 +45,8 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Informs the ChunkletManager a chunk is loaded
|
||||
*
|
||||
* @param cx Chunk X coordinate that is loaded
|
||||
* @param cz Chunk Z coordinate that is loaded
|
||||
* @param cx Chunk X coordinate that is loaded
|
||||
* @param cz Chunk Z coordinate that is loaded
|
||||
* @param world World that the chunk was loaded in
|
||||
*/
|
||||
public void chunkLoaded(int cx, int cz, World world);
|
||||
@ -54,8 +54,8 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Informs the ChunkletManager a chunk is unloaded
|
||||
*
|
||||
* @param cx Chunk X coordinate that is unloaded
|
||||
* @param cz Chunk Z coordinate that is unloaded
|
||||
* @param cx Chunk X coordinate that is unloaded
|
||||
* @param cz Chunk Z coordinate that is unloaded
|
||||
* @param world World that the chunk was unloaded in
|
||||
*/
|
||||
public void chunkUnloaded(int cx, int cz, World world);
|
||||
@ -94,10 +94,11 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Check to see if a given location is set to true
|
||||
*
|
||||
* @param x X coordinate to check
|
||||
* @param y Y coordinate to check
|
||||
* @param z Z coordinate to check
|
||||
* @param x X coordinate to check
|
||||
* @param y Y coordinate to check
|
||||
* @param z Z coordinate to check
|
||||
* @param world World to check in
|
||||
*
|
||||
* @return true if the given location is set to true, false if otherwise
|
||||
*/
|
||||
public boolean isTrue(int x, int y, int z, World world);
|
||||
@ -106,6 +107,7 @@ public interface ChunkletManager {
|
||||
* Check to see if a given block location is set to true
|
||||
*
|
||||
* @param block Block location to check
|
||||
*
|
||||
* @return true if the given block location is set to true, false if otherwise
|
||||
*/
|
||||
public boolean isTrue(Block block);
|
||||
@ -113,9 +115,9 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Set a given location to true, should create stores as necessary if the location does not exist
|
||||
*
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param world World to set in
|
||||
*/
|
||||
public void setTrue(int x, int y, int z, World world);
|
||||
@ -130,9 +132,9 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Set a given location to false, should not create stores if one does not exist for the given location
|
||||
*
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param world World to set in
|
||||
*/
|
||||
public void setFalse(int x, int y, int z, World world);
|
||||
|
@ -12,6 +12,7 @@ public interface ChunkletStore extends Serializable {
|
||||
* @param x x coordinate in current chunklet
|
||||
* @param y y coordinate in current chunklet
|
||||
* @param z z coordinate in current chunklet
|
||||
*
|
||||
* @return true if the value is true at the given coordinates, false if otherwise
|
||||
*/
|
||||
public boolean isTrue(int x, int y, int z);
|
||||
|
@ -303,7 +303,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cStore ChunkletStore to save
|
||||
* @param cStore ChunkletStore to save
|
||||
* @param location Where on the disk to put it
|
||||
*/
|
||||
private void serializeChunkletStore(ChunkletStore cStore, File location) {
|
||||
@ -345,6 +345,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
|
||||
/**
|
||||
* @param location Where on the disk to read from
|
||||
*
|
||||
* @return ChunkletStore from the specified location
|
||||
*/
|
||||
private ChunkletStore deserializeChunkletStore(File location) {
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.block.Block;
|
||||
|
||||
/**
|
||||
* A ChunkletManager implementation that does nothing and returns false for all checks.
|
||||
*
|
||||
* <p/>
|
||||
* Useful for turning off Chunklets without actually doing much work
|
||||
*/
|
||||
public class NullChunkletManager implements ChunkletManager {
|
||||
|
@ -19,9 +19,9 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Loads a specific chunklet
|
||||
*
|
||||
* @param cx Chunklet X coordinate that needs to be loaded
|
||||
* @param cy Chunklet Y coordinate that needs to be loaded
|
||||
* @param cz Chunklet Z coordinate that needs to be loaded
|
||||
* @param cx Chunklet X coordinate that needs to be loaded
|
||||
* @param cy Chunklet Y coordinate that needs to be loaded
|
||||
* @param cz Chunklet Z coordinate that needs to be loaded
|
||||
* @param world World that the chunklet needs to be loaded in
|
||||
*/
|
||||
public void loadChunklet(int cx, int cy, int cz, World world);
|
||||
@ -29,9 +29,9 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Unload a specific chunklet
|
||||
*
|
||||
* @param cx Chunklet X coordinate that needs to be unloaded
|
||||
* @param cy Chunklet Y coordinate that needs to be unloaded
|
||||
* @param cz Chunklet Z coordinate that needs to be unloaded
|
||||
* @param cx Chunklet X coordinate that needs to be unloaded
|
||||
* @param cy Chunklet Y coordinate that needs to be unloaded
|
||||
* @param cz Chunklet Z coordinate that needs to be unloaded
|
||||
* @param world World that the chunklet needs to be unloaded from
|
||||
*/
|
||||
public void unloadChunklet(int cx, int cy, int cz, World world);
|
||||
@ -39,8 +39,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Load a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be loaded
|
||||
* @param cz Chunk Z coordinate that is to be loaded
|
||||
* @param cx Chunk X coordinate that is to be loaded
|
||||
* @param cz Chunk Z coordinate that is to be loaded
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void loadChunk(int cx, int cz, World world, Entity[] entities);
|
||||
@ -48,8 +48,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Unload a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be unloaded
|
||||
* @param cz Chunk Z coordinate that is to be unloaded
|
||||
* @param cx Chunk X coordinate that is to be unloaded
|
||||
* @param cz Chunk Z coordinate that is to be unloaded
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void unloadChunk(int cx, int cz, World world);
|
||||
@ -57,8 +57,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Saves a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be saved
|
||||
* @param cz Chunk Z coordinate that is to be saved
|
||||
* @param cx Chunk X coordinate that is to be saved
|
||||
* @param cz Chunk Z coordinate that is to be saved
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void saveChunk(int cx, int cz, World world);
|
||||
@ -68,8 +68,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Informs the ChunkletManager a chunk is loaded
|
||||
*
|
||||
* @param cx Chunk X coordinate that is loaded
|
||||
* @param cz Chunk Z coordinate that is loaded
|
||||
* @param cx Chunk X coordinate that is loaded
|
||||
* @param cz Chunk Z coordinate that is loaded
|
||||
* @param world World that the chunk was loaded in
|
||||
*/
|
||||
public void chunkLoaded(int cx, int cz, World world);
|
||||
@ -77,8 +77,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Informs the ChunkletManager a chunk is unloaded
|
||||
*
|
||||
* @param cx Chunk X coordinate that is unloaded
|
||||
* @param cz Chunk Z coordinate that is unloaded
|
||||
* @param cx Chunk X coordinate that is unloaded
|
||||
* @param cz Chunk Z coordinate that is unloaded
|
||||
* @param world World that the chunk was unloaded in
|
||||
*/
|
||||
public void chunkUnloaded(int cx, int cz, World world);
|
||||
@ -117,10 +117,11 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Check to see if a given location is set to true
|
||||
*
|
||||
* @param x X coordinate to check
|
||||
* @param y Y coordinate to check
|
||||
* @param z Z coordinate to check
|
||||
* @param x X coordinate to check
|
||||
* @param y Y coordinate to check
|
||||
* @param z Z coordinate to check
|
||||
* @param world World to check in
|
||||
*
|
||||
* @return true if the given location is set to true, false if otherwise
|
||||
*/
|
||||
public boolean isTrue(int x, int y, int z, World world);
|
||||
@ -129,6 +130,7 @@ public interface ChunkManager {
|
||||
* Check to see if a given block location is set to true
|
||||
*
|
||||
* @param block Block location to check
|
||||
*
|
||||
* @return true if the given block location is set to true, false if otherwise
|
||||
*/
|
||||
public boolean isTrue(Block block);
|
||||
@ -137,6 +139,7 @@ public interface ChunkManager {
|
||||
* Check to see if a given BlockState location is set to true
|
||||
*
|
||||
* @param blockState BlockState to check
|
||||
*
|
||||
* @return true if the given BlockState location is set to true, false if otherwise
|
||||
*/
|
||||
public boolean isTrue(BlockState blockState);
|
||||
@ -144,9 +147,9 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Set a given location to true, should create stores as necessary if the location does not exist
|
||||
*
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param world World to set in
|
||||
*/
|
||||
public void setTrue(int x, int y, int z, World world);
|
||||
@ -168,9 +171,9 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Set a given location to false, should not create stores if one does not exist for the given location
|
||||
*
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param world World to set in
|
||||
*/
|
||||
public void setFalse(int x, int y, int z, World world);
|
||||
|
@ -42,6 +42,7 @@ public interface ChunkStore extends Serializable {
|
||||
* @param x x coordinate in current chunklet
|
||||
* @param y y coordinate in current chunklet
|
||||
* @param z z coordinate in current chunklet
|
||||
*
|
||||
* @return true if the value is true at the given coordinates, false if otherwise
|
||||
*/
|
||||
public boolean isTrue(int x, int y, int z);
|
||||
|
@ -160,7 +160,8 @@ public class HashChunkManager implements ChunkManager {
|
||||
try {
|
||||
chunkStore = readChunkStore(world, cx, cz);
|
||||
}
|
||||
catch (Exception e) {}
|
||||
catch (Exception e) {
|
||||
}
|
||||
|
||||
if (chunkStore == null) {
|
||||
return;
|
||||
|
@ -143,7 +143,8 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
try {
|
||||
store[x][z][y] = temp[x][y][z];
|
||||
}
|
||||
catch (Exception e) {}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,8 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
|
||||
this.newManager.setTrue(this.cxPos, this.y2, this.czPos, this.world);
|
||||
}
|
||||
catch (Exception e) {}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public final class CommandRegistrationManager {
|
||||
private CommandRegistrationManager() {};
|
||||
private CommandRegistrationManager() {}
|
||||
|
||||
private static String permissionsMessage = LocaleLoader.getString("mcMMO.NoPermission");
|
||||
|
||||
|
@ -58,7 +58,7 @@ public final class CommandUtils {
|
||||
}
|
||||
|
||||
public static boolean hidden(CommandSender sender, Player target, boolean hasPermission) {
|
||||
if (sender instanceof Player && !((Player)sender).canSee(target) && !hasPermission) {
|
||||
if (sender instanceof Player && !((Player) sender).canSee(target) && !hasPermission) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -86,8 +86,8 @@ public final class CommandUtils {
|
||||
/**
|
||||
* Checks if there is a valid mcMMOPlayer object.
|
||||
*
|
||||
* @param sender CommandSender who used the command
|
||||
* @param playerName name of the target player
|
||||
* @param sender CommandSender who used the command
|
||||
* @param playerName name of the target player
|
||||
* @param mcMMOPlayer mcMMOPlayer object of the target player
|
||||
*
|
||||
* @return true if the player is online and a valid mcMMOPlayer object was found
|
||||
|
@ -49,8 +49,9 @@ public class FormulaManager {
|
||||
* the amount of levels and experience, using the previously
|
||||
* used formula type.
|
||||
*
|
||||
* @param skillLevel Amount of levels
|
||||
* @param skillLevel Amount of levels
|
||||
* @param skillXPLevel Amount of experience
|
||||
*
|
||||
* @return The total amount of experience
|
||||
*/
|
||||
public int calculateTotalExperience(int skillLevel, int skillXPLevel) {
|
||||
@ -69,9 +70,10 @@ public class FormulaManager {
|
||||
* Calculate how many levels a player should have using
|
||||
* the new formula type.
|
||||
*
|
||||
* @param skillType skill where new levels and experience are calculated for
|
||||
* @param experience total amount of experience
|
||||
* @param skillType skill where new levels and experience are calculated for
|
||||
* @param experience total amount of experience
|
||||
* @param formulaType The new {@link FormulaType}
|
||||
*
|
||||
* @return the amount of levels and experience
|
||||
*/
|
||||
public int[] calculateNewLevel(SkillType skillType, int experience, FormulaType formulaType) {
|
||||
@ -99,8 +101,9 @@ public class FormulaManager {
|
||||
* if cache doesn't contain the given value it is calculated and added
|
||||
* to the cached data.
|
||||
*
|
||||
* @param level level to check
|
||||
* @param level level to check
|
||||
* @param formulaType The {@link FormulaType} used
|
||||
*
|
||||
* @return amount of experience needed to reach next level
|
||||
*/
|
||||
public int getCachedXpToLevel(int level, FormulaType formulaType) {
|
||||
|
@ -20,6 +20,7 @@ public final class UserManager {
|
||||
* Add a new user.
|
||||
*
|
||||
* @param player The player to create a user record for
|
||||
*
|
||||
* @return the player's {@link McMMOPlayer} object
|
||||
*/
|
||||
public static McMMOPlayer addUser(Player player) {
|
||||
@ -74,6 +75,7 @@ public final class UserManager {
|
||||
* Get the McMMOPlayer of a player by name.
|
||||
*
|
||||
* @param playerName The name of the player whose McMMOPlayer to retrieve
|
||||
*
|
||||
* @return the player's McMMOPlayer object
|
||||
*/
|
||||
public static McMMOPlayer getPlayer(String playerName) {
|
||||
@ -84,6 +86,7 @@ public final class UserManager {
|
||||
* Get the McMMOPlayer of a player.
|
||||
*
|
||||
* @param player The player whose McMMOPlayer to retrieve
|
||||
*
|
||||
* @return the player's McMMOPlayer object
|
||||
*/
|
||||
public static McMMOPlayer getPlayer(OfflinePlayer player) {
|
||||
|
@ -370,8 +370,8 @@ public final class CombatUtils {
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param damage Amount of damage to attempt to do
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param damage Amount of damage to attempt to do
|
||||
* @param attacker Player to pass to event as damager
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, double damage, LivingEntity attacker) {
|
||||
@ -381,8 +381,8 @@ public final class CombatUtils {
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param damage Amount of damage to attempt to do
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param damage Amount of damage to attempt to do
|
||||
* @param attacker Player to pass to event as damager
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, double damage, DamageCause cause, Entity attacker) {
|
||||
@ -397,9 +397,9 @@ public final class CombatUtils {
|
||||
* Apply Area-of-Effect ability actions.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param target The defending entity
|
||||
* @param damage The initial damage amount
|
||||
* @param type The type of skill being used
|
||||
* @param target The defending entity
|
||||
* @param damage The initial damage amount
|
||||
* @param type The type of skill being used
|
||||
*/
|
||||
public static void applyAbilityAoE(Player attacker, LivingEntity target, double damage, SkillType type) {
|
||||
int numberOfTargets = Misc.getTier(attacker.getItemInHand()); // The higher the weapon tier, the more targets you hit
|
||||
@ -450,8 +450,8 @@ public final class CombatUtils {
|
||||
* Start the task that gives combat XP.
|
||||
*
|
||||
* @param mcMMOPlayer The attacking player
|
||||
* @param target The defending entity
|
||||
* @param skillType The skill being used
|
||||
* @param target The defending entity
|
||||
* @param skillType The skill being used
|
||||
*/
|
||||
private static void startGainXp(McMMOPlayer mcMMOPlayer, LivingEntity target, SkillType skillType, double multiplier) {
|
||||
double baseXP = 0;
|
||||
@ -541,6 +541,7 @@ public final class CombatUtils {
|
||||
*
|
||||
* @param player The attacking Player
|
||||
* @param entity The defending Entity
|
||||
*
|
||||
* @return true if the Entity should be damaged, false otherwise.
|
||||
*/
|
||||
private static boolean shouldBeAffected(Player player, Entity entity) {
|
||||
@ -577,8 +578,9 @@ public final class CombatUtils {
|
||||
/**
|
||||
* Checks to see if an entity is currently invincible.
|
||||
*
|
||||
* @param entity The {@link LivingEntity} to check
|
||||
* @param entity The {@link LivingEntity} to check
|
||||
* @param eventDamage The damage from the event the entity is involved in
|
||||
*
|
||||
* @return true if the entity is invincible, false otherwise
|
||||
*/
|
||||
public static boolean isInvincible(LivingEntity entity, double eventDamage) {
|
||||
@ -593,7 +595,8 @@ public final class CombatUtils {
|
||||
* Checks to see if an entity is currently friendly toward a given player.
|
||||
*
|
||||
* @param attacker The player to check.
|
||||
* @param pet The entity to check.
|
||||
* @param pet The entity to check.
|
||||
*
|
||||
* @return true if the entity is friendly, false otherwise
|
||||
*/
|
||||
public static boolean isFriendlyPet(Player attacker, Tameable pet) {
|
||||
|
@ -20,7 +20,7 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
|
||||
public final class ParticleEffectUtils {
|
||||
|
||||
private ParticleEffectUtils() {};
|
||||
private ParticleEffectUtils() {}
|
||||
|
||||
public static void playBleedEffect(LivingEntity livingEntity) {
|
||||
if (!Config.getInstance().getBleedEffectEnabled()) {
|
||||
|
@ -9,7 +9,7 @@ public final class PerksUtils {
|
||||
private static final int LUCKY_SKILL_ACTIVATION_CHANCE = 75;
|
||||
private static final int NORMAL_SKILL_ACTIVATION_CHANCE = 100;
|
||||
|
||||
private PerksUtils() {};
|
||||
private PerksUtils() {}
|
||||
|
||||
public static int handleCooldownPerks(Player player, int cooldown) {
|
||||
if (Permissions.halvedCooldowns(player)) {
|
||||
@ -67,7 +67,8 @@ public final class PerksUtils {
|
||||
* Calculate activation chance for a skill.
|
||||
*
|
||||
* @param player Player to check the activation chance for
|
||||
* @param skill SkillType to check the activation chance of
|
||||
* @param skill SkillType to check the activation chance of
|
||||
*
|
||||
* @return the activation chance with "lucky perk" accounted for
|
||||
*/
|
||||
public static int handleLuckyPerks(Player player, SkillType skill) {
|
||||
|
@ -44,8 +44,8 @@ public class SkillUtils {
|
||||
* Calculate the time remaining until the cooldown expires.
|
||||
*
|
||||
* @param deactivatedTimeStamp Time of deactivation
|
||||
* @param cooldown The length of the cooldown
|
||||
* @param player The Player to check for cooldown perks
|
||||
* @param cooldown The length of the cooldown
|
||||
* @param player The Player to check for cooldown perks
|
||||
*
|
||||
* @return the number of seconds remaining before the cooldown expires
|
||||
*/
|
||||
@ -58,7 +58,7 @@ public class SkillUtils {
|
||||
* This does NOT account for cooldown perks!
|
||||
*
|
||||
* @param deactivatedTimeStamp Time of deactivation in seconds
|
||||
* @param cooldown The length of the cooldown in seconds
|
||||
* @param cooldown The length of the cooldown in seconds
|
||||
*
|
||||
* @return true if the cooldown is expired
|
||||
*/
|
||||
@ -70,6 +70,7 @@ public class SkillUtils {
|
||||
* Checks if the given string represents a valid skill
|
||||
*
|
||||
* @param skillName The name of the skill to check
|
||||
*
|
||||
* @return true if this is a valid skill, false otherwise
|
||||
*/
|
||||
public static boolean isSkill(String skillName) {
|
||||
@ -171,6 +172,7 @@ public class SkillUtils {
|
||||
* Modify the durability of an ItemStack.
|
||||
*
|
||||
* @param itemStack The ItemStack which durability should be modified
|
||||
*
|
||||
* @return the itemStack with modified durability
|
||||
*/
|
||||
public static void handleDurabilityChange(ItemStack itemStack, int durabilityModifier) {
|
||||
|
Loading…
Reference in New Issue
Block a user