Update code style

This commit is contained in:
nossr50 2019-04-24 22:52:53 -07:00
parent dc758a6dfc
commit 02a69cbb05
334 changed files with 4660 additions and 5158 deletions

View File

@ -8,7 +8,8 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public final class AbilityAPI {
private AbilityAPI() {}
private AbilityAPI() {
}
public static boolean berserkEnabled(Player player) {
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.BERSERK);

View File

@ -10,18 +10,19 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public final class ChatAPI {
private ChatAPI() {}
private ChatAPI() {
}
/**
* Send a message to all members of a party
* </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);
@ -32,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) {
@ -46,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);
@ -60,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) {

View File

@ -19,7 +19,8 @@ import java.util.Set;
import java.util.UUID;
public final class ExperienceAPI {
private ExperienceAPI() {}
private ExperienceAPI() {
}
/**
* Returns whether given string is a valid type of skill suitable for the
@ -60,10 +61,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
*/
@Deprecated
@ -76,12 +76,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param xpGainReason The reason to gain XP
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
*/
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason) {
@ -93,13 +92,12 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param xpGainReason The reason to gain XP
* @param isUnshared true if the XP cannot be shared with party members
*
* @throws InvalidSkillException if the given skill is not valid
* @param isUnshared true if the XP cannot be shared with party members
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
*/
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason, boolean isUnshared) {
@ -129,15 +127,13 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param playerName The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @deprecated We're using uuids to get an offline player
* replaced by {@link #addRawXPOffline(UUID uuid, String skillType, float XP)}
*
* @param playerName The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
@Deprecated
public static void addRawXPOffline(String playerName, String skillType, float XP) {
@ -149,11 +145,10 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The UUID of player to add XP to
* @param uuid The UUID of player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*
* @throws InvalidSkillException if the given skill is not valid
* @param XP The amount of XP to add
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static void addRawXPOffline(UUID uuid, String skillType, float XP) {
@ -165,10 +160,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
*/
@Deprecated
@ -181,12 +175,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param xpGainReason The reason to gain XP
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
*/
public static void addMultipliedXP(Player player, String skillType, int XP, String xpGainReason) {
@ -199,10 +192,9 @@ 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
*
* @throws InvalidSkillException if the given skill is not valid
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
@Deprecated
@ -215,10 +207,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
*/
@Deprecated
@ -231,12 +222,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param xpGainReason The reason to gain XP
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
*/
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason) {
@ -248,13 +238,12 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param xpGainReason The reason to gain XP
* @param isUnshared true if the XP cannot be shared with party members
*
* @throws InvalidSkillException if the given skill is not valid
* @param isUnshared true if the XP cannot be shared with party members
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
*/
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
@ -274,10 +263,9 @@ 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
*
* @throws InvalidSkillException if the given skill is not valid
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
@Deprecated
@ -293,10 +281,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
*/
@Deprecated
@ -310,12 +297,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param xpGainReason The reason to gain XP
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
*/
public static void addXP(Player player, String skillType, int XP, String xpGainReason) {
@ -328,13 +314,12 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @param xpGainReason The reason to gain XP
* @param isUnshared true if the XP cannot be shared with party members
*
* @throws InvalidSkillException if the given skill is not valid
* @param isUnshared true if the XP cannot be shared with party members
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
*/
public static void addXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
@ -351,11 +336,10 @@ 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) {
@ -368,11 +352,10 @@ 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
*/
@Deprecated
@ -385,12 +368,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The player to get XP for
* @param uuid The player to get XP for
* @param skillType The skill to get XP for
* @return the amount of XP in a given skill
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getOfflineXP(UUID uuid, String skillType) {
@ -402,11 +384,10 @@ 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) {
@ -419,11 +400,10 @@ 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
*/
@Deprecated
@ -436,12 +416,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The player to get XP for
* @param uuid The player to get XP for
* @param skillType The skill to get XP for
* @return the amount of XP in a given skill
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws 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(UUID uuid, String skillType) {
@ -453,11 +432,10 @@ 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) {
@ -470,11 +448,10 @@ 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
*/
@Deprecated
@ -487,12 +464,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The player to get XP for
* @param uuid The player to get XP for
* @param skillType The skill to get XP for
* @return the total amount of XP needed to reach the next level
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getOfflineXPToNextLevel(UUID uuid, String skillType) {
@ -504,11 +480,10 @@ 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) {
@ -525,11 +500,10 @@ 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
*/
@Deprecated
@ -545,12 +519,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The player to get XP for
* @param uuid The player to get XP for
* @param skillType The skill to get XP for
* @return the amount of XP needed to reach the next level
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws 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 getOfflineXPRemaining(UUID uuid, String skillType) {
@ -565,10 +538,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
*/
public static void addLevel(Player player, String skillType, int levels) {
@ -581,10 +553,9 @@ 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
*
* @throws InvalidSkillException if the given skill is not valid
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
@Deprecated
@ -612,11 +583,10 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The player to add levels to
* @param uuid The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
*
* @throws InvalidSkillException if the given skill is not valid
* @param levels Number of levels to add
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static void addLevelOffline(UUID uuid, String skillType, int levels) {
@ -643,10 +613,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
*/
public static int getLevel(Player player, String skillType) {
@ -659,10 +628,9 @@ 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
*/
@Deprecated
@ -675,11 +643,10 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The player to get the level for
* @param uuid The player to get the level for
* @param skillType The skill to get the level for
* @return the level of a given skill
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static int getLevelOffline(UUID uuid, String skillType) {
@ -705,7 +672,6 @@ public final class ExperienceAPI {
*
* @param playerName The player to get the power level for
* @return the power level of the player
*
* @throws InvalidPlayerException if the given player does not exist in the database
*/
@Deprecated
@ -727,7 +693,6 @@ public final class ExperienceAPI {
*
* @param uuid The player to get the power level for
* @return the power level of the player
*
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static int getPowerLevelOffline(UUID uuid) {
@ -748,7 +713,6 @@ public final class ExperienceAPI {
*
* @param skillType The skill to get the level cap for
* @return the level cap of a given skill
*
* @throws InvalidSkillException if the given skill is not valid
*/
public static int getLevelCap(String skillType) {
@ -762,7 +726,6 @@ public final class ExperienceAPI {
*
* @param skillType The skill to get the level cap for
* @return the level cap of a given skill
*
* @throws InvalidSkillException if the given skill is not valid
*/
public static int getLevelCap(PrimarySkillType skillType) {
@ -771,11 +734,11 @@ public final class ExperienceAPI {
/**
* Checks whether or not a specific skill is level capped
*
* @param skillType target skill
* @return true if the skill has a level cap
*/
public static boolean isSkillLevelCapped(PrimarySkillType skillType)
{
public static boolean isSkillLevelCapped(PrimarySkillType skillType) {
return mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(skillType);
}
@ -796,13 +759,11 @@ 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
*/
@Deprecated
public static int getPlayerRankSkill(String playerName, String skillType) {
@ -814,14 +775,12 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The name of the player to check
* @param uuid 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
*
* @return the position on the leaderboard
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getPlayerRankSkill(UUID uuid, String skillType) {
return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(uuid).getName()).get(getNonChildSkillType(skillType));
@ -833,10 +792,8 @@ public final class ExperienceAPI {
* This function is designed for API usage.
*
* @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
*/
@Deprecated
public static int getPlayerRankOverall(String playerName) {
@ -849,10 +806,8 @@ public final class ExperienceAPI {
* This function is designed for API usage.
*
* @param uuid 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(UUID uuid) {
return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(uuid).getName()).get(null);
@ -863,10 +818,9 @@ 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
*/
public static void setLevel(Player player, String skillType, int skillLevel) {
@ -879,10 +833,9 @@ 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
*/
@Deprecated
@ -895,11 +848,10 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The player to set the level of
* @param skillType The skill to set the level for
* @param uuid The player to set the level of
* @param skillType The skill to set the level for
* @param skillLevel The value to set the level to
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static void setLevelOffline(UUID uuid, String skillType, int skillLevel) {
@ -911,11 +863,10 @@ 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
*
* @throws InvalidSkillException if the given skill is not valid
* @param newValue The value to set the XP to
* @throws InvalidSkillException if the given skill is not valid
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static void setXP(Player player, String skillType, int newValue) {
@ -928,11 +879,10 @@ 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
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @param skillType The skill to set the XP for
* @param newValue The value to set the XP to
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
@Deprecated
@ -945,12 +895,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The player to set the XP of
* @param uuid The player to set the XP of
* @param skillType The skill to set the XP for
* @param newValue The value to set the XP to
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @param newValue The value to set the XP to
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static void setXPOffline(UUID uuid, String skillType, int newValue) {
@ -962,11 +911,10 @@ 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
*
* @throws InvalidSkillException if the given skill is not valid
* @param xp The amount of XP to remove
* @throws InvalidSkillException if the given skill is not valid
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static void removeXP(Player player, String skillType, int xp) {
@ -979,11 +927,10 @@ 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
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @param skillType The skill to change the XP for
* @param xp The amount of XP to remove
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
@Deprecated
@ -996,12 +943,11 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param uuid The player to change the XP of
* @param uuid The player to change the XP of
* @param skillType The skill to change the XP for
* @param xp The amount of XP to remove
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @param xp The amount of XP to remove
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static void removeXPOffline(UUID uuid, String skillType, int xp) {
@ -1014,7 +960,6 @@ public final class ExperienceAPI {
* This function is designed for API usage.
*
* @param level The level to get the amount of XP for
*
* @throws InvalidFormulaTypeException if the given formulaType is not valid
*/
public static int getXpNeededToLevel(int level) {
@ -1026,9 +971,8 @@ public final class ExperienceAPI {
* </br>
* This function is designed for API usage.
*
* @param level The level to get the amount of XP for
* @param level The level to get the amount of XP for
* @param formulaType The formula type to get the amount of XP for
*
* @throws InvalidFormulaTypeException if the given formulaType is not valid
*/
public static int getXpNeededToLevel(int level, String formulaType) {
@ -1037,17 +981,14 @@ public final class ExperienceAPI {
/**
* Will add the appropriate type of XP from the block to the player based on the material of the blocks given
*
* @param blockStates the blocks to reward XP for
* @param mcMMOPlayer the target player
*/
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer)
{
for(BlockState bs : blockStates)
{
for(PrimarySkillType skillType : PrimarySkillType.values())
{
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer) {
for (BlockState bs : blockStates) {
for (PrimarySkillType skillType : PrimarySkillType.values()) {
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
}
}
@ -1056,16 +997,14 @@ public final class ExperienceAPI {
/**
* Will add the appropriate type of XP from the block to the player based on the material of the blocks given if it matches the given skillType
*
* @param blockStates the blocks to reward XP for
* @param mcMMOPlayer the target player
* @param skillType target primary skill
* @param skillType target primary skill
*/
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
{
for(BlockState bs : blockStates)
{
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
for (BlockState bs : blockStates) {
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
}
}
@ -1073,15 +1012,13 @@ public final class ExperienceAPI {
/**
* Will add the appropriate type of XP from the block to the player based on the material of the blocks given
* @param blockState The target blockstate
*
* @param blockState The target blockstate
* @param mcMMOPlayer The target player
*/
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer)
{
for(PrimarySkillType skillType : PrimarySkillType.values())
{
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) {
for (PrimarySkillType skillType : PrimarySkillType.values()) {
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
}
}
@ -1089,20 +1026,18 @@ public final class ExperienceAPI {
/**
* Will add the appropriate type of XP from the block to the player based on the material of the blocks given if it matches the given skillType
* @param blockState The target blockstate
*
* @param blockState The target blockstate
* @param mcMMOPlayer The target player
* @param skillType target primary skill
* @param skillType target primary skill
*/
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
{
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
}
}
// Utility methods follow.
private static void addOfflineXP(UUID playerUniqueId, PrimarySkillType skill, int XP) {
PlayerProfile profile = getOfflineProfile(playerUniqueId);
@ -1182,10 +1117,10 @@ public final class ExperienceAPI {
}
/**
* @deprecated Use UserManager::getPlayer(Player player) instead
* @param player target player
* @return McMMOPlayer for that player if the profile is loaded, otherwise null
* @throws McMMOPlayerNotFoundException
* @deprecated Use UserManager::getPlayer(Player player) instead
*/
@Deprecated
private static McMMOPlayer getPlayer(Player player) throws McMMOPlayerNotFoundException {

View File

@ -13,7 +13,8 @@ import org.bukkit.entity.Player;
import java.util.*;
public final class PartyAPI {
private PartyAPI() {}
private PartyAPI() {
}
/**
* Get the name of the party a player is in.
@ -40,7 +41,7 @@ public final class PartyAPI {
* @return true if the player is in a party, false otherwise
*/
public static boolean inParty(Player player) {
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
return false;
return UserManager.getPlayer(player).inParty();
@ -75,23 +76,22 @@ 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
* @deprecated parties can have limits, use the other method
*/
@Deprecated
public static void addToParty(Player player, String partyName) {
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
return;
Party party = PartyManager.getParty(partyName);
if (party == null) {
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
} else if(mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) {
if(PartyManager.isPartyFull(player, party))
{
} else if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) {
if (PartyManager.isPartyFull(player, party)) {
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
return;
}
@ -103,15 +103,16 @@ public final class PartyAPI {
/**
* The max party size of the server
* Limits are only enforced if the enforcement setting is on
*
* @return the max party size on this server
*/
public static int getMaxPartySize()
{
public static int getMaxPartySize() {
return mcMMO.getConfigManager().getConfigParty().getPartySizeLimit();
}
/**
* Checks if parties are currently size capped which is determined by the user config
*
* @return true if parties are size capped
*/
public static boolean isPartySizeCapped() {
@ -123,14 +124,14 @@ public final class PartyAPI {
* </br>
* This function is designed for API usage.
*
* @param player The player to add to the party
* @param partyName The party to add the player to
* @param player The player to add to the party
* @param partyName The party to add the player to
* @param bypassLimit if true bypasses party size limits
*/
//TODO: bypasslimit not used?
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
return;
Party party = PartyManager.getParty(partyName);
@ -151,7 +152,7 @@ public final class PartyAPI {
*/
public static void removeFromParty(Player player) {
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
return;
PartyManager.removeFromParty(UserManager.getPlayer(player));
@ -174,7 +175,7 @@ public final class PartyAPI {
* </br>
* This function is designed for API usage.
*
* @param partyName The name of the party to set the leader of
* @param partyName The name of the party to set the leader of
* @param playerName The playerName to set as leader
*/
@Deprecated

View File

@ -7,7 +7,8 @@ import java.util.Arrays;
import java.util.List;
public final class SkillAPI {
private SkillAPI() {}
private SkillAPI() {
}
/**
* Returns a list of strings with mcMMO's skills

View File

@ -41,26 +41,22 @@ public abstract class ChatManager {
* Party Chat Spying
* Party messages will be copied to people with the mcmmo.admin.chatspy permission node
*/
if(event instanceof McMMOPartyChatEvent)
{
if (event instanceof McMMOPartyChatEvent) {
//We need to grab the party chat name
McMMOPartyChatEvent partyChatEvent = (McMMOPartyChatEvent) event;
//Find the people with permissions
for(McMMOPlayer mcMMOPlayer : UserManager.getPlayers())
{
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
Player player = mcMMOPlayer.getPlayer();
//Check for toggled players
if(mcMMOPlayer.isPartyChatSpying())
{
if (mcMMOPlayer.isPartyChatSpying()) {
Party adminParty = mcMMOPlayer.getParty();
//Only message admins not part of this party
if(adminParty != null)
{
if (adminParty != null) {
//TODO: Incorporate JSON
if(!adminParty.getName().equalsIgnoreCase(partyChatEvent.getParty()))
if (!adminParty.getName().equalsIgnoreCase(partyChatEvent.getParty()))
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
} else {
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));

View File

@ -70,17 +70,14 @@ public class McImportCommand implements CommandExecutor {
materialNames.get(type).add(materialName);
}
}
catch (FileNotFoundException e) {
} catch (FileNotFoundException e) {
mcMMO.p.getLogger().warning("Could not find " + importFile.getAbsolutePath() + " ! (No such file or directory)");
mcMMO.p.getLogger().warning("Copy and paste latest.log to " + importFile.getParentFile().getAbsolutePath() + " and rename it to import.log");
return;
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
return;
}
finally {
} finally {
tryClose(in);
}
@ -114,8 +111,7 @@ public class McImportCommand implements CommandExecutor {
}
try {
c.close();
}
catch (IOException e) {
} catch (IOException e) {
e.printStackTrace();
}
}
@ -200,14 +196,11 @@ public class McImportCommand implements CommandExecutor {
String skillName = "UNIDENTIFIED";
if (materialName.contains("ORE")) {
skillName = "Mining";
}
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
} else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
skillName = "Woodcutting";
}
else if (materialName.contains("GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
} else if (materialName.contains("GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
skillName = "Herbalism";
}
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
} else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
skillName = "Excavation";
}
@ -222,8 +215,7 @@ public class McImportCommand implements CommandExecutor {
if (skillName.equals("Mining")) {
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
}
else if (skillName.equals("Woodcutting")) {
} else if (skillName.equals("Woodcutting")) {
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
}
}
@ -239,20 +231,15 @@ public class McImportCommand implements CommandExecutor {
String toolType = "UNIDENTIFIED";
if (materialName.contains("PICKAXE")) {
toolType = "Pickaxes";
}
else if (materialName.contains("AXE")) {
} else if (materialName.contains("AXE")) {
toolType = "Axes";
}
else if (materialName.contains("BOW")) {
} else if (materialName.contains("BOW")) {
toolType = "Bows";
}
else if (materialName.contains("HOE")) {
} else if (materialName.contains("HOE")) {
toolType = "Hoes";
}
else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
} else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
toolType = "Shovels";
}
else if (materialName.contains("SWORD")) {
} else if (materialName.contains("SWORD")) {
toolType = "Swords";
}
@ -279,14 +266,11 @@ public class McImportCommand implements CommandExecutor {
String toolType = "UNIDENTIFIED";
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
toolType = "Boots";
}
else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
} else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
toolType = "Chestplates";
}
else if (materialName.contains("HELM") || materialName.contains("HAT")) {
} else if (materialName.contains("HELM") || materialName.contains("HAT")) {
toolType = "Helmets";
}
else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
} else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
toolType = "Leggings";
}

View File

@ -22,9 +22,6 @@ public class McconvertCommand implements TabExecutor {
private static final List<String> DATABASE_TYPES;
private static final List<String> SUBCOMMANDS = ImmutableList.of("database", "experience");
private CommandExecutor databaseConvertCommand = new ConvertDatabaseCommand();
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
static {
ArrayList<String> formulaTypes = new ArrayList<>();
ArrayList<String> databaseTypes = new ArrayList<>();
@ -52,14 +49,16 @@ public class McconvertCommand implements TabExecutor {
}
private CommandExecutor databaseConvertCommand = new ConvertDatabaseCommand();
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
return databaseConvertCommand.onCommand(sender, command, label, args);
}
else if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[1].equalsIgnoreCase("exp")) {
} else if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[1].equalsIgnoreCase("exp")) {
return experienceConvertCommand.onCommand(sender, command, label, args);
}

View File

@ -68,7 +68,7 @@ public class McmmoCommand implements CommandExecutor {
private void displayOtherCommands(CommandSender sender) {
//Don't show them this category if they have none of the permissions
if(!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
if (!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
return;
sender.sendMessage(LocaleLoader.getString("Commands.Other"));

View File

@ -19,7 +19,7 @@ public class McnotifyCommand implements TabExecutor {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
//Not Loaded yet
if(mcMMOPlayer == null)
if (mcMMOPlayer == null)
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));

View File

@ -71,7 +71,10 @@ public abstract class ToggleCommand implements TabExecutor {
}
protected abstract boolean hasOtherPermission(CommandSender sender);
protected abstract boolean hasSelfPermission(CommandSender sender);
protected abstract void applyCommandAction(McMMOPlayer mcMMOPlayer);
protected abstract void sendSuccessMessage(CommandSender sender, String playerName);
}

View File

@ -25,7 +25,7 @@ public class XprateCommand implements TabExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
if (!args[0].equalsIgnoreCase("reset") && !args[0].equalsIgnoreCase("clear")) {
if (!args[0].equalsIgnoreCase("reset") && !args[0].equalsIgnoreCase("clear")) {
return false;
}
@ -36,12 +36,11 @@ public class XprateCommand implements TabExecutor {
if (mcMMO.p.isXPEventEnabled()) {
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
{
if (AdvancedConfig.getInstance().useTitlesForXPEvent()) {
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Stop"),
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
10, 10*20, 20);
10, 10 * 20, 20);
}
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
@ -65,36 +64,31 @@ public class XprateCommand implements TabExecutor {
if (CommandUtils.shouldDisableToggle(args[1])) {
mcMMO.p.setXPEventEnabled(false);
}
else if (CommandUtils.shouldEnableToggle(args[1])) {
} else if (CommandUtils.shouldEnableToggle(args[1])) {
mcMMO.p.setXPEventEnabled(true);
}
else {
} else {
return false;
}
int newXpRate = Integer.parseInt(args[0]);
if(newXpRate < 0)
{
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
if (newXpRate < 0) {
sender.sendMessage(ChatColor.RED + LocaleLoader.getString("Commands.NegativeNumberWarn"));
return true;
}
ExperienceConfig.getInstance().setGlobalXPMultiplier(newXpRate);
if (mcMMO.p.isXPEventEnabled()) {
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
{
if (AdvancedConfig.getInstance().useTitlesForXPEvent()) {
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Start"),
LocaleLoader.getString("Commands.Event.XP", newXpRate),
10, 10*20, 20);
10, 10 * 20, 20);
}
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
}
else {
} else {
sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate));
}

View File

@ -21,8 +21,8 @@ import java.util.ArrayList;
import java.util.List;
public abstract class ChatCommand implements TabExecutor {
private ChatMode chatMode;
protected ChatManager chatManager;
private ChatMode chatMode;
public ChatCommand(ChatMode chatMode) {
this.chatMode = chatMode;
@ -47,8 +47,7 @@ public abstract class ChatCommand implements TabExecutor {
if (mcMMOPlayer.isChatEnabled(chatMode)) {
disableChatMode(mcMMOPlayer, sender);
}
else {
} else {
enableChatMode(mcMMOPlayer, sender);
}

View File

@ -22,7 +22,7 @@ public class PartyChatCommand extends ChatCommand {
if (sender instanceof Player) {
//Check if player profile is loaded
if(UserManager.getPlayer((Player) sender) == null)
if (UserManager.getPlayer((Player) sender) == null)
return;
party = UserManager.getPlayer((Player) sender).getParty();
@ -38,8 +38,7 @@ public class PartyChatCommand extends ChatCommand {
}
message = buildChatMessage(args, 0);
}
else {
} else {
if (args.length < 2) {
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
return;

View File

@ -41,8 +41,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
}
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
}
catch (Throwable e) {
} catch (Throwable e) {
e.printStackTrace();
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true;

View File

@ -26,8 +26,7 @@ public class McremoveCommand implements TabExecutor {
if (mcMMO.getDatabaseManager().removeUser(playerName)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", playerName));
}
else {
} else {
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.
}

View File

@ -25,12 +25,11 @@ public class AddxpCommand extends ExperienceCommand {
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
if (player != null) {
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
if (UserManager.getPlayer(player) == null)
return;
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
}
else {
} else {
profile.addXp(skill, value);
profile.scheduleAsyncSave();
}

View File

@ -20,6 +20,14 @@ import java.util.List;
import java.util.UUID;
public abstract class ExperienceCommand implements TabExecutor {
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
} else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
}
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PrimarySkillType skill;
@ -45,15 +53,13 @@ public abstract class ExperienceCommand implements TabExecutor {
skill = null;
}
if (skill != null && skill.isChildSkill())
{
if (skill != null && skill.isChildSkill()) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true;
}
//Profile not loaded
if(UserManager.getPlayer(sender.getName()) == null)
{
if (UserManager.getPlayer(sender.getName()) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -78,8 +84,7 @@ public abstract class ExperienceCommand implements TabExecutor {
skill = null;
}
if (skill != null && skill.isChildSkill())
{
if (skill != null && skill.isChildSkill()) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true;
}
@ -103,8 +108,7 @@ public abstract class ExperienceCommand implements TabExecutor {
}
editValues(null, profile, skill, value);
}
else {
} else {
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value);
}
@ -130,24 +134,19 @@ public abstract class ExperienceCommand implements TabExecutor {
}
protected abstract boolean permissionsCheckSelf(CommandSender sender);
protected abstract boolean permissionsCheckOthers(CommandSender sender);
protected abstract void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value);
protected abstract void handlePlayerMessageAll(Player player, int value);
protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill);
private boolean validateArguments(CommandSender sender, String skillName, String value) {
return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName)));
}
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
}
}
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
@ -157,8 +156,7 @@ public abstract class ExperienceCommand implements TabExecutor {
if (player != null) {
handlePlayerMessageAll(player, value);
}
}
else {
} else {
handleCommand(player, profile, skill, value);
if (player != null) {

View File

@ -27,6 +27,14 @@ import java.util.UUID;
* value/quantity argument is removed.
*/
public class SkillresetCommand implements TabExecutor {
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
} else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
}
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PrimarySkillType skill;
@ -47,8 +55,7 @@ public class SkillresetCommand implements TabExecutor {
if (args[0].equalsIgnoreCase("all")) {
skill = null;
}
else {
} else {
skill = PrimarySkillType.getSkill(args[1]);
}
@ -67,8 +74,7 @@ public class SkillresetCommand implements TabExecutor {
if (args[1].equalsIgnoreCase("all")) {
skill = null;
}
else {
} else {
skill = PrimarySkillType.getSkill(args[1]);
}
@ -89,8 +95,7 @@ public class SkillresetCommand implements TabExecutor {
}
editValues(null, profile, skill);
}
else {
} else {
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
}
@ -149,15 +154,6 @@ public class SkillresetCommand implements TabExecutor {
return skillName.equalsIgnoreCase("all") || !CommandUtils.isInvalidSkill(sender, skillName);
}
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
}
}
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill) {
if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
@ -167,8 +163,7 @@ public class SkillresetCommand implements TabExecutor {
if (player != null) {
handlePlayerMessageAll(player);
}
}
else {
} else {
handleCommand(player, profile, skill);
if (player != null) {

View File

@ -17,8 +17,7 @@ public class PartyAcceptCommand implements CommandExecutor {
Player player = (Player) sender;
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -18,8 +18,7 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
switch (args.length) {
case 2:
//Check if player profile is loaded
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -11,8 +11,7 @@ import org.bukkit.entity.Player;
public class PartyChangePasswordCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -39,29 +39,29 @@ public class PartyCommand implements TabExecutor {
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
}
private CommandExecutor partyJoinCommand = new PartyJoinCommand();
private CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
private CommandExecutor partyCreateCommand = new PartyCreateCommand();
private CommandExecutor partyQuitCommand = new PartyQuitCommand();
private CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
private CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
private CommandExecutor partyInviteCommand = new PartyInviteCommand();
private CommandExecutor partyKickCommand = new PartyKickCommand();
private CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
private CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
private CommandExecutor partyLockCommand = new PartyLockCommand();
private CommandExecutor partyJoinCommand = new PartyJoinCommand();
private CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
private CommandExecutor partyCreateCommand = new PartyCreateCommand();
private CommandExecutor partyQuitCommand = new PartyQuitCommand();
private CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
private CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
private CommandExecutor partyInviteCommand = new PartyInviteCommand();
private CommandExecutor partyKickCommand = new PartyKickCommand();
private CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
private CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
private CommandExecutor partyLockCommand = new PartyLockCommand();
private CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand();
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
private CommandExecutor partyTeleportCommand = new PtpCommand();
private CommandExecutor partyChatCommand = new PartyChatCommand();
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
private CommandExecutor partyTeleportCommand = new PtpCommand();
private CommandExecutor partyChatCommand = new PartyChatCommand();
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
//If the party system is disabled, don't fire this command
if(!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled())
if (!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled())
return true;
if (CommandUtils.noConsoleUsage(sender)) {
@ -79,8 +79,7 @@ public class PartyCommand implements TabExecutor {
return true;
}
if(UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -210,8 +209,7 @@ public class PartyCommand implements TabExecutor {
Player player = (Player) sender;
//Not Loaded
if(UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}

View File

@ -18,8 +18,7 @@ public class PartyCreateCommand implements CommandExecutor {
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -15,8 +15,7 @@ public class PartyDisbandCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -22,8 +22,7 @@ public class PartyInfoCommand implements CommandExecutor {
switch (args.length) {
case 0:
case 1:
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -69,8 +68,7 @@ public class PartyInfoCommand implements CommandExecutor {
if (isUnlockedFeature(party, partyFeature)) {
unlockedPartyFeatures.add(partyFeature.getLocaleString());
}
else {
} else {
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
}
}
@ -127,7 +125,7 @@ public class PartyInfoCommand implements CommandExecutor {
int membersOnline = party.getVisibleMembers(player).size();
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", nearMembers.size()+1, membersOnline));
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", nearMembers.size() + 1, membersOnline));
player.sendMessage(party.createMembersList(player));
}
}

View File

@ -26,8 +26,7 @@ public class PartyInviteCommand implements CommandExecutor {
Player target = mcMMOTarget.getPlayer();
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -53,12 +52,11 @@ public class PartyInviteCommand implements CommandExecutor {
Party playerParty = mcMMOPlayer.getParty();
if(mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
if(PartyManager.isPartyFull(target, playerParty))
{
if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
if (PartyManager.isPartyFull(target, playerParty)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite",
target.getName(), playerParty.toString(),
mcMMO.getConfigManager().getConfigParty().getPartySizeLimit()));
mcMMO.getConfigManager().getConfigParty().getPartySizeLimit()));
return true;
}

View File

@ -17,8 +17,7 @@ import org.bukkit.entity.Player;
public class PartyItemShareCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -47,19 +46,16 @@ public class PartyItemShareCommand implements CommandExecutor {
if (CommandUtils.shouldEnableToggle(args[2])) {
toggle = true;
}
else if (CommandUtils.shouldDisableToggle(args[2])) {
} else if (CommandUtils.shouldDisableToggle(args[2])) {
toggle = false;
}
else {
} else {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
return true;
}
try {
handleToggleItemShareCategory(party, ItemShareType.valueOf(args[1].toUpperCase()), toggle);
}
catch (IllegalArgumentException ex) {
} catch (IllegalArgumentException ex) {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
}

View File

@ -34,8 +34,7 @@ public class PartyJoinCommand implements CommandExecutor {
Player player = (Player) sender;
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -62,9 +61,8 @@ public class PartyJoinCommand implements CommandExecutor {
return true;
}
if(mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
if(PartyManager.isPartyFull(player, targetParty))
{
if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
if (PartyManager.isPartyFull(player, targetParty)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
return true;
}

View File

@ -18,8 +18,7 @@ public class PartyKickCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -17,8 +17,7 @@ public class PartyLockCommand implements CommandExecutor {
case 1:
if (args[0].equalsIgnoreCase("lock")) {
togglePartyLock(sender, true);
}
else if (args[0].equalsIgnoreCase("unlock")) {
} else if (args[0].equalsIgnoreCase("unlock")) {
togglePartyLock(sender, false);
}
@ -32,11 +31,9 @@ public class PartyLockCommand implements CommandExecutor {
if (CommandUtils.shouldEnableToggle(args[1])) {
togglePartyLock(sender, true);
}
else if (CommandUtils.shouldDisableToggle(args[1])) {
} else if (CommandUtils.shouldDisableToggle(args[1])) {
togglePartyLock(sender, false);
}
else {
} else {
sendUsageStrings(sender);
}
@ -54,8 +51,7 @@ public class PartyLockCommand implements CommandExecutor {
}
private void togglePartyLock(CommandSender sender, boolean lock) {
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}

View File

@ -18,8 +18,7 @@ public class PartyQuitCommand implements CommandExecutor {
case 1:
Player player = (Player) sender;
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -16,8 +16,7 @@ public class PartyRenameCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -30,20 +30,15 @@ public enum PartySubcommandType {
if (commandName.equalsIgnoreCase("?")) {
return HELP;
}
else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
} else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
return QUIT;
}
else if (commandName.equalsIgnoreCase("leader")) {
} else if (commandName.equalsIgnoreCase("leader")) {
return OWNER;
}
else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
} else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
return XPSHARE;
}
else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
} else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
return ITEMSHARE;
}
else if (commandName.equalsIgnoreCase("ally")) {
} else if (commandName.equalsIgnoreCase("ally")) {
return ALLIANCE;
}

View File

@ -16,8 +16,7 @@ import org.bukkit.entity.Player;
public class PartyXpShareCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -33,11 +32,9 @@ public class PartyXpShareCommand implements CommandExecutor {
case 2:
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
handleChangingShareMode(party, ShareMode.NONE);
}
else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) {
} else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) {
handleChangingShareMode(party, ShareMode.EQUAL);
}
else {
} else {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
}

View File

@ -14,8 +14,7 @@ public class PartyAllianceAcceptCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -20,12 +20,10 @@ import java.util.ArrayList;
import java.util.List;
public class PartyAllianceCommand implements TabExecutor {
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
private Player player;
private Party playerParty;
private Party targetParty;
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
private CommandExecutor partyAllianceInviteCommand = new PartyAllianceInviteCommand();
private CommandExecutor partyAllianceAcceptCommand = new PartyAllianceAcceptCommand();
private CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
@ -36,8 +34,7 @@ public class PartyAllianceCommand implements TabExecutor {
return true;
}
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -15,8 +15,7 @@ public class PartyAllianceDisbandCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -25,8 +25,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
Player target = mcMMOTarget.getPlayer();
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}

View File

@ -20,8 +20,7 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
if (ptpRecord.isConfirmRequired()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
}
else {
} else {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
}

View File

@ -20,8 +20,7 @@ public class PtpAcceptCommand implements CommandExecutor {
return true;
}
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -55,8 +54,7 @@ public class PtpAcceptCommand implements CommandExecutor {
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return true;
}
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
} else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
return true;
}

View File

@ -35,6 +35,64 @@ public class PtpCommand implements TabExecutor {
private CommandExecutor ptpAcceptAnyCommand = new PtpAcceptAnyCommand();
private CommandExecutor ptpAcceptCommand = new PtpAcceptCommand();
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) {
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
Player target = mcMMOTarget.getPlayer();
if (player.equals(target)) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Self"));
return false;
}
if (!PartyManager.inSameParty(player, target)) {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return false;
}
if (!mcMMOTarget.getPartyTeleportRecord().isEnabled()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Disabled", targetName));
return false;
}
if (!target.isValid()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Dead"));
return false;
}
return true;
}
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
if (UserManager.getPlayer(targetPlayer) == null) {
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
if (UserManager.getPlayer(teleportingPlayer) == null) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);
long warmup = mcMMO.getConfigManager().getConfigParty().getPTP().getPtpWarmup();
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
if (warmup > 0) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
} else {
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
}
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
@ -44,22 +102,20 @@ public class PtpCommand implements TabExecutor {
Player player = (Player) sender;
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(player))
if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player))
return true;
}
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(player.getWorld()))
if (WorldBlacklist.isWorldBlacklisted(player.getWorld()))
return true;
if (!UserManager.hasPlayerDataKey(player)) {
return true;
}
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -136,8 +192,7 @@ public class PtpCommand implements TabExecutor {
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<>(TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) {
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}
@ -182,65 +237,4 @@ public class PtpCommand implements TabExecutor {
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName()));
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", mcMMO.getConfigManager().getConfigParty().getPTP().getPtpRequestTimeout()));
}
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) {
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
Player target = mcMMOTarget.getPlayer();
if (player.equals(target)) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Self"));
return false;
}
if (!PartyManager.inSameParty(player, target)) {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return false;
}
if (!mcMMOTarget.getPartyTeleportRecord().isEnabled()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Disabled", targetName));
return false;
}
if (!target.isValid()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Dead"));
return false;
}
return true;
}
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
if(UserManager.getPlayer(targetPlayer) == null)
{
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
if(UserManager.getPlayer(teleportingPlayer) == null)
{
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);
long warmup = mcMMO.getConfigManager().getConfigParty().getPTP().getPtpWarmup();
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
if (warmup > 0) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
}
else {
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
}
}
}

View File

@ -20,8 +20,7 @@ public class PtpToggleCommand implements CommandExecutor {
if (ptpRecord.isEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
}
else {
} else {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
}

View File

@ -65,8 +65,7 @@ public class InspectCommand implements TabExecutor {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
}
else {
} else {
Player target = mcMMOPlayer.getPlayer();
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
@ -74,8 +73,7 @@ public class InspectCommand implements TabExecutor {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
}
else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
} else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
return true;
}

View File

@ -38,8 +38,7 @@ public class MccooldownCommand implements TabExecutor {
}
}
if(UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -58,8 +57,7 @@ public class MccooldownCommand implements TabExecutor {
if (seconds <= 0) {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getName()));
}
else {
} else {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getName(), seconds));
}
}

View File

@ -62,8 +62,7 @@ public class McrankCommand implements TabExecutor {
if (CommandUtils.tooFar(sender, player, Permissions.mcrankFar(sender))) {
return true;
}
}
else if (CommandUtils.inspectOffline(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false), Permissions.mcrankOffline(sender))) {
} else if (CommandUtils.inspectOffline(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false), Permissions.mcrankOffline(sender))) {
return true;
}
@ -91,8 +90,7 @@ public class McrankCommand implements TabExecutor {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
if(mcMMOPlayer == null)
{
if (mcMMOPlayer == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}

View File

@ -26,8 +26,7 @@ public class McstatsCommand implements TabExecutor {
switch (args.length) {
case 0:
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -53,8 +52,7 @@ public class McstatsCommand implements TabExecutor {
if (mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevel().isLevelCapEnabled()) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
}
else {
} else {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
}

View File

@ -54,26 +54,25 @@ public class AcrobaticsCommand extends SkillCommand {
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
if(abstractSubSkill != null)
{
if (abstractSubSkill != null) {
double rollChance, graceChance;
//Chance to roll at half
RandomChanceSkill roll_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
RandomChanceSkill roll_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
//Chance to graceful roll
RandomChanceSkill grace_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
grace_rcs.setSkillLevel(grace_rcs.getSkillLevel() * 2); //Double Odds
//Chance Stat Calculations
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
String[] rollStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_ROLL);
//Format
double rollChanceLucky = rollChance * 1.333D;
double rollChanceLucky = rollChance * 1.333D;
double graceChanceLucky = graceChance * 1.333D;
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])

View File

@ -18,8 +18,8 @@ public class AlchemyCommand extends SkillCommand {
private String brewSpeed;
private String brewSpeedLucky;
private int tier;
private int ingredientCount;
private int tier;
private int ingredientCount;
private String ingredientList;
private boolean canCatalysis;
@ -31,10 +31,9 @@ public class AlchemyCommand extends SkillCommand {
protected String[] calculateAbilityDisplayValues(Player player) {
//TODO: Needed?
if(UserManager.getPlayer(player) == null)
{
if (UserManager.getPlayer(player) == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return new String[] {"DATA NOT LOADED", "DATA NOT LOADED"};
return new String[]{"DATA NOT LOADED", "DATA NOT LOADED"};
}
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();

View File

@ -74,7 +74,7 @@ public class ArcheryCommand extends SkillCommand {
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
}
if(canUseSubskill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
if (canUseSubskill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK))));
}

View File

@ -95,7 +95,7 @@ public class AxesCommand extends SkillCommand {
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
}
if(canUseSubskill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
if (canUseSubskill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.AXES_AXES_LIMIT_BREAK))));
}

View File

@ -75,7 +75,7 @@ public class FishingCommand extends SkillCommand {
}
}
if(totalEnchantChance >= 1)
if (totalEnchantChance >= 1)
magicChance = percent.format(totalEnchantChance / 100.0);
else
magicChance = percent.format(0);
@ -116,8 +116,7 @@ public class FishingCommand extends SkillCommand {
biteChance = percent.format((rawBiteChance * 100.0D) * luckyModifier);
}
if(canInnerPeace)
{
if (canInnerPeace) {
innerPeaceMult = String.valueOf(fishingManager.getInnerPeaceMultiplier());
}
}
@ -156,7 +155,7 @@ public class FishingCommand extends SkillCommand {
if (canShake) {
messages.add(getStatMessage(SubSkillType.FISHING_SHAKE, shakeChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shakeChanceLucky) : ""));
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shakeChanceLucky) : ""));
}
if (canTreasureHunt) {
@ -170,8 +169,7 @@ public class FishingCommand extends SkillCommand {
String.valueOf(recordTreasure)));
}
if(canInnerPeace)
{
if (canInnerPeace) {
messages.add(getStatMessage(SubSkillType.FISHING_INNER_PEACE, innerPeaceMult));
}

View File

@ -123,7 +123,7 @@ public class HerbalismCommand extends SkillCommand {
}
if (canGreenThumbPlants) {
messages.add(getStatMessage(true, true,SubSkillType.HERBALISM_GREEN_THUMB, String.valueOf(greenThumbStage)));
messages.add(getStatMessage(true, true, SubSkillType.HERBALISM_GREEN_THUMB, String.valueOf(greenThumbStage)));
}
if (hasHylianLuck) {

View File

@ -89,7 +89,7 @@ public class MiningCommand extends SkillCommand {
//messages.add(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING), LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
}
if (canDemoExpert) {
if (canDemoExpert) {
messages.add(getStatMessage(SubSkillType.MINING_DEMOLITIONS_EXPERTISE, blastDamageDecrease));
//messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
}

View File

@ -27,26 +27,22 @@ public class MmoInfoCommand implements TabExecutor {
/*
* Only allow players to use this command
*/
if(commandSender instanceof Player)
{
if(args.length < 1)
if (commandSender instanceof Player) {
if (args.length < 1)
return false;
Player player = (Player) commandSender;
if(Permissions.mmoinfo(player))
{
if(args == null || args[0] == null)
if (Permissions.mmoinfo(player)) {
if (args == null || args[0] == null)
return false;
if(args[0].equalsIgnoreCase( "???"))
{
if (args[0].equalsIgnoreCase("???")) {
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Mystery"));
return true;
} else if(InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0]))
{
} else if (InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0])) {
displayInfo(player, args[0]);
return true;
}
@ -70,12 +66,10 @@ public class MmoInfoCommand implements TabExecutor {
}
}
private void displayInfo(Player player, String subSkillName)
{
private void displayInfo(Player player, String subSkillName) {
//Check to see if the skill exists in the new system
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName(subSkillName);
if(abstractSubSkill != null)
{
if (abstractSubSkill != null) {
/* New System Skills are programmable */
abstractSubSkill.printInfo(player);
//TextComponentFactory.sendPlayerUrlHeader(player);
@ -89,9 +83,8 @@ public class MmoInfoCommand implements TabExecutor {
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
}
for(SubSkillType subSkillType : SubSkillType.values())
{
if(subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(subSkillName))
for (SubSkillType subSkillType : SubSkillType.values()) {
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(subSkillName))
subSkillName = subSkillType.getWikiName(subSkillType.toString());
}

View File

@ -33,11 +33,9 @@ import java.util.Set;
public abstract class SkillCommand implements TabExecutor {
protected PrimarySkillType skill;
private String skillName;
protected DecimalFormat percent = new DecimalFormat("##0.00%");
protected DecimalFormat decimal = new DecimalFormat("##0.00");
private String skillName;
private CommandExecutor skillGuideCommand;
public SkillCommand(PrimarySkillType skill) {
@ -46,6 +44,15 @@ public abstract class SkillCommand implements TabExecutor {
skillGuideCommand = new SkillGuideCommand(skill);
}
public static String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) {
String[] newArray = new String[existingArray.length + 1];
newArray[0] = itemToAdd;
System.arraycopy(existingArray, 0, newArray, 1, existingArray.length);
return newArray;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
@ -56,8 +63,7 @@ public abstract class SkillCommand implements TabExecutor {
return true;
}
if(UserManager.getPlayer((Player) sender) == null)
{
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
@ -72,9 +78,8 @@ public abstract class SkillCommand implements TabExecutor {
float skillValue = mcMMOPlayer.getSkillLevel(skill);
//Send the players a few blank lines to make finding the top of the skill command easier
if(AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
for(int i = 0; i < 2; i++)
{
if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
for (int i = 0; i < 2; i++) {
player.sendMessage("");
}
@ -105,8 +110,7 @@ public abstract class SkillCommand implements TabExecutor {
//Link Header
if(mcMMO.getConfigManager().getConfigAds().isShowWebsiteLinks())
{
if (mcMMO.getConfigManager().getConfigAds().isShowWebsiteLinks()) {
player.sendMessage(LocaleLoader.getString("Overhaul.mcMMO.Header"));
TextComponentFactory.sendPlayerUrlHeader(player);
}
@ -114,7 +118,7 @@ public abstract class SkillCommand implements TabExecutor {
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled()
&& mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes()
.getConfigSectionSkillBoard().isUseThisBoard()) {
.getConfigSectionSkillBoard().isUseThisBoard()) {
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
}
@ -146,8 +150,7 @@ public abstract class SkillCommand implements TabExecutor {
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
if(!skill.isChildSkill())
{
if (!skill.isChildSkill()) {
/*
* NON-CHILD SKILLS
*/
@ -173,10 +176,8 @@ public abstract class SkillCommand implements TabExecutor {
StringBuilder parentMessage = new StringBuilder();
for(int i = 0; i < parentList.size(); i++)
{
if(i+1 < parentList.size())
{
for (int i = 0; i < parentList.size(); i++) {
if (i + 1 < parentList.size()) {
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
parentMessage.append(ChatColor.GRAY + ", ");
} else {
@ -237,11 +238,9 @@ public abstract class SkillCommand implements TabExecutor {
int length;
if(abilityLengthCap <= 0)
{
if (abilityLengthCap <= 0) {
length = 2 + (int) (skillValue / abilityLengthVar);
}
else {
} else {
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
}
@ -251,38 +250,25 @@ 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 String getStatMessage(SubSkillType subSkillType, String... vars)
{
protected String getStatMessage(SubSkillType subSkillType, String... vars) {
return getStatMessage(false, false, subSkillType, vars);
}
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars)
{
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars) {
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
if(isCustom)
if (isCustom)
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
else
{
else {
String[] mergedList = addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
return LocaleLoader.getString(templateKey, mergedList);
}
}
public static String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) {
String[] newArray = new String[existingArray.length + 1];
newArray[0] = itemToAdd;
System.arraycopy(existingArray, 0, newArray, 1, existingArray.length);
return newArray;
}
protected abstract void dataCalculations(Player player, float skillValue);
protected abstract void permissionsCheck(Player player);
@ -295,12 +281,12 @@ public abstract class SkillCommand implements TabExecutor {
/**
* Checks if a player can use a skill
* @param player target player
*
* @param player target player
* @param subSkillType target subskill
* @return true if the player has permission and has the skill unlocked
*/
protected boolean canUseSubskill(Player player, SubSkillType subSkillType)
{
protected boolean canUseSubskill(Player player, SubSkillType subSkillType) {
return Permissions.isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
}
}

View File

@ -75,8 +75,7 @@ public class SkillGuideCommand implements CommandExecutor {
while (allStrings.size() < 9) {
if (pageIndexStart + allStrings.size() > guide.size()) {
allStrings.add("");
}
else {
} else {
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
}
}

View File

@ -70,8 +70,8 @@ public class SwordsCommand extends SkillCommand {
List<String> messages = new ArrayList<>();
int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer();
double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamageMobs() * 1.5D : AdvancedConfig.getInstance().getRuptureDamageMobs();
double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer();
double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamageMobs() * 1.5D : AdvancedConfig.getInstance().getRuptureDamageMobs();
if (canCounter) {
messages.add(getStatMessage(SubSkillType.SWORDS_COUNTER_ATTACK, counterChance)
@ -94,13 +94,12 @@ public class SwordsCommand extends SkillCommand {
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
}
if(canUseSubskill(player, SubSkillType.SWORDS_STAB))
{
if (canUseSubskill(player, SubSkillType.SWORDS_STAB)) {
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
String.valueOf(UserManager.getPlayer(player).getSwordsManager().getStabDamage())));
}
if(canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
if (canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK))));
}

View File

@ -113,7 +113,7 @@ public class UnarmedCommand extends SkillCommand {
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
}
if(canUseSubskill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
if (canUseSubskill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))));
}

View File

@ -130,16 +130,12 @@ public class AdvancedConfig extends ConfigValidated {
super("advanced", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
}
@Override
public void unload() {
//do nothing
}
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
@ -147,6 +143,11 @@ public class AdvancedConfig extends ConfigValidated {
return mcMMO.getConfigManager().getAdvancedConfig();
}
@Override
public void unload() {
//do nothing
}
/**
* The version of this config
*
@ -239,8 +240,7 @@ public class AdvancedConfig extends ConfigValidated {
}
/* AXES */
if(getAxeMasteryRankDamageMultiplier() < 0)
{
if (getAxeMasteryRankDamageMultiplier() < 0) {
reason.add(SKILLS + "." + AXES + "." + AXE_MASTERY + "." + RANK_DAMAGE_MULTIPLIER + " should be at least 0!");
}
@ -499,10 +499,11 @@ public class AdvancedConfig extends ConfigValidated {
/**
* This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
* It returns a different value depending on whether or not the server is in retro mode
*
* @return the level at which abilities stop increasing in length
*/
public int getAbilityLengthCap() {
if(!mcMMO.isRetroModeEnabled())
if (!mcMMO.isRetroModeEnabled())
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, CAP_LEVEL);
else
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, CAP_LEVEL);
@ -511,28 +512,32 @@ public class AdvancedConfig extends ConfigValidated {
/**
* This returns the frequency at which abilities will increase in length
* It returns a different value depending on whether or not the server is in retro mode
*
* @return the number of levels required per ability length increase
*/
public int getAbilityLength() {
if(!mcMMO.isRetroModeEnabled())
if (!mcMMO.isRetroModeEnabled())
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, INCREASE_LEVEL);
else
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, INCREASE_LEVEL);
}
public int getEnchantBuff() { return getIntValue(SKILLS, GENERAL, ABILITY, ENCHANT_BUFF); }
public int getEnchantBuff() {
return getIntValue(SKILLS, GENERAL, ABILITY, ENCHANT_BUFF);
}
/**
* Grabs the max bonus level for a skill used in RNG calculations
* All max level values in the config are multiplied by 10 if the server is in retro mode as the values in the config are based around the new 1-100 skill system scaling
* A value of 10 in the file will be returned as 100 for retro mode servers to accommodate the change in scaling
*
* @param subSkillType target subskill
* @return the level at which this skills max benefits will be reached on the curve
*/
public int getMaxBonusLevel(SubSkillType subSkillType) {
String[] category = subSkillType.getAdvConfigAddress();
if(!mcMMO.isRetroModeEnabled())
if (!mcMMO.isRetroModeEnabled())
return getIntValue(category[0], category[1], category[2], MAX_BONUS_LEVEL, STANDARD);
else
return getIntValue(category[0], category[1], category[2], MAX_BONUS_LEVEL, RETRO_MODE);
@ -550,31 +555,26 @@ public class AdvancedConfig extends ConfigValidated {
return maximumProbability;
}
public double getMaximumProbability(AbstractSubSkill abstractSubSkill)
{
public double getMaximumProbability(AbstractSubSkill abstractSubSkill) {
return getMaximumProbability(abstractSubSkill.getSubSkillType());
}
/* Notification Settings */
public boolean doesSkillCommandSendBlankLines()
{
return getBooleanValue(FEEDBACK, SKILL_COMMAND, BLANK_LINES_ABOVE_HEADER);
public boolean doesSkillCommandSendBlankLines() {
return getBooleanValue(FEEDBACK, SKILL_COMMAND, BLANK_LINES_ABOVE_HEADER);
}
public boolean doesNotificationUseActionBar(NotificationType notificationType)
{
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), ENABLED);
public boolean doesNotificationUseActionBar(NotificationType notificationType) {
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), ENABLED);
}
public boolean doesNotificationSendCopyToChat(NotificationType notificationType)
{
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), SEND_COPY_OF_MESSAGE_TO_CHAT);
public boolean doesNotificationSendCopyToChat(NotificationType notificationType) {
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), SEND_COPY_OF_MESSAGE_TO_CHAT);
}
public boolean useTitlesForXPEvent()
{
return getBooleanValue(FEEDBACK, EVENTS, XP, SEND_TITLES);
public boolean useTitlesForXPEvent() {
return getBooleanValue(FEEDBACK, EVENTS, XP, SEND_TITLES);
}
private ChatColor getChatColorFromKey(String keyLocation) {
@ -595,57 +595,109 @@ public class AdvancedConfig extends ConfigValidated {
}
/* ACROBATICS */
public double getDodgeDamageModifier() { return getDoubleValue(SKILLS, ACROBATICS, DODGE, DAMAGE_MODIFIER); }
public double getDodgeDamageModifier() {
return getDoubleValue(SKILLS, ACROBATICS, DODGE, DAMAGE_MODIFIER);
}
public double getRollDamageThreshold() { return getDoubleValue(SKILLS, ACROBATICS, ROLL, DAMAGE_THRESHOLD); }
public double getRollDamageThreshold() {
return getDoubleValue(SKILLS, ACROBATICS, ROLL, DAMAGE_THRESHOLD);
}
public double getGracefulRollDamageThreshold() { return getDoubleValue(SKILLS, ACROBATICS, GRACEFUL_ROLL, DAMAGE_THRESHOLD); }
public double getGracefulRollDamageThreshold() {
return getDoubleValue(SKILLS, ACROBATICS, GRACEFUL_ROLL, DAMAGE_THRESHOLD);
}
/* ALCHEMY */
public int getCatalysisMaxBonusLevel() { return getIntValue(SKILLS, ALCHEMY, CATALYSIS, MAX_BONUS_LEVEL); }
public int getCatalysisMaxBonusLevel() {
return getIntValue(SKILLS, ALCHEMY, CATALYSIS, MAX_BONUS_LEVEL);
}
public double getCatalysisMinSpeed() { return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MIN_SPEED); }
public double getCatalysisMaxSpeed() { return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MAX_SPEED); }
public double getCatalysisMinSpeed() {
return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MIN_SPEED);
}
public double getCatalysisMaxSpeed() {
return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MAX_SPEED);
}
/* ARCHERY */
public double getSkillShotRankDamageMultiplier() { return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, RANK_DAMAGE_MULTIPLIER); }
public double getSkillShotDamageMax() { return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, MAX_DAMAGE); }
public double getSkillShotRankDamageMultiplier() {
return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, RANK_DAMAGE_MULTIPLIER);
}
public double getDazeBonusDamage() { return getDoubleValue(SKILLS, ARCHERY, DAZE, BONUS_DAMAGE); }
public double getSkillShotDamageMax() {
return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, MAX_DAMAGE);
}
public double getForceMultiplier() { return getDoubleValue(SKILLS, ARCHERY, FORCE_MULTIPLIER); }
public double getDazeBonusDamage() {
return getDoubleValue(SKILLS, ARCHERY, DAZE, BONUS_DAMAGE);
}
public double getForceMultiplier() {
return getDoubleValue(SKILLS, ARCHERY, FORCE_MULTIPLIER);
}
/* AXES */
public double getAxeMasteryRankDamageMultiplier() { return getDoubleValue(SKILLS, AXES, AXE_MASTERY, RANK_DAMAGE_MULTIPLIER); }
public double getAxeMasteryRankDamageMultiplier() {
return getDoubleValue(SKILLS, AXES, AXE_MASTERY, RANK_DAMAGE_MULTIPLIER);
}
public double getCriticalStrikesPVPModifier() { return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVP_MODIFIER); }
public double getCriticalStrikesPVEModifier() { return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVE_MODIFIER); }
public double getCriticalStrikesPVPModifier() {
return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVP_MODIFIER);
}
public double getGreaterImpactChance() { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, CHANCE); }
public double getGreaterImpactModifier() { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, KNOCKBACK_MODIFIER); }
public double getGreaterImpactBonusDamage() { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, BONUS_DAMAGE); }
public double getCriticalStrikesPVEModifier() {
return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVE_MODIFIER);
}
public double getGreaterImpactChance() {
return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, CHANCE);
}
public double getGreaterImpactModifier() {
return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, KNOCKBACK_MODIFIER);
}
public double getGreaterImpactBonusDamage() {
return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, BONUS_DAMAGE);
}
public int getArmorImpactIncreaseLevel() {
int increaseLevel = getIntValue(SKILLS, AXES, ARMOR_IMPACT, INCREASE_LEVEL);
if(mcMMO.isRetroModeEnabled())
if (mcMMO.isRetroModeEnabled())
return increaseLevel * 10;
return increaseLevel;
}
public double getImpactChance() { return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, CHANCE); }
public double getArmorImpactMaxDurabilityDamage() { return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, MAX_PERCENTAGE_DURABILITY_DAMAGE); }
public double getImpactChance() {
return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, CHANCE);
}
public double getSkullSplitterModifier() { return getDoubleValue(SKILLS, AXES, SKULL_SPLITTER, DAMAGE_MODIFIER); }
public double getArmorImpactMaxDurabilityDamage() {
return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, MAX_PERCENTAGE_DURABILITY_DAMAGE);
}
public double getSkullSplitterModifier() {
return getDoubleValue(SKILLS, AXES, SKULL_SPLITTER, DAMAGE_MODIFIER);
}
/* EXCAVATION */
//Nothing to configure, everything is already configurable in config.yml
/* FISHING */
public double getShakeChance(int rank) { return getDoubleValue(SKILLS, FISHING, SHAKE, CHANCE, RANK, String.valueOf(rank)); }
public double getMasterAnglerBoatModifier() {return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BOAT_MODIFIER); }
public double getMasterAnglerBiomeModifier() {return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER); }
public double getShakeChance(int rank) {
return getDoubleValue(SKILLS, FISHING, SHAKE, CHANCE, RANK, String.valueOf(rank));
}
public double getMasterAnglerBoatModifier() {
return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BOAT_MODIFIER);
}
public double getMasterAnglerBiomeModifier() {
return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER);
}
/* HERBALISM */
//public int getFarmerDietRankChange() { return getIntValue(SKILLS, ".Herbalism.FarmersDiet.RankChange"); }
@ -653,67 +705,152 @@ public class AdvancedConfig extends ConfigValidated {
//public int getGreenThumbStageChange() { return getIntValue(SKILLS, ".Herbalism.GreenThumb.StageChange"); }
/* MINING */
public boolean getDoubleDropSilkTouchEnabled() { return getBooleanValue(SKILLS, MINING, "DoubleDrops", "SilkTouch"); }
public int getBlastMiningRankLevel(int rank) { return getIntValue(SKILLS, MINING, BLAST_MINING, RANK, LEVELS, RANK, String.valueOf(rank)); }
public double getBlastDamageDecrease(int rank) { return getDoubleValue(SKILLS, MINING, BLAST_MINING, BLAST_DAMAGE_DECREASE, RANK, String.valueOf(rank)); }
public double getOreBonus(int rank) { return getDoubleValue(SKILLS, MINING, BLAST_MINING, ORE_BONUS, RANK, String.valueOf(rank)); }
public double getDebrisReduction(int rank) { return getDoubleValue(SKILLS, MINING, BLAST_MINING, DEBRIS_REDUCTION, RANK, String.valueOf(rank)); }
public int getDropMultiplier(int rank) { return getIntValue(SKILLS, MINING, BLAST_MINING, DROP_MULTIPLIER, RANK, String.valueOf(rank)); }
public double getBlastRadiusModifier(int rank) { return getDoubleValue(SKILLS, MINING, BLAST_MINING, BLAST_RADIUS, MODIFIER, RANK, String.valueOf(rank)); }
public boolean getDoubleDropSilkTouchEnabled() {
return getBooleanValue(SKILLS, MINING, "DoubleDrops", "SilkTouch");
}
public int getBlastMiningRankLevel(int rank) {
return getIntValue(SKILLS, MINING, BLAST_MINING, RANK, LEVELS, RANK, String.valueOf(rank));
}
public double getBlastDamageDecrease(int rank) {
return getDoubleValue(SKILLS, MINING, BLAST_MINING, BLAST_DAMAGE_DECREASE, RANK, String.valueOf(rank));
}
public double getOreBonus(int rank) {
return getDoubleValue(SKILLS, MINING, BLAST_MINING, ORE_BONUS, RANK, String.valueOf(rank));
}
public double getDebrisReduction(int rank) {
return getDoubleValue(SKILLS, MINING, BLAST_MINING, DEBRIS_REDUCTION, RANK, String.valueOf(rank));
}
public int getDropMultiplier(int rank) {
return getIntValue(SKILLS, MINING, BLAST_MINING, DROP_MULTIPLIER, RANK, String.valueOf(rank));
}
public double getBlastRadiusModifier(int rank) {
return getDoubleValue(SKILLS, MINING, BLAST_MINING, BLAST_RADIUS, MODIFIER, RANK, String.valueOf(rank));
}
/* REPAIR */
public double getRepairMasteryMaxBonus() { return getDoubleValue(SKILLS, REPAIR, REPAIR_MASTERY, MAX_BONUS_PERCENTAGE); }
public double getRepairMasteryMaxBonus() {
return getDoubleValue(SKILLS, REPAIR, REPAIR_MASTERY, MAX_BONUS_PERCENTAGE);
}
//public int getRepairMasteryMaxLevel() { return getIntValue(SKILLS, REPAIR, REPAIR_MASTERY, MAX_BONUS_LEVEL); }
/* Arcane Forging */
public boolean getArcaneForgingEnchantLossEnabled() { return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, MAY_LOSE_ENCHANTS); }
public double getArcaneForgingKeepEnchantsChance(int rank) { return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, KEEP_ENCHANTS, CHANCE, RANK, String.valueOf(rank)); }
public boolean getArcaneForgingEnchantLossEnabled() {
return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, MAY_LOSE_ENCHANTS);
}
public boolean getArcaneForgingDowngradeEnabled() { return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES_ENABLED); }
public double getArcaneForgingDowngradeChance(int rank) { return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES, CHANCE, RANK, String.valueOf(rank)); }
public double getArcaneForgingKeepEnchantsChance(int rank) {
return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, KEEP_ENCHANTS, CHANCE, RANK, String.valueOf(rank));
}
public boolean getArcaneForgingDowngradeEnabled() {
return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES_ENABLED);
}
public double getArcaneForgingDowngradeChance(int rank) {
return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES, CHANCE, RANK, String.valueOf(rank));
}
/* SALVAGE */
public boolean getArcaneSalvageEnchantDowngradeEnabled() { return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_DOWNGRADE_ENABLED); }
public boolean getArcaneSalvageEnchantLossEnabled() { return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_LOSS_ENABLED); }
public boolean getArcaneSalvageEnchantDowngradeEnabled() {
return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_DOWNGRADE_ENABLED);
}
public double getArcaneSalvageExtractFullEnchantsChance(int rank) { return getDoubleValue(SKILLS, SALVAGE, ARCANE_SALVAGE, EXTRACT_FULL_ENCHANT, RANK, String.valueOf(rank)); }
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return getDoubleValue(SKILLS, SALVAGE, ARCANE_SALVAGE, EXTRACT_PARTIAL_ENCHANT, RANK, String.valueOf(rank)); }
public boolean getArcaneSalvageEnchantLossEnabled() {
return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_LOSS_ENABLED);
}
public double getArcaneSalvageExtractFullEnchantsChance(int rank) {
return getDoubleValue(SKILLS, SALVAGE, ARCANE_SALVAGE, EXTRACT_FULL_ENCHANT, RANK, String.valueOf(rank));
}
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) {
return getDoubleValue(SKILLS, SALVAGE, ARCANE_SALVAGE, EXTRACT_PARTIAL_ENCHANT, RANK, String.valueOf(rank));
}
/* SMELTING */
//public int getBurnModifierMaxLevel() { return getIntValue(SKILLS, SMELTING, FUEL_EFFICIENCY, MAX_BONUS_LEVEL); }
public double getBurnTimeMultiplier() { return getDoubleValue(SKILLS, SMELTING, FUEL_EFFICIENCY, MULTIPLIER); }
public double getBurnTimeMultiplier() {
return getDoubleValue(SKILLS, SMELTING, FUEL_EFFICIENCY, MULTIPLIER);
}
public int getSmeltingRankLevel(int rank) { return getIntValue(SKILLS, SMELTING, RANK, LEVELS, RANK, String.valueOf(rank)); }
public int getSmeltingRankLevel(int rank) {
return getIntValue(SKILLS, SMELTING, RANK, LEVELS, RANK, String.valueOf(rank));
}
public int getSmeltingVanillaXPBoostMultiplier(int rank) { return getIntValue(SKILLS, SMELTING, VANILLA_XPMULTIPLIER, RANK, String.valueOf(rank)); }
public int getSmeltingVanillaXPBoostMultiplier(int rank) {
return getIntValue(SKILLS, SMELTING, VANILLA_XPMULTIPLIER, RANK, String.valueOf(rank));
}
/* SWORDS */
public double getRuptureDamagePlayer() { return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_PLAYER); }
public double getRuptureDamageMobs() { return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_MOBS); }
public double getRuptureDamagePlayer() {
return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_PLAYER);
}
public int getRuptureMaxTicks() { return getIntValue(SKILLS, SWORDS, RUPTURE, MAX_TICKS); }
public int getRuptureBaseTicks() { return getIntValue(SKILLS, SWORDS, RUPTURE, BASE_TICKS); }
public double getRuptureDamageMobs() {
return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_MOBS);
}
public double getCounterAttackModifier() { return getDoubleValue(SKILLS, SWORDS, COUNTER_ATTACK, DAMAGE_MODIFIER); }
public int getRuptureMaxTicks() {
return getIntValue(SKILLS, SWORDS, RUPTURE, MAX_TICKS);
}
public double getSerratedStrikesModifier() { return getDoubleValue(SKILLS, SWORDS, SERRATED_STRIKES, DAMAGE_MODIFIER); }
public int getRuptureBaseTicks() {
return getIntValue(SKILLS, SWORDS, RUPTURE, BASE_TICKS);
}
public double getCounterAttackModifier() {
return getDoubleValue(SKILLS, SWORDS, COUNTER_ATTACK, DAMAGE_MODIFIER);
}
public double getSerratedStrikesModifier() {
return getDoubleValue(SKILLS, SWORDS, SERRATED_STRIKES, DAMAGE_MODIFIER);
}
//public int getSerratedStrikesTicks() { return getIntValue(SKILLS, SWORDS, SERRATED_STRIKES, RUPTURE, TICKS); }
/* TAMING */
public double getGoreModifier() { return getDoubleValue(SKILLS, TAMING, GORE, MODIFIER); }
public double getFastFoodChance() { return getDoubleValue(SKILLS, TAMING, FAST_FOOD_SERVICE, CHANCE); }
public double getPummelChance() { return getDoubleValue(SKILLS, TAMING, PUMMEL, CHANCE); }
public double getThickFurModifier() { return getDoubleValue(SKILLS, TAMING, THICK_FUR, MODIFIER); }
public double getShockProofModifier() { return getDoubleValue(SKILLS, TAMING, SHOCK_PROOF, MODIFIER); }
public double getGoreModifier() {
return getDoubleValue(SKILLS, TAMING, GORE, MODIFIER);
}
public double getSharpenedClawsBonus() { return getDoubleValue(SKILLS, TAMING, SHARPENED_CLAWS, BONUS); }
public double getFastFoodChance() {
return getDoubleValue(SKILLS, TAMING, FAST_FOOD_SERVICE, CHANCE);
}
public double getMinHorseJumpStrength() { return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MIN_HORSE_JUMP_STRENGTH); }
public double getMaxHorseJumpStrength() { return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MAX_HORSE_JUMP_STRENGTH); }
public double getPummelChance() {
return getDoubleValue(SKILLS, TAMING, PUMMEL, CHANCE);
}
public double getThickFurModifier() {
return getDoubleValue(SKILLS, TAMING, THICK_FUR, MODIFIER);
}
public double getShockProofModifier() {
return getDoubleValue(SKILLS, TAMING, SHOCK_PROOF, MODIFIER);
}
public double getSharpenedClawsBonus() {
return getDoubleValue(SKILLS, TAMING, SHARPENED_CLAWS, BONUS);
}
public double getMinHorseJumpStrength() {
return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MIN_HORSE_JUMP_STRENGTH);
}
public double getMaxHorseJumpStrength() {
return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MAX_HORSE_JUMP_STRENGTH);
}
/* UNARMED */
public boolean getDisarmProtected() { return getBooleanValue(SKILLS, UNARMED, DISARM, ANTI_THEFT); }
public boolean getDisarmProtected() {
return getBooleanValue(SKILLS, UNARMED, DISARM, ANTI_THEFT);
}
/* WOODCUTTING */
}

View File

@ -13,13 +13,11 @@ public class BonusDropManager implements Unload {
private HashMap<Material, Boolean> bonusDropWhitelist;
public BonusDropManager()
{
public BonusDropManager() {
bonusDropWhitelist = new HashMap<>();
//Start by setting all Materials to false to avoid null checks
for(Material material : Material.values())
{
for (Material material : Material.values()) {
registerMaterial(material, false);
}
}
@ -31,28 +29,25 @@ public class BonusDropManager implements Unload {
/**
* Adds materials to the bonus drop whitelist
*
* @param materials target material list
*/
public void addToWhitelistByMaterial(List<Material> materials)
{
for(Material material : materials)
{
public void addToWhitelistByMaterial(List<Material> materials) {
for (Material material : materials) {
registerMaterial(material, true);
}
}
/**
* Adds materials to the bonus drop whitelist
*
* @param materials target material list
*/
public void addToWhitelistByNameID(List<String> materials)
{
for(String material : materials)
{
public void addToWhitelistByNameID(List<String> materials) {
for (String material : materials) {
Material m = Material.matchMaterial(material);
if(m == null)
{
mcMMO.p.getLogger().severe("Error registering Bonus Drop -- Invalid Minecraft Name ID: "+material);
if (m == null) {
mcMMO.p.getLogger().severe("Error registering Bonus Drop -- Invalid Minecraft Name ID: " + material);
continue;
}
@ -62,6 +57,7 @@ public class BonusDropManager implements Unload {
/**
* Adds a material to the bonus drop whitelist
*
* @param material target material
*/
private void registerMaterial(Material material, boolean isWhitelisted) {
@ -70,11 +66,11 @@ public class BonusDropManager implements Unload {
/**
* Check if a material can provide bonus drops
*
* @param material target material
* @return true if the material can provide bonus drops
*/
public boolean isBonusDropWhitelisted(Material material)
{
public boolean isBonusDropWhitelisted(Material material) {
return bonusDropWhitelist.get(material);
}
}

View File

@ -21,22 +21,20 @@ import java.util.List;
public abstract class Config implements VersionedConfig, Unload {
public static final String HOCON_FILE_EXTENSION = ".conf";
public final File DIRECTORY_DATA_FOLDER; //Directory that the file is in
public final String FILE_RELATIVE_PATH; //Relative Path to the file
protected final String DIRECTORY_DEFAULTS = "defaults";
/* SETTINGS */
//private static final String FILE_EXTENSION = ".conf"; //HOCON
private boolean mergeNewKeys; //Whether or not to merge keys found in the default config
private boolean removeOldKeys; //Whether or not to remove unused keys form the config
/* PATH VARS */
private boolean copyDefaults; //Whether or not to copy the default config when first creating the file
private boolean generateDefaults; //Whether or not we use Configurate to generate a default file, if this is false we copy the file from the JAR
private String fileName; //The file name of the config
/* PATH VARS */
public final File DIRECTORY_DATA_FOLDER; //Directory that the file is in
public final String FILE_RELATIVE_PATH; //Relative Path to the file
protected final String DIRECTORY_DEFAULTS = "defaults";
/* LOADERS */
private HoconConfigurationLoader defaultCopyLoader;
private HoconConfigurationLoader userCopyLoader;
@ -78,8 +76,7 @@ public abstract class Config implements VersionedConfig, Unload {
FILE_RELATIVE_PATH = relativePath + fileName + HOCON_FILE_EXTENSION; //Relative path to config from a parent folder
}
public void initFullConfig()
{
public void initFullConfig() {
//Attempt IO Operations
try {
//Makes sure we have valid Files corresponding to this config
@ -106,8 +103,7 @@ public abstract class Config implements VersionedConfig, Unload {
* Registers with the config managers unloader
* The unloader runs when the plugin gets disabled which cleans up registries to make reloading safe
*/
private void registerUnload()
{
private void registerUnload() {
mcMMO.getConfigManager().registerUnloadable(this);
}
@ -115,13 +111,13 @@ public abstract class Config implements VersionedConfig, Unload {
* Registers with the config managers file list
* Used for backing up configs with our zip library
*/
private void registerFileBackup()
{
private void registerFileBackup() {
mcMMO.getConfigManager().registerUserFile(getUserConfigFile());
}
/**
* Initializes the default copy File and the user config File
*
* @throws IOException
*/
private void initConfigFiles() throws IOException {
@ -135,8 +131,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Loads the root node for the default config File and user config File
*/
private void loadConfig()
{
private void loadConfig() {
try {
final CommentedConfigurationNode defaultConfig = this.defaultCopyLoader.load();
defaultRootNode = defaultConfig;
@ -152,20 +147,19 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Initializes the Configuration Loaders for this config
*/
private void initConfigLoaders()
{
private void initConfigLoaders() {
this.defaultCopyLoader = HoconConfigurationLoader.builder().setPath(resourceConfigCopy.toPath()).build();
this.userCopyLoader = HoconConfigurationLoader.builder().setPath(resourceUserCopy.toPath()).build();
}
/**
* Copies a new file from the JAR to the defaults directory and uses that new file to initialize our resourceConfigCopy
* @see Config#resourceConfigCopy
*
* @throws IOException
* @see Config#resourceConfigCopy
*/
private File initDefaultConfig() throws IOException {
if(generateDefaults)
{
if (generateDefaults) {
return generateDefaultFile();
} else
return copyDefaultFromJar(getDefaultConfigCopyRelativePath(), true);
@ -174,11 +168,11 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Generates a default config file using the Configurate library, makes use of @Setting and @ConfigSerializable annotations in the config file
* Assigns the default root node to the newly loaded default config if successful
*
* @return the File for the newly created config
*/
private File generateDefaultFile()
{
mcMMO.p.getLogger().info("Attempting to create a default config for "+fileName);
private File generateDefaultFile() {
mcMMO.p.getLogger().info("Attempting to create a default config for " + fileName);
//Not sure if this will work properly...
Path potentialFile = Paths.get(getDefaultConfigCopyRelativePath());
@ -186,9 +180,9 @@ public abstract class Config implements VersionedConfig, Unload {
= HoconConfigurationLoader.builder().setPath(potentialFile).build();
try {
mcMMO.p.getLogger().info("Config File Full Path: "+getDefaultConfigFile().getAbsolutePath());
mcMMO.p.getLogger().info("Config File Full Path: " + getDefaultConfigFile().getAbsolutePath());
//Delete any existing default config
if(getDefaultConfigFile().exists())
if (getDefaultConfigFile().exists())
getDefaultConfigFile().delete();
//Make new file
@ -200,8 +194,8 @@ public abstract class Config implements VersionedConfig, Unload {
//Save to a new file
generation_loader.save(defaultRootNode);
mcMMO.p.getLogger().info("Generated a default file for "+fileName);
} catch(IOException e) {
mcMMO.p.getLogger().info("Generated a default file for " + fileName);
} catch (IOException e) {
mcMMO.p.getLogger().severe("Error when trying to generate a default configuration file for " + getDefaultConfigCopyRelativePath());
e.printStackTrace();
}
@ -212,26 +206,23 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Attemps to load the config file if it exists, if it doesn't it copies a new one from within the JAR
*
* @return user config File
* @see Config#resourceUserCopy
* @throws IOException
* @see Config#resourceUserCopy
*/
private File initUserConfig() throws IOException {
File userCopy = new File(DIRECTORY_DATA_FOLDER, FILE_RELATIVE_PATH); //Load the user file;
if(userCopy.exists())
{
if (userCopy.exists()) {
// Yay
return userCopy;
}
else
{
} else {
//If it's gone we copy default files
//Note that we don't copy the values from the default copy put in /defaults/ that file exists only as a reference to admins and is unreliable
if(copyDefaults)
if (copyDefaults)
return copyDefaultFromJar(FILE_RELATIVE_PATH, false);
else
{
else {
//Make a new empty file
userCopy.createNewFile();
return userCopy;
@ -241,6 +232,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Gets the File representation of the this users config
*
* @return the users config File
*/
public File getUserConfigFile() {
@ -249,17 +241,17 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Used to make a new config file at a specified relative output path inside the data directory by copying the matching file found in that same relative path within the JAR
*
* @param relativeOutputPath the path to the output file
* @param deleteOld whether or not to delete the existing output file on disk
* @param deleteOld whether or not to delete the existing output file on disk
* @return a copy of the default config within the JAR
* @throws IOException
*/
private File copyDefaultFromJar(String relativeOutputPath, boolean deleteOld) throws IOException
{
private File copyDefaultFromJar(String relativeOutputPath, boolean deleteOld) throws IOException {
/*
* Gen a Default config from inside the JAR
*/
mcMMO.p.getLogger().info("Preparing to copy internal resource file (in JAR) - "+FILE_RELATIVE_PATH);
mcMMO.p.getLogger().info("Preparing to copy internal resource file (in JAR) - " + FILE_RELATIVE_PATH);
//InputStream inputStream = McmmoCore.getResource(FILE_RELATIVE_PATH);
InputStream inputStream = mcMMO.p.getResource(FILE_RELATIVE_PATH);
@ -270,14 +262,12 @@ public abstract class Config implements VersionedConfig, Unload {
File targetFile = new File(DIRECTORY_DATA_FOLDER, relativeOutputPath);
//Wipe old default file on disk
if (targetFile.exists() && deleteOld)
{
if (targetFile.exists() && deleteOld) {
mcMMO.p.getLogger().info("Updating file " + relativeOutputPath);
targetFile.delete(); //Necessary?
}
if(!targetFile.exists())
{
if (!targetFile.exists()) {
targetFile.getParentFile().mkdirs();
targetFile.createNewFile(); //New File Boys
}
@ -292,6 +282,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* The path to the defaults directory
*
* @return the path to the defaults directory
*/
private String getDefaultConfigCopyRelativePath() {
@ -301,6 +292,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Grabs the File representation of the default config, which is stored on disk in a defaults folder
* this file will be overwritten every time mcMMO starts to keep it up to date.
*
* @return the copy of the default config file, stored in the defaults directory
*/
private File getDefaultConfigFile() {
@ -316,11 +308,11 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Configs are versioned based on when they had significant changes to keys
*
* @return current MainConfig Version String
*/
public String getVersion()
{
return String.valueOf(getConfigVersion());
public String getVersion() {
return String.valueOf(getConfigVersion());
}
/**
@ -342,13 +334,12 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Compares the users config file to the default and adds any missing nodes and applies any necessary updates
*/
private void updateConfig()
{
mcMMO.p.getLogger().info(defaultRootNode.getChildrenMap().size() +" items in default children map");
mcMMO.p.getLogger().info(userRootNode.getChildrenMap().size() +" items in default root map");
private void updateConfig() {
mcMMO.p.getLogger().info(defaultRootNode.getChildrenMap().size() + " items in default children map");
mcMMO.p.getLogger().info(userRootNode.getChildrenMap().size() + " items in default root map");
// Merge Values from default
if(mergeNewKeys)
if (mergeNewKeys)
userRootNode = userRootNode.mergeValuesFrom(defaultRootNode);
removeOldKeys();
@ -368,23 +359,21 @@ public abstract class Config implements VersionedConfig, Unload {
* Finds any keys in the users config that are not present in the default config and removes them
*/
//TODO: Finish this
private void removeOldKeys()
{
if(!removeOldKeys)
private void removeOldKeys() {
if (!removeOldKeys)
return;
for(CommentedConfigurationNode CommentedConfigurationNode : defaultRootNode.getChildrenList())
{
for (CommentedConfigurationNode CommentedConfigurationNode : defaultRootNode.getChildrenList()) {
}
}
/**
* Saves the current state information of the config to the users copy (which they may edit)
*
* @throws IOException
*/
private void saveUserCopy() throws IOException
{
private void saveUserCopy() throws IOException {
mcMMO.p.getLogger().info("Saving new node");
userCopyLoader.save(userRootNode);
}
@ -395,11 +384,12 @@ public abstract class Config implements VersionedConfig, Unload {
private void updateConfigVersion() {
// Set a version for our config
this.userRootNode.getNode("ConfigVersion").setValue(getConfigVersion());
mcMMO.p.getLogger().info("Updated config to ["+getConfigVersion()+"] - " + FILE_RELATIVE_PATH);
mcMMO.p.getLogger().info("Updated config to [" + getConfigVersion() + "] - " + FILE_RELATIVE_PATH);
}
/**
* Returns the root node of this config
*
* @return the root node of this config
*/
protected CommentedConfigurationNode getUserRootNode() {
@ -408,62 +398,67 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Gets an int from the config and casts it to short before returning
*
* @param path the path to the int
* @return the value of the int after being cast to short at the node, null references will zero initialize
*/
public short getShortValue(String... path) { return (short) userRootNode.getNode(path).getInt();}
public short getShortValue(String... path) {
return (short) userRootNode.getNode(path).getInt();
}
/**
* Grabs an int from the specified node
*
* @param path
* @return the int from the node, null references will zero initialize
*/
public int getIntValue(String... path)
{
public int getIntValue(String... path) {
return userRootNode.getNode(path).getInt();
}
/**
* Grabs a double from the specified node
*
* @param path
* @return the double from the node, null references will zero initialize
*/
public double getDoubleValue(String... path)
{
public double getDoubleValue(String... path) {
return userRootNode.getNode(path).getDouble();
}
/**
* Grabs a long from the specified node
*
* @param path
* @return the long from the node, null references will zero initialize
*/
public long getLongValue(String... path)
{
public long getLongValue(String... path) {
return userRootNode.getNode(path).getLong();
}
/**
* Grabs a boolean from the specified node
*
* @param path
* @return the boolean from the node, null references will zero initialize
*/
public boolean getBooleanValue(String... path)
{
public boolean getBooleanValue(String... path) {
return userRootNode.getNode(path).getBoolean();
}
/**
* Grabs a string from the specified node
*
* @param path
* @return the string from the node, null references will zero initialize
*/
public String getStringValue(String... path)
{
public String getStringValue(String... path) {
return userRootNode.getNode(path).getString();
}
/**
* Checks to see if a node exists in the user's config file
*
* @param path path to the node
* @return true if the node exists
*/
@ -473,6 +468,7 @@ public abstract class Config implements VersionedConfig, Unload {
/**
* Returns the children of a specific node
*
* @param path the path to the parent node
* @return the list of children for the target parent node
*/
@ -480,8 +476,7 @@ public abstract class Config implements VersionedConfig, Unload {
return userRootNode.getNode(path).getChildrenList();
}
public List<String> getListFromNode(String... path) throws ObjectMappingException
{
public List<String> getListFromNode(String... path) throws ObjectMappingException {
return userRootNode.getNode(path).getList(TypeToken.of(String.class));
}
}

View File

@ -14,10 +14,10 @@ public abstract class ConfigCollection<T> extends Config implements Registers, G
/**
* @param pathToParentFolder Path to the "parent" folder on disk
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
* @param removeOldKeys if true, the users config file will have keys not found in the internal default resource file of the same name and path removed
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
* @param removeOldKeys if true, the users config file will have keys not found in the internal default resource file of the same name and path removed
*/
public ConfigCollection(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);

View File

@ -9,11 +9,19 @@ import java.util.ArrayList;
* Constants relating to config folders and paths
*/
public class ConfigConstants {
private final static String[] EXAMPLE_BLACKLIST_WORLDS = {"Example_15434453", "Example_2324423", "Example_323423465"};
public final static ArrayList<String> EXAMPLE_BLACKLIST_WORLDS_LIST_DEFAULT;
public final static String SKILL_SCALING_BENEFIT_EXPLANATION = "\nSub-Skills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of that sub-skill.";
/* FOLDER NAMES */
public static final String FOLDER_NAME_CONFIG = "config";
public static final String FOLDER_NAME_SKILLS = "skills";
public static final String FOLDER_NAME_EXPERIENCE = "Experience Settings";
public static final String FOLDER_NAME_DEFAULTS = "defaults";
/* RELATIVE PATHS */
public final static String RELATIVE_PATH_CONFIG_DIR = File.separator + FOLDER_NAME_CONFIG + File.separator;
public final static String RELATIVE_PATH_SKILLS_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_SKILLS + File.separator;
public final static String RELATIVE_PATH_XP_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_EXPERIENCE + File.separator;
private final static String[] EXAMPLE_BLACKLIST_WORLDS = {"Example_15434453", "Example_2324423", "Example_323423465"};
//Add the worlds to the list
static {
@ -23,23 +31,12 @@ public class ConfigConstants {
EXAMPLE_BLACKLIST_WORLDS_LIST_DEFAULT.add(EXAMPLE_BLACKLIST_WORLDS[2]);
}
/* FOLDER NAMES */
public static final String FOLDER_NAME_CONFIG = "config";
public static final String FOLDER_NAME_SKILLS = "skills";
public static final String FOLDER_NAME_EXPERIENCE = "Experience Settings";
public static final String FOLDER_NAME_DEFAULTS = "defaults";
/* RELATIVE PATHS */
public final static String RELATIVE_PATH_CONFIG_DIR = File.separator + FOLDER_NAME_CONFIG + File.separator;
public final static String RELATIVE_PATH_SKILLS_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_SKILLS + File.separator;
public final static String RELATIVE_PATH_XP_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_EXPERIENCE + File.separator;
/**
* Return the data folder for mcMMO
*
* @return the File for the data folder used by mcMMO
*/
public static File getDataFolder()
{
public static File getDataFolder() {
return mcMMO.p.getDataFolder();
}
@ -74,33 +71,32 @@ public class ConfigConstants {
/**
* Creates all directories used by mcMMO config files
*/
public static void makeAllConfigDirectories()
{
public static void makeAllConfigDirectories() {
/* CONFIG DIRECTORY */
if(!getConfigFolder().exists())
if (!getConfigFolder().exists())
getConfigFolder().mkdirs();
/* DEFAULT DIRECTORIES */
if(!getDefaultsFolder().exists())
if (!getDefaultsFolder().exists())
getDefaultsFolder().mkdirs();
if(!getDefaultsConfigFolder().exists())
if (!getDefaultsConfigFolder().exists())
getDefaultsConfigFolder().mkdirs();
if(!getDefaultsSkillFolder().exists())
if (!getDefaultsSkillFolder().exists())
getDefaultsSkillFolder().mkdirs();
if(!getDefaultsXPFolder().exists())
if (!getDefaultsXPFolder().exists())
getDefaultsXPFolder().mkdirs();
/* CONFIG SUBDIRECTORIES */
if(!getConfigSkillFolder().exists())
if (!getConfigSkillFolder().exists())
getConfigSkillFolder().mkdirs();
if(!getConfigXPFolder().exists())
if (!getConfigXPFolder().exists())
getConfigXPFolder().mkdirs();
}
}

View File

@ -65,37 +65,32 @@ import java.util.ArrayList;
import java.util.HashMap;
/**
*
* The Config Manager handles initializing, loading, and unloading registers for all configs that mcMMO uses
* This makes sure that mcMMO properly loads and unloads its values on reload
*
* <p>
* Config Manager also holds all of our MultiConfigContainers
*/
public final class ConfigManager {
/* UNLOAD REGISTER */
SkillPropertiesManager skillPropertiesManager;
private ArrayList<Unload> unloadables;
private ArrayList<File> userFiles;
/* COLLECTION MANAGERS */
private ArrayList<File> userFiles;
private RepairableManager repairableManager;
private SalvageableManager salvageableManager;
private BonusDropManager bonusDropManager;
/* CUSTOM SERIALIZERS */
private TypeSerializerCollection customSerializers;
private BonusDropManager bonusDropManager;
/* MOD MANAGERS */
//TODO: Add these back when modded servers become a thing again
/* MISC MANAGERS */
SkillPropertiesManager skillPropertiesManager;
private TypeSerializerCollection customSerializers;
private ExperienceMapManager experienceMapManager;
/* CONFIG INSTANCES */
@ -163,14 +158,12 @@ public final class ConfigManager {
private ArrayList<String> configErrors; //Collect errors to whine about to server admins
public ConfigManager()
{
public ConfigManager() {
unloadables = new ArrayList<>();
userFiles = new ArrayList<>();
}
public void loadConfigs()
{
public void loadConfigs() {
//Register Custom Serializers
registerCustomTypeSerializers();
@ -314,9 +307,12 @@ public final class ConfigManager {
customSerializers = TypeSerializers.getDefaultSerializers().newChild();
mcMMO.p.getLogger().info("Registering custom type serializers for Configurate...");
customSerializers.registerType(new TypeToken<Material>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<FormulaType>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<Material>() {
}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<PartyFeature>() {
}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<FormulaType>() {
}, new CustomEnumValueSerializer());
customSerializers.registerType(TypeToken.of(Repairable.class), new RepairableSerializer());
customSerializers.registerType(TypeToken.of(Salvageable.class), new SalvageableSerializer());
customSerializers.registerType(TypeToken.of(MinecraftMaterialWrapper.class), new MinecraftMaterialWrapperSerializer());
@ -325,22 +321,21 @@ public final class ConfigManager {
/**
* Gets the serializers registered and used by mcMMO
* This includes all default serializers
*
* @return our custom serializers
*/
public TypeSerializerCollection getCustomSerializers() {
return customSerializers;
}
private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz)
{
private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz) {
skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(primarySkillType, clazz));
}
/**
* Misc managers
*/
private void initMiscManagers()
{
private void initMiscManagers() {
experienceMapManager = new ExperienceMapManager();
}
@ -361,8 +356,7 @@ public final class ConfigManager {
/**
* Initializes any managers related to config collections
*/
private void initCollectionManagers()
{
private void initCollectionManagers() {
// Handles registration of repairables
repairableManager = new RepairableManager(getRepairables());
unloadables.add(repairableManager);
@ -378,30 +372,28 @@ public final class ConfigManager {
/**
* Get all loaded repairables (loaded from all repairable configs)
*
* @return the currently loaded repairables
*/
public ArrayList<Repairable> getRepairables()
{
public ArrayList<Repairable> getRepairables() {
return getConfigRepair().getConfigRepairablesList();
}
/**
* Get all loaded salvageables (loaded from all salvageable configs)
*
* @return the currently loaded salvageables
*/
public ArrayList<Salvageable> getSalvageables()
{
public ArrayList<Salvageable> getSalvageables() {
return getConfigSalvage().getConfigSalvageablesList();
}
/**
* Unloads all config options (prepares for reload)
*/
public void unloadAllConfigsAndRegisters()
{
public void unloadAllConfigsAndRegisters() {
//Unload
for(Unload unloadable : unloadables)
{
for (Unload unloadable : unloadables) {
unloadable.unload();
}
@ -414,9 +406,8 @@ public final class ConfigManager {
* Registers an unloadable
* Unloadables call unload() on plugin disable to cleanup registries
*/
public void registerUnloadable(Unload unload)
{
if(!unloadables.contains(unload))
public void registerUnloadable(Unload unload) {
if (!unloadables.contains(unload))
unloadables.add(unload);
}
@ -424,24 +415,21 @@ public final class ConfigManager {
* Registers an unloadable
* Unloadables call unload() on plugin disable to cleanup registries
*/
public void registerUserFile(File userFile)
{
if(!userFiles.contains(userFile))
public void registerUserFile(File userFile) {
if (!userFiles.contains(userFile))
userFiles.add(userFile);
}
/**
* Registers bonus drops from several skill configs
*/
public void registerBonusDrops()
{
public void registerBonusDrops() {
bonusDropManager.addToWhitelistByNameID(getConfigMining().getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configWoodcutting.getBonusDrops());
}
public void validateConfigs()
{
public void validateConfigs() {
}
@ -451,10 +439,10 @@ public final class ConfigManager {
/**
* Used to back up our zip files real easily
*
* @return
*/
public ArrayList<File> getConfigFiles()
{
public ArrayList<File> getConfigFiles() {
return userFiles;
}
@ -510,9 +498,13 @@ public final class ConfigManager {
return experienceMapManager;
}
public ConfigDatabase getConfigDatabase() { return configDatabase.getConfig(); }
public ConfigDatabase getConfigDatabase() {
return configDatabase.getConfig();
}
public ConfigScoreboard getConfigScoreboard() { return configScoreboard.getConfig(); }
public ConfigScoreboard getConfigScoreboard() {
return configScoreboard.getConfig();
}
public ConfigLeveling getConfigLeveling() {
return configLeveling.getConfig();
@ -658,25 +650,22 @@ public final class ConfigManager {
* Checks if this plugin is using retro mode
* Retro mode is a 0-1000 skill system
* Standard mode is scaled for 1-100
*
* @return true if retro mode is enabled
*/
public boolean isRetroMode()
{
public boolean isRetroMode() {
return getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled();
}
public boolean isBonusDropsEnabled(Material material)
{
public boolean isBonusDropsEnabled(Material material) {
return getBonusDropManager().isBonusDropWhitelisted(material);
}
public double getSkillMaxBonusLevel(SubSkillType subSkillType)
{
public double getSkillMaxBonusLevel(SubSkillType subSkillType) {
return skillPropertiesManager.getMaxBonusLevel(subSkillType);
}
public double getSkillMaxChance(SubSkillType subSkillType)
{
public double getSkillMaxChance(SubSkillType subSkillType) {
return skillPropertiesManager.getMaxChance(subSkillType);
}

View File

@ -9,12 +9,11 @@ import java.io.File;
public abstract class ConfigValidated extends Config implements UnsafeValueValidation {
/**
* @param pathToParentFolder File for the "parent" folder on disk
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
*/
public ConfigValidated(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys)
{
public ConfigValidated(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
validateEntries();
}

View File

@ -19,8 +19,9 @@ public class CoreSkillsConfig extends Config {
/**
* This grabs an instance of the class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
@ -55,7 +56,7 @@ public class CoreSkillsConfig extends Config {
* @return true if subskill is enabled
*/
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill) {
return getBooleanValue(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString()), abstractSubSkill.getConfigKeyName(), ENABLED);
return getBooleanValue(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString()), abstractSubSkill.getConfigKeyName(), ENABLED);
}
/**
@ -65,6 +66,6 @@ public class CoreSkillsConfig extends Config {
* @return true if enabled
*/
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) {
return getBooleanValue(StringUtils.getCapitalized(primarySkillType.toString()), ENABLED);
return getBooleanValue(StringUtils.getCapitalized(primarySkillType.toString()), ENABLED);
}
}

View File

@ -4,11 +4,13 @@ import java.util.Collection;
/**
* Represents a class that contains a generic collection
*
* @param <T>
*/
public interface GenericCollectionContainer<T> {
/**
* Grab the collection held by this class
*
* @return the collection held by this class
*/
Collection<T> getLoadedCollection();

View File

@ -208,8 +208,9 @@ public class MainConfig extends ConfigValidated {
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated

View File

@ -23,8 +23,9 @@ public class RankConfig extends ConfigValidated {
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated

View File

@ -6,11 +6,10 @@ import com.gmail.nossr50.util.StringUtils;
public class SkillConfigFactory {
protected static SerializedConfigLoader initSkillConfig(PrimarySkillType primarySkillType, Class<?> clazz)
{
protected static SerializedConfigLoader initSkillConfig(PrimarySkillType primarySkillType, Class<?> clazz) {
return new SerializedConfigLoader(clazz,
primarySkillType.toString().toLowerCase() + ".conf",
StringUtils.getCapitalized(primarySkillType.toString()),
null);
primarySkillType.toString().toLowerCase() + ".conf",
StringUtils.getCapitalized(primarySkillType.toString()),
null);
}
}

View File

@ -14,37 +14,31 @@ public class SkillPropertiesManager {
private HashMap<SubSkillType, Double> maxBonusLevelMap;
private HashMap<SubSkillType, Double> maxBonusPercentage;
public SkillPropertiesManager()
{
public SkillPropertiesManager() {
maxChanceMap = new HashMap<>();
maxBonusLevelMap = new HashMap<>();
maxBonusPercentage = new HashMap<>();
}
public void registerRNG(SubSkillType subSkillType, ConfigSubSkillScalingRNG config)
{
public void registerRNG(SubSkillType subSkillType, ConfigSubSkillScalingRNG config) {
maxChanceMap.put(subSkillType, config.getMaxChance());
maxBonusLevelMap.put(subSkillType, config.getMaxBonusLevel());
}
public double getMaxChance(SubSkillType subSkillType)
{
public double getMaxChance(SubSkillType subSkillType) {
return maxChanceMap.get(subSkillType);
}
public double getMaxBonusLevel(SubSkillType subSkillType)
{
public double getMaxBonusLevel(SubSkillType subSkillType) {
return maxBonusLevelMap.get(subSkillType);
}
public void fillRegisters()
{
public void fillRegisters() {
fillRNGRegisters();
}
private void fillRNGRegisters()
{
private void fillRNGRegisters() {
//Acrobatics
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getDodge().getRNGSettings());
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getRoll().getRNGSettings());

View File

@ -24,8 +24,9 @@ public class SoundConfig extends ConfigValidated {
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated

View File

@ -13,18 +13,15 @@ public interface UnsafeValueValidation {
/**
* Prints all errors found when validating the config
*/
default void validateEntries()
{
default void validateEntries() {
/*
* Print Errors about Keys
*/
List<String> validKeyErrors = validateKeys(); // Validate Keys
if(validKeyErrors != null && validKeyErrors.size() > 0)
{
for(String error : validKeyErrors)
{
if (validKeyErrors != null && validKeyErrors.size() > 0) {
for (String error : validKeyErrors) {
mcMMO.p.getLogger().severe(error);
}
}

View File

@ -6,6 +6,7 @@ package com.gmail.nossr50.config;
public interface VersionedConfig {
/**
* The version of this config
*
* @return
*/
double getConfigVersion();

View File

@ -86,8 +86,9 @@ public class ExperienceConfig extends ConfigValidated {
/**
* This grabs an instance of this config class from the Config Manager
* This method is deprecated and will be removed in the future
* @see mcMMO#getConfigManager()
*
* @return the instance of this config
* @see mcMMO#getConfigManager()
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
*/
@Deprecated
@ -168,9 +169,6 @@ public class ExperienceConfig extends ConfigValidated {
return reason;
}
/*
* FORMULA SETTINGS
*/
@ -185,8 +183,7 @@ public class ExperienceConfig extends ConfigValidated {
return getDoubleValue(EXPERIENCE_FORMULA, MULTIPLIER, GLOBAL);
}
public void setGlobalXPMultiplier(double newXpMultiplier)
{
public void setGlobalXPMultiplier(double newXpMultiplier) {
getUserRootNode().getNode(EXPERIENCE_FORMULA, MULTIPLIER, GLOBAL).setValue(newXpMultiplier);
}
@ -266,14 +263,15 @@ public class ExperienceConfig extends ConfigValidated {
/**
* Gets the raw XP given for breaking this block, this does not include modifiers
* @param skill The skill to give XP for
*
* @param skill The skill to give XP for
* @param blockType the type of block
* @return the raw amount of XP for this block before modifiers
*/
//public int getXp(PrimarySkillType skill, BlockType blockType) {
public int getXp(PrimarySkillType skill, Material blockType) {
//TODO: This is going to need to be changed, this code here is only placeholder
String[] path = new String[]{ EXPERIENCE, StringUtils.getCapitalized(skill.toString()), blockType.toString()};
String[] path = new String[]{EXPERIENCE, StringUtils.getCapitalized(skill.toString()), blockType.toString()};
return getIntValue(path);
}

View File

@ -4,14 +4,12 @@ import com.gmail.nossr50.util.StringUtils;
public final class HOCONUtil {
public static String serializeENUMName(String hyphenedString)
{
public static String serializeENUMName(String hyphenedString) {
String[] split = hyphenedString.split("_");
StringBuilder formattedString = new StringBuilder();
for(int x = 0; x < split.length; x++)
{
if(x + 1 >= split.length)
for (int x = 0; x < split.length; x++) {
if (x + 1 >= split.length)
formattedString.append(StringUtils.getCapitalized(split[x]));
else
formattedString.append(StringUtils.getCapitalized(split[x])).append('-');
@ -20,14 +18,12 @@ public final class HOCONUtil {
return formattedString.toString();
}
public static String deserializeENUMName(String serializedName)
{
public static String deserializeENUMName(String serializedName) {
String[] split = serializedName.split("-");
StringBuilder formattedString = new StringBuilder();
for(int x = 0; x < split.length; x++)
{
if(x + 1 >= split.length)
for (int x = 0; x < split.length; x++) {
if (x + 1 >= split.length)
formattedString.append(split[x].toUpperCase());
else
formattedString.append(split[x]).append('_');

View File

@ -46,7 +46,8 @@ public class RepairableSerializer implements TypeSerializer<Repairable> {
/* Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) */
String item = value.getNode(ITEM).getValue(TypeToken.of(String.class));
List<String> repairItems = value.getNode(ITEMS_USED_TO_REPAIR).getValue(new TypeToken<List<String>>() {});
List<String> repairItems = value.getNode(ITEMS_USED_TO_REPAIR).getValue(new TypeToken<List<String>>() {
});
/*String itemConstant = HOCONUtil.deserializeENUMName(value.getNode("Item").getString());
@ -74,8 +75,7 @@ public class RepairableSerializer implements TypeSerializer<Repairable> {
value.getNode(XP_MULTIPLIER).setValue(obj.getXpMultiplier());
}
private Enum getEnum(String enumConstant, TypeToken<?> type) throws ObjectMappingException
{
private Enum getEnum(String enumConstant, TypeToken<?> type) throws ObjectMappingException {
//noinspection RedundantCast
Optional<Enum> ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class),
enumConstant); // XXX: intellij says this cast is optional but it isnt

View File

@ -61,8 +61,7 @@ public class SalvageableSerializer implements TypeSerializer<Salvageable> {
value.getNode(OVERRIDE_LEVEL_REQUIREMENT).setValue(obj.getMinimumLevel());
}
private Enum getEnum(String enumConstant, TypeToken<?> type) throws ObjectMappingException
{
private Enum getEnum(String enumConstant, TypeToken<?> type) throws ObjectMappingException {
//noinspection RedundantCast
Optional<Enum> ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class),
enumConstant); // XXX: intellij says this cast is optional but it isnt

View File

@ -49,6 +49,7 @@ import java.util.Objects;
/**
* Handles loading serialized configs with configurate
*
* @param <T> the class type of the config
*/
public class SerializedConfigLoader<T> {
@ -61,20 +62,15 @@ public class SerializedConfigLoader<T> {
"\nOfficial mcMMO Discord - https://discord.gg/bJ7pFS9\n" +
"\nYou can also consult the new official wiki" +
"\nhttps://mcmmo.org/wiki - Keep in mind the wiki is a WIP and may not have information about everything in mcMMO!";
private ConfigurationOptions configurationOptions;
private CommentedConfigurationNode data;
private CommentedConfigurationNode fileData;
private final String ROOT_NODE_ADDRESS;
private final Path path;
/**
* The parent configuration - values are inherited from this
*/
private final SerializedConfigLoader parent;
private ConfigurationOptions configurationOptions;
private CommentedConfigurationNode data;
private CommentedConfigurationNode fileData;
/**
* The loader (mapped to a file) used to read/write the config to disk
*/
@ -110,13 +106,12 @@ public class SerializedConfigLoader<T> {
reload();
save();
} catch (Exception e) {
mcMMO.p.getLogger().severe("Failed to initialize config - "+path.toString());
mcMMO.p.getLogger().severe("Failed to initialize config - " + path.toString());
e.printStackTrace();
}
}
private Path getPathFromFileName(String fileName)
{
private Path getPathFromFileName(String fileName) {
File configFile = new File(ConfigConstants.getConfigFolder(), fileName);
return configFile.toPath();
}
@ -143,7 +138,7 @@ public class SerializedConfigLoader<T> {
this.loader.save(saveNode);
return true;
} catch (IOException | ObjectMappingException e) {
mcMMO.p.getLogger().severe("Failed to save configuration - "+path.toString());
mcMMO.p.getLogger().severe("Failed to save configuration - " + path.toString());
e.printStackTrace();
return false;
}
@ -169,7 +164,7 @@ public class SerializedConfigLoader<T> {
// populate the config object
populateInstance();
} catch (Exception e) {
mcMMO.p.getLogger().severe("Failed to load configuration - "+path.toString());
mcMMO.p.getLogger().severe("Failed to load configuration - " + path.toString());
e.printStackTrace();
}
}

View File

@ -5,18 +5,17 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class AntiExploit {
public static final boolean SPAWNED_MOBS_DEFAULT = true;
private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true;
private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true;
public static final boolean SPAWNED_MOBS_DEFAULT = true;
/*
* CONFIG NODES
*/
@Setting(value = "Endermen-Endermite-Fix",
comment = "Removes XP from Endermen that target endermite, this is a common exploit in The End because of how rapidly they can spawn." +
"\nIt is recommended that you leave this on as it allows players to easily gain massive amounts of combat XP" +
"\nDefault value: "+ENDERMEN_ENDERMITE_DEFAULT)
"\nDefault value: " + ENDERMEN_ENDERMITE_DEFAULT)
private boolean endermenEndermiteFix = ENDERMEN_ENDERMITE_DEFAULT;
@Setting(value = "Pistons-Mark-Blocks-As-Unnatural",
@ -26,7 +25,7 @@ public class AntiExploit {
@Setting(value = "Spawned-Mobs-Give-No-XP",
comment = "Spawned mobs will not give players combat XP." +
"\nThis includes mobs spawned from a nether portal, mob spawner, or eggs." +
"\nThis will not include mobs spawned from commands, typically.")
"\nThis includes mobs spawned from a nether portal, mob spawner, or eggs." +
"\nThis will not include mobs spawned from commands, typically.")
private boolean spawnedMobsGiveNoXP = SPAWNED_MOBS_DEFAULT;
}

View File

@ -18,7 +18,7 @@ public class ConfigSectionExploitAcrobatics {
"\nPlayers cannot gain XP from falling in the same location twice." +
"\nIt's best you do not raise this number unless you have some kind of god computer," +
"\n mcMMO processes the entire tracked location list anytime a player takes fall damage so the bigger this is the more expensive that calculation is." +
"\nDefault value: "+ACROBATIC_LOCATION_LIMIT_DEFAULT)
"\nDefault value: " + ACROBATIC_LOCATION_LIMIT_DEFAULT)
private int acrobaticLocationLimit = ACROBATIC_LOCATION_LIMIT_DEFAULT;
@Setting(value = "Prevent-Acrobatics-Farming",
@ -26,16 +26,16 @@ public class ConfigSectionExploitAcrobatics {
"\nEnabled tracking player fall locations" +
"\nEnables tracking when a player last teleported" +
"\nEnables tracking when a player last respawned" +
"\nDefault value: "+PREVENT_ACROBATICS_ABUSE_DEFAULT)
"\nDefault value: " + PREVENT_ACROBATICS_ABUSE_DEFAULT)
private boolean preventAcrobaticsAbuse = PREVENT_ACROBATICS_ABUSE_DEFAULT;
@Setting(value = "No-XP-After-Teleporting-Cooldown-In-Seconds", comment = "Prevents XP gains for Acrobatics for a set period of time after teleporting." +
"\nDefault value: "+TELEPORT_COOLDOWN_DEFAULT)
"\nDefault value: " + TELEPORT_COOLDOWN_DEFAULT)
private int teleportCooldownSeconds = TELEPORT_COOLDOWN_DEFAULT;
@Setting(value = "Fall-Damage-XP-Gain-Cooldown-In-Seconds", comment = "Prevent players from gaining XP from fall damage if they had gained XP recently." +
"\nWhen players take fall damage again within this cooldown period the length of the cooldown is increased to discourage automated Roll XP farming." +
"\nDefault value: "+ROLL_XP_GAIN_CD_DEFAULT)
"\nDefault value: " + ROLL_XP_GAIN_CD_DEFAULT)
private int rollXPGainCooldownSeconds = ROLL_XP_GAIN_CD_DEFAULT;
public int getRollXPGainCooldownSeconds() {

View File

@ -6,24 +6,23 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionExploitFishing {
private static final boolean PREVENT_FISHING_EXPLOITS_DEFAULT = true;
public static final int OVER_FISHING_LIMIT_DEFAULT = 3;
public static final boolean ADMINS_OVER_FISHING_DEFAULT = true;
public static final float OVER_FISHING_SIZE = 1.0F;
public static final int FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT = 200;
private static final boolean PREVENT_FISHING_EXPLOITS_DEFAULT = true;
@Setting(value = "Prevent-Fishing-AFK-Farming",
comment = "Prevents many methods for automatically farming Fishing XP." +
"\nSuch as farming in the same spot more than once." +
"\nSpam-click fishing." +
"\nDefault value: "+PREVENT_FISHING_EXPLOITS_DEFAULT)
"\nDefault value: " + PREVENT_FISHING_EXPLOITS_DEFAULT)
private boolean preventFishingExploits = PREVENT_FISHING_EXPLOITS_DEFAULT;
@Setting(value = "Overfishing-Limit", comment = "How many times a player can fish in the same spot before it becomes over-fished" +
"\nOver fishing is in place to prevent 99% of AFK fishing from working." +
"\nFishing in a new spot is all it takes to remove over-fishing from your previous location." +
"\nOver-fishing is based on where your fishing bobber actually lands and catches fish, it has nothing to do with where you are standing." +
"\nDefault value: "+OVER_FISHING_LIMIT_DEFAULT)
"\nDefault value: " + OVER_FISHING_LIMIT_DEFAULT)
private int overfishingLimit = OVER_FISHING_LIMIT_DEFAULT;
@Setting(value = "Overfishing-Area-Size-Radius", comment = "Over-Fishing tracks where you've caught fish from by making a bounding box around where your fishing rod's bobber lands." +
@ -32,18 +31,18 @@ public class ConfigSectionExploitFishing {
"\nA value of 1.0 would result in a bounding box that is 2.0 units (blocks) in size" +
"\nWhen you catch a new fish it makes a new bounding box at that location and checks to see if it overlaps with the bounding box of the last place you caught a fish," +
"\n if they intersect then that increases your fish counter, if you are at your fishing limit then you get nothing." +
"\nDefault value: "+OVER_FISHING_SIZE)
"\nDefault value: " + OVER_FISHING_SIZE)
private float overFishingAreaSize = OVER_FISHING_SIZE;
@Setting(value = "Alert-Admins-To-Overfishing-Abuse", comment = "If someone is triggering over-fishing exploit detection too often, alert admins." +
"\nThis will send a message to ops in game and to the console, and to anyone with the admin chat permission node." +
"\nDefault value: "+ADMINS_OVER_FISHING_DEFAULT)
"\nDefault value: " + ADMINS_OVER_FISHING_DEFAULT)
private boolean alertAdminsOnOverFishing = ADMINS_OVER_FISHING_DEFAULT;
@Setting(value = "Fishing-Rod-Spam-Threshold-In-Milliseconds", comment = "How many milliseconds in between casting the fishing rod before a player suffers from fatigue." +
"\nFatigue causes a loss of 1 hunger and 5 durability damage to the currently held fishing rod." +
"\nThis is to prevent exploits for fishing that involve rapid fire auto clickers." +
"\nDefault value: "+FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT)
"\nDefault value: " + FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT)
private long fishingRodSpamMilliseconds = FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT;
public long getFishingRodSpamMilliseconds() {

View File

@ -6,39 +6,38 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionGeneral {
private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true;
private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true;
public static final boolean SPAWNED_MOBS_DEFAULT = true;
public static final boolean TAMED_MOB_DEFAULT = true;
private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true;
private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true;
@Setting(value = "Endermen-Endermite-Fix",
comment = "Removes XP from Endermen that target endermite, this is a common exploit in The End because of how rapidly they can spawn." +
"\nIt is recommended that you leave this on as it allows players to easily gain massive amounts of combat XP" +
"\nDefault value: "+ENDERMEN_ENDERMITE_DEFAULT)
"\nDefault value: " + ENDERMEN_ENDERMITE_DEFAULT)
private boolean endermenEndermiteFix = ENDERMEN_ENDERMITE_DEFAULT;
@Setting(value = "Pistons-Mark-Blocks-As-Unnatural",
comment = "Unnatural blocks give no XP." +
"This helps prevent complex automated stone farms that enable auto clickers to gain XP passively." +
"\nDefault value: "+PISTONS_MARK_BLOCKS_DEFAULT)
"\nDefault value: " + PISTONS_MARK_BLOCKS_DEFAULT)
private boolean pistonsMarkBlocksUnnatural = PISTONS_MARK_BLOCKS_DEFAULT;
@Setting(value = "Spawned-Mobs-Have-Modified-XP-Values",
comment =
"Spawned mobs will give different XP values than their naturally spawning counterparts" +
"\nBy default, spawned mob XP is reduced to zero, but you could change it in the experience config to whatever you want." +
"\nSpawned mobs include mobs spawned from a nether portal, mob spawner, or eggs." +
"\nThis will not include mobs spawned from commands, typically." +
"\nDefault value: "+SPAWNED_MOBS_DEFAULT)
"\nBy default, spawned mob XP is reduced to zero, but you could change it in the experience config to whatever you want." +
"\nSpawned mobs include mobs spawned from a nether portal, mob spawner, or eggs." +
"\nThis will not include mobs spawned from commands, typically." +
"\nDefault value: " + SPAWNED_MOBS_DEFAULT)
private boolean markSpawnedMobs = SPAWNED_MOBS_DEFAULT;
@Setting(value = "Tamed-Entities-Have-Modified-XP-Values",
comment =
"Prevents tamed entities from giving normal combat XP when struck by players" +
"\nBy default, combat XP from tamed mobs is reduced to zero, but you could change it in the experience config to whatever you want." +
"\nIt's hard to imagine this being abused, but we disable it anyways." +
"\nTamed entities get marked in the same way that spawned mobs do, so they are affected by the same XP modifiers." +
"\nDefault value: "+TAMED_MOB_DEFAULT)
"\nBy default, combat XP from tamed mobs is reduced to zero, but you could change it in the experience config to whatever you want." +
"\nIt's hard to imagine this being abused, but we disable it anyways." +
"\nTamed entities get marked in the same way that spawned mobs do, so they are affected by the same XP modifiers." +
"\nDefault value: " + TAMED_MOB_DEFAULT)
private boolean preventTamedMobXp = TAMED_MOB_DEFAULT;
public boolean getEndermenEndermiteFix() {

View File

@ -14,12 +14,12 @@ public class ConfigAutomatedBackups {
"\nYou can find the backups in the following directory inside your mcMMO folder - \\mcMMO\\backup" +
"\nAutomated backups are deleted regularly once they reach a certain age, see the other options in this config to change this." +
"\nBackups are made whenever you start your server for the first time and on each reload of the mcMMO plugin" +
"\nDefault value: "+ZIP_BACKUPS_ENABLED_DEFAULT)
"\nDefault value: " + ZIP_BACKUPS_ENABLED_DEFAULT)
private boolean zipBackupsEnabled = ZIP_BACKUPS_ENABLED_DEFAULT;
@Setting(value = "Old-File-Age-Limit-In-Days", comment = "How many days should backups be kept in days?" +
"\nBackups older than this are removed if the number of file backups is greater than \"Minimum-Backups\"." +
"\nDefault value: "+ BACKUP_DAY_LIMIT_DEFAULT)
"\nDefault value: " + BACKUP_DAY_LIMIT_DEFAULT)
private int backupDayLimit = BACKUP_DAY_LIMIT_DEFAULT;
public boolean isZipBackupsEnabled() {

View File

@ -8,18 +8,16 @@ public class ConfigCommandsAdminChat {
private static final String ADMIN_CHAT_PREFIX_DEFAULT = "&b[&f{0}&b]";
private static final boolean USE_DISPLAY_NAMES_DEFAULT = true;
@Setting(value = "Admin-Chat-Prefix", comment = "Formatting use at the beginning of an admin chat message." +
"\nYou can use & color codes here or type stuff like [[RED]]." +
"\nDefault value: "+ADMIN_CHAT_PREFIX_DEFAULT)
private String adminChatPrefix = ADMIN_CHAT_PREFIX_DEFAULT;
@Setting(value = "Whether or not to use Display Names for admin chat." +
"\nDisplay names are the current visible name of a player in the scoreboard, chat, and so on." +
"\nThese names are modified by mods and are not necessarily the same nickname that a player has associated with their account." +
"\nIf you turn this off, mcMMO will use a players registered nickname with their Minecraft account instead." +
"\nDefault value: "+USE_DISPLAY_NAMES_DEFAULT)
"\nDefault value: " + USE_DISPLAY_NAMES_DEFAULT)
public boolean useDisplayNames = USE_DISPLAY_NAMES_DEFAULT;
@Setting(value = "Admin-Chat-Prefix", comment = "Formatting use at the beginning of an admin chat message." +
"\nYou can use & color codes here or type stuff like [[RED]]." +
"\nDefault value: " + ADMIN_CHAT_PREFIX_DEFAULT)
private String adminChatPrefix = ADMIN_CHAT_PREFIX_DEFAULT;
public String getAdminChatPrefix() {
return adminChatPrefix;

View File

@ -13,17 +13,17 @@ public class ConfigCommandsInspect {
@Setting(value = "Inspect-Max-Distance", comment = "The maximum range at which players can inspect one another." +
"\nIs only used if limit inspect range is turned on." +
"\nDefault value: "+INSPECT_MAX_DISTANCE_DEFAULT)
"\nDefault value: " + INSPECT_MAX_DISTANCE_DEFAULT)
private double inspectCommandMaxDistance = INSPECT_MAX_DISTANCE_DEFAULT;
@Setting(value = "Limit-Inspect-Range", comment = "Inspection is limited by the distance between players instead of always being usable." +
"Permission to bypass this limit - " + BYPASS_PERMISSION
+"\nDefault value: "+LIMIT_INSPECT_RANGE_DEFAULT)
+ "\nDefault value: " + LIMIT_INSPECT_RANGE_DEFAULT)
private boolean limitInspectRange = LIMIT_INSPECT_RANGE_DEFAULT;
@Setting(value = "Allow-Offline-Inspection", comment = "If set to true players will be able to look at the profiles of anyone on the server whether they are connected or not." +
"\nAdmins and the console can always check the profiles of offline players." +
"\nDefault value: "+ALLOW_OFFLINE_INSPECTION_DEFAULT)
"\nDefault value: " + ALLOW_OFFLINE_INSPECTION_DEFAULT)
private boolean allowInspectOnOfflinePlayers = ALLOW_OFFLINE_INSPECTION_DEFAULT;
public double getInspectCommandMaxDistance() {

View File

@ -10,7 +10,7 @@ public class ConfigDatabaseFlatFile {
@Setting(value = "Scoreboard-Leaderboard-Update-Interval", comment = "How often the scoreboard leaderboards will update." +
"\nThis is an expensive operation, it is highly recommended to avoid doing this often." +
"\nDefault value: "+LEADERBOARD_SCOREBOARD_UPDATE_INTERVAL_MINUTES_DEFAULT)
"\nDefault value: " + LEADERBOARD_SCOREBOARD_UPDATE_INTERVAL_MINUTES_DEFAULT)
private int leaderboardUpdateIntervalMinutes = LEADERBOARD_SCOREBOARD_UPDATE_INTERVAL_MINUTES_DEFAULT;
public int getLeaderboardUpdateIntervalMinutes() {

View File

@ -19,26 +19,26 @@ public class ConfigSectionCleaning {
@Setting(value = "Purge-Old-Users",
comment = "Turn this on to enable automatic database pruning of old users." +
"\nDefault value: "+PURGE_OLD_USERS)
"\nDefault value: " + PURGE_OLD_USERS)
private boolean purgeOldUsers = PURGE_OLD_USERS;
@Setting(value = "Purge-Powerless-Users", comment = "Powerless users are players who have not" +
" leveled up in a single skill." +
"\nDefault value: "+PURGE_POWERLESS_USERS)
"\nDefault value: " + PURGE_POWERLESS_USERS)
private boolean purgePowerlessUsers = PURGE_POWERLESS_USERS;
@Setting(value = "Only-Purge-At-Plugin-Startup",
comment = "If set to true, then purging will only happen when the plugin first loads." +
"\nKeep in mind, this will trigger on reload as well." +
"\nThis purge is on a 2 second delay from plugin start-up and runs in an ASYNC thread." +
"\nDefault value: "+ONLY_PURGE_AT_STARTUP)
"\nDefault value: " + ONLY_PURGE_AT_STARTUP)
private boolean onlyPurgeAtStartup = ONLY_PURGE_AT_STARTUP;
@Setting(value = "Purge-Interval-In-Hours", comment = "How many hours between automatic purging?")
private int purgeInterval = PURGE_INTERVAL_DEFAULT;
@Setting(value = "Old-User-Cutoff-In-Months", comment = "Users who haven't connected in this many months will be purged" +
"\nDefault value: "+OLD_USER_CUTOFF_IN_MONTHS)
"\nDefault value: " + OLD_USER_CUTOFF_IN_MONTHS)
private int oldUserCutoffMonths = OLD_USER_CUTOFF_IN_MONTHS;
/*

View File

@ -12,7 +12,7 @@ public class ConfigSectionDatabaseGeneral {
"\nSaving the database is an expensive operation although it is done in an ASYNC thread." +
"\nI wouldn't recommend setting this value lower than 10 minutes" +
"\nKeep in mind if you properly shut down your server with a stop command mcMMO saves before your server shuts down." +
"\nDefault value: "+SAVE_INTERVAL_MINUTES_DEFAULT)
"\nDefault value: " + SAVE_INTERVAL_MINUTES_DEFAULT)
private int saveIntervalMinutes = SAVE_INTERVAL_MINUTES_DEFAULT;
public int getSaveIntervalMinutes() {

View File

@ -15,13 +15,13 @@ public class ConfigSectionMaxConnections {
* CONFIG NODES
*/
@Setting(value = "Misc-Connection-Limit", comment = "Default value: "+MISC_DEFAULT)
@Setting(value = "Misc-Connection-Limit", comment = "Default value: " + MISC_DEFAULT)
private int misc = 30;
@Setting(value = "Load-Connection-Limit", comment = "Default value: "+LOAD_DEFAULT)
@Setting(value = "Load-Connection-Limit", comment = "Default value: " + LOAD_DEFAULT)
private int load = 30;
@Setting(value = "Save-Connection-Limit", comment = "Default value: "+SAVE_DEFAULT)
@Setting(value = "Save-Connection-Limit", comment = "Default value: " + SAVE_DEFAULT)
private int save = 30;
/*

View File

@ -15,13 +15,13 @@ public class ConfigSectionMaxPoolSize {
* CONFIG NODES
*/
@Setting(value = "Misc-Pool", comment = "Default value: "+MISC_DEFAULT)
@Setting(value = "Misc-Pool", comment = "Default value: " + MISC_DEFAULT)
private int misc = 10;
@Setting(value = "Load-Pool", comment = "Default value: "+LOAD_DEFAULT)
@Setting(value = "Load-Pool", comment = "Default value: " + LOAD_DEFAULT)
private int load = 20;
@Setting(value = "Save-Pool", comment = "Default value: "+SAVE_DEFAULT)
@Setting(value = "Save-Pool", comment = "Default value: " + SAVE_DEFAULT)
private int save = 20;
/*

View File

@ -17,7 +17,7 @@ public class ConfigSectionMySQL {
@Setting(value = "Use-MySQL", comment = "If set to true, mcMMO will use MySQL/MariaDB instead of FlatFile storage" +
"\nIt is highly recommended to use a MySQL/MariaDB server over FlatFile," +
" especially if the number of players on your Minecraft server is fairly high." +
"\nDefault value: "+USE_MYSQL_DEFAULT)
"\nDefault value: " + USE_MYSQL_DEFAULT)
private boolean useMySQL = USE_MYSQL_DEFAULT;
@Setting(value = "User", comment = "Your MySQL User Settings")
@ -53,10 +53,8 @@ public class ConfigSectionMySQL {
* HELPER METHODS
*/
public int getMaxPoolSize(PoolIdentifier poolIdentifier)
{
switch (poolIdentifier)
{
public int getMaxPoolSize(PoolIdentifier poolIdentifier) {
switch (poolIdentifier) {
case LOAD:
return userConfigSectionServer.getConfigSectionMaxPoolSize().getLoad();
case SAVE:
@ -68,10 +66,8 @@ public class ConfigSectionMySQL {
}
}
public int getMaxConnections(PoolIdentifier poolIdentifier)
{
switch (poolIdentifier)
{
public int getMaxConnections(PoolIdentifier poolIdentifier) {
switch (poolIdentifier) {
case LOAD:
return userConfigSectionServer.getConfigSectionMaxConnections().getLoad();
case SAVE:

View File

@ -15,20 +15,20 @@ public class UserConfigSectionServer {
* CONFIG NODES
*/
@Setting(value = "Use-SSL", comment = "Enables SSL for MySQL/MariaDB connections." +
"\nIf your SQL server supports SSL, it is recommended to have it on but not necessary." +
"\nIf you run into any issues involving SSL, its best to just turn this off." +
"\nDefault value: "+USE_SSL_DEFAULT)
@Setting(value = "Use-SSL", comment = "Enables SSL for MySQL/MariaDB connections." +
"\nIf your SQL server supports SSL, it is recommended to have it on but not necessary." +
"\nIf you run into any issues involving SSL, its best to just turn this off." +
"\nDefault value: " + USE_SSL_DEFAULT)
private boolean useSSL = USE_SSL_DEFAULT;
@Setting(value = "Server-Port", comment = "Your MySQL/MariaDB server port" +
"\nThe default port is typically 3306 for MySQL, but every server configuration is different!" +
"\nDefault value: "+SERVER_PORT_DEFAULT)
"\nDefault value: " + SERVER_PORT_DEFAULT)
private int serverPort = SERVER_PORT_DEFAULT;
@Setting(value = "Server-Address", comment = "The address for your MySQL/MariaDB server" +
"If the MySQL server is hosted on the same machine, you can use the localhost alias" +
"\nDefault value: "+SERVER_ADDRESS_DEFAULT)
"\nDefault value: " + SERVER_ADDRESS_DEFAULT)
private String serverAddress = SERVER_ADDRESS_DEFAULT;
@Setting(value = "Max-Connections", comment = "This setting is the max simultaneous MySQL/MariaDB connections allowed at a time." +

View File

@ -14,13 +14,13 @@ public class ConfigAuthorAdvertisements {
comment = "Shows donation info in various mcMMO commands." +
"\nSuch as a paypal link for the author on the /mcmmo command" +
"\nSupport through donations helps keep mcMMO development going." +
"\nDefault value: "+ SHOW_DONATION_DEFAULT)
"\nDefault value: " + SHOW_DONATION_DEFAULT)
private boolean showDonationInfo = SHOW_DONATION_DEFAULT;
@Setting(value = "Show-Patreon-Links",
comment = "Shows patreon links for the mcMMO author in various mcMMO commands." +
"\nSupport through Patreon helps keep mcMMO development going" +
"\nDefault value: "+SHOW_PATREON_DEFAULT)
"\nDefault value: " + SHOW_PATREON_DEFAULT)
private boolean showPatreonInfo = SHOW_PATREON_DEFAULT;
@Setting(value = "Show-Website-Links", comment = "Allows links to various affiliated websites for mcMMO." +
@ -31,7 +31,7 @@ public class ConfigAuthorAdvertisements {
"\nThe mcMMO authors Patreon" +
"\nThe Official mcMMO Spigot Listing" +
"\nThe Official translation website for mcMMO" +
"\nDefault value: "+SHOW_WEBSITE_LINKS_DEFAULT)
"\nDefault value: " + SHOW_WEBSITE_LINKS_DEFAULT)
private boolean showWebsiteLinks = SHOW_WEBSITE_LINKS_DEFAULT;
public boolean isShowDonationInfo() {

View File

@ -23,7 +23,7 @@ public class ConfigExperienceAcrobatics {
@Setting(value = "Feather-Fall-XP-Multiplier", comment = "Feather Fall grants bonus XP to fall related XP gains." +
"\nThis value is multiplied against your XP to give the bonus." +
"\nDefault value: "+FEATHER_FALL_MULTIPLIER_DEFAULT)
"\nDefault value: " + FEATHER_FALL_MULTIPLIER_DEFAULT)
private Double featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT;
public HashMap<String, Integer> getAcrobaticsXPMap() {
@ -34,15 +34,15 @@ public class ConfigExperienceAcrobatics {
return featherFallMultiplier;
}
public int getDodgeXP(){
public int getDodgeXP() {
return acrobaticsXPMap.get("Dodge");
}
public int getRollXP(){
public int getRollXP() {
return acrobaticsXPMap.get("Roll");
}
public int getFallXP(){
public int getFallXP() {
return acrobaticsXPMap.get("Fall");
}

View File

@ -11,11 +11,11 @@ public class ConfigExperienceAlchemy {
private final static HashMap<String, Integer> ALCHEMY_DEFAULT_XP_MAP;
static {
ALCHEMY_DEFAULT_XP_MAP = new HashMap<>();
ALCHEMY_DEFAULT_XP_MAP.put("Stage-One-Potion", 15);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Two-Potion", 30);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Three-Potion", 60);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Four-Potion", 120);
ALCHEMY_DEFAULT_XP_MAP = new HashMap<>();
ALCHEMY_DEFAULT_XP_MAP.put("Stage-One-Potion", 15);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Two-Potion", 30);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Three-Potion", 60);
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Four-Potion", 120);
}
@Setting(value = "Alchemy-Experience-Values", comment = "Experience values for alchemy.")
@ -26,23 +26,19 @@ public class ConfigExperienceAlchemy {
return alchemyXPMap;
}
public int getStageOnePotionXP()
{
public int getStageOnePotionXP() {
return alchemyXPMap.get("Stage-One-Potion");
}
public int getStageTwoPotionXP()
{
public int getStageTwoPotionXP() {
return alchemyXPMap.get("Stage-Two-Potion");
}
public int getStageThreePotionXP()
{
public int getStageThreePotionXP() {
return alchemyXPMap.get("Stage-Three-Potion");
}
public int getStageFourPotionXP()
{
public int getStageFourPotionXP() {
return alchemyXPMap.get("Stage-Four-Potion");
}
@ -52,10 +48,8 @@ public class ConfigExperienceAlchemy {
return 0;
}*/
public int getPotionXPByStage(int potionStage)
{
switch(potionStage)
{
public int getPotionXPByStage(int potionStage) {
switch (potionStage) {
case 1:
return getStageOnePotionXP();
case 2:

View File

@ -13,7 +13,7 @@ public class ConfigExperienceArchery {
"\nThe maximum distance bonus is 50, so expect this multiplier to peak at being multiplied against 50." +
"\nDistance is in blocks traveled." +
"\nThis value is added on to normal XP gains from damage for Archery." +
"\nDefault value: "+DISTANCE_MULTIPLIER_DEFAULT)
"\nDefault value: " + DISTANCE_MULTIPLIER_DEFAULT)
private double distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT;
public double getDistanceMultiplier() {

View File

@ -9,6 +9,7 @@ import java.util.HashMap;
public class ConfigExperienceCombat {
private static final HashMap<String, Double> COMBAT_EXPERIENCE_DEFAULT;
private static final boolean PVP_XP_ENABLED_DEFAULT = false;
static {
COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();
@ -73,14 +74,12 @@ public class ConfigExperienceCombat {
COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0D);
}
private static final boolean PVP_XP_ENABLED_DEFAULT = false;
@Setting(value = "Combat-XP-Multipliers")
private HashMap<String, Double> combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT;
@Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." +
"\nBe careful turning this on as this can potentially allow for unwanted behaviour from players." +
"\nDefault value: "+PVP_XP_ENABLED_DEFAULT)
"\nDefault value: " + PVP_XP_ENABLED_DEFAULT)
private boolean pvpXPEnabled = PVP_XP_ENABLED_DEFAULT;
public boolean isPvpXPEnabled() {

View File

@ -8,8 +8,8 @@ import java.util.HashMap;
@ConfigSerializable
public class ConfigExperienceFishing {
private final static HashMap<String, Integer> FISHING_DEFAULT_XP_MAP;
public static final int SHAKE_XP_DEFAULT = 50;
private final static HashMap<String, Integer> FISHING_DEFAULT_XP_MAP;
static {
FISHING_DEFAULT_XP_MAP = new HashMap<>();

Some files were not shown because too many files have changed in this diff Show More