mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Update code style
This commit is contained in:
parent
dc758a6dfc
commit
02a69cbb05
@ -8,7 +8,8 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public final class AbilityAPI {
|
public final class AbilityAPI {
|
||||||
private AbilityAPI() {}
|
private AbilityAPI() {
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean berserkEnabled(Player player) {
|
public static boolean berserkEnabled(Player player) {
|
||||||
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.BERSERK);
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.BERSERK);
|
||||||
|
@ -10,18 +10,19 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public final class ChatAPI {
|
public final class ChatAPI {
|
||||||
private ChatAPI() {}
|
private ChatAPI() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to all members of a party
|
* Send a message to all members of a party
|
||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin sending the message
|
* @param plugin The plugin sending the message
|
||||||
* @param sender The name of the sender
|
* @param sender The name of the sender
|
||||||
* @param displayName The display name of the sender
|
* @param displayName The display name of the sender
|
||||||
* @param party The name of the party to send to
|
* @param party The name of the party to send to
|
||||||
* @param message The message to send
|
* @param message The message to send
|
||||||
*/
|
*/
|
||||||
public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
|
public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
|
||||||
getPartyChatManager(plugin, party).handleChat(sender, displayName, message);
|
getPartyChatManager(plugin, party).handleChat(sender, displayName, message);
|
||||||
@ -32,9 +33,9 @@ public final class ChatAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin sending the message
|
* @param plugin The plugin sending the message
|
||||||
* @param sender The name of the sender to display in the chat
|
* @param sender The name of the sender to display in the chat
|
||||||
* @param party The name of the party to send to
|
* @param party The name of the party to send to
|
||||||
* @param message The message to send
|
* @param message The message to send
|
||||||
*/
|
*/
|
||||||
public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
|
public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
|
||||||
@ -46,10 +47,10 @@ public final class ChatAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin sending the message
|
* @param plugin The plugin sending the message
|
||||||
* @param sender The name of the sender
|
* @param sender The name of the sender
|
||||||
* @param displayName The display 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) {
|
public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
|
||||||
ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, displayName, message);
|
ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, displayName, message);
|
||||||
@ -60,8 +61,8 @@ public final class ChatAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin sending the message
|
* @param plugin The plugin sending the message
|
||||||
* @param sender The name of the sender to display in the chat
|
* @param sender The name of the sender to display in the chat
|
||||||
* @param message The message to send
|
* @param message The message to send
|
||||||
*/
|
*/
|
||||||
public static void sendAdminChat(Plugin plugin, String sender, String message) {
|
public static void sendAdminChat(Plugin plugin, String sender, String message) {
|
||||||
|
@ -19,7 +19,8 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class ExperienceAPI {
|
public final class ExperienceAPI {
|
||||||
private ExperienceAPI() {}
|
private ExperienceAPI() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether given string is a valid type of skill suitable for the
|
* Returns whether given string is a valid type of skill suitable for the
|
||||||
@ -60,10 +61,9 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 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
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -76,12 +76,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
* @param xpGainReason The reason to gain XP
|
* @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
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
*/
|
*/
|
||||||
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason) {
|
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason) {
|
||||||
@ -93,13 +92,12 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
* @param xpGainReason The reason to gain XP
|
* @param xpGainReason The reason to gain XP
|
||||||
* @param isUnshared true if the XP cannot be shared with party members
|
* @param isUnshared true if the XP cannot be shared with party members
|
||||||
*
|
* @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
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
*/
|
*/
|
||||||
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason, boolean isUnshared) {
|
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason, boolean isUnshared) {
|
||||||
@ -129,15 +127,13 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @deprecated We're using uuids to get an offline player
|
||||||
* replaced by {@link #addRawXPOffline(UUID uuid, String skillType, float XP)}
|
* 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
|
@Deprecated
|
||||||
public static void addRawXPOffline(String playerName, String skillType, float XP) {
|
public static void addRawXPOffline(String playerName, String skillType, float XP) {
|
||||||
@ -149,11 +145,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 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
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
public static void addRawXPOffline(UUID uuid, String skillType, float XP) {
|
public static void addRawXPOffline(UUID uuid, String skillType, float XP) {
|
||||||
@ -165,10 +160,9 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 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
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -181,12 +175,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
* @param xpGainReason The reason to gain XP
|
* @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
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
*/
|
*/
|
||||||
public static void addMultipliedXP(Player player, String skillType, int XP, String xpGainReason) {
|
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.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to add XP to
|
* @param playerName The player to add XP to
|
||||||
* @param skillType The skill 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
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -215,10 +207,9 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 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
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -231,12 +222,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
* @param xpGainReason The reason to gain XP
|
* @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
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
*/
|
*/
|
||||||
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason) {
|
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||||
@ -248,13 +238,12 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
* @param xpGainReason The reason to gain XP
|
* @param xpGainReason The reason to gain XP
|
||||||
* @param isUnshared true if the XP cannot be shared with party members
|
* @param isUnshared true if the XP cannot be shared with party members
|
||||||
*
|
* @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
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
*/
|
*/
|
||||||
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
|
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.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to add XP to
|
* @param playerName The player to add XP to
|
||||||
* @param skillType The skill 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
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -293,10 +281,9 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 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
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -310,12 +297,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
* @param xpGainReason The reason to gain XP
|
* @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
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
*/
|
*/
|
||||||
public static void addXP(Player player, String skillType, int XP, String xpGainReason) {
|
public static void addXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||||
@ -328,13 +314,12 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
* @param xpGainReason The reason to gain XP
|
* @param xpGainReason The reason to gain XP
|
||||||
* @param isUnshared true if the XP cannot be shared with party members
|
* @param isUnshared true if the XP cannot be shared with party members
|
||||||
*
|
* @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
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
*/
|
*/
|
||||||
public static void addXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
|
public static void addXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
|
||||||
@ -351,11 +336,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get XP for
|
||||||
* @return the amount of XP in a given skill
|
* @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
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static int getXP(Player player, String skillType) {
|
public static int getXP(Player player, String skillType) {
|
||||||
@ -368,11 +352,10 @@ public final class ExperienceAPI {
|
|||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to get XP for
|
* @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
|
* @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 InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -385,12 +368,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get XP for
|
||||||
* @return the amount of XP in a given skill
|
* @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 InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static int getOfflineXP(UUID uuid, String skillType) {
|
public static int getOfflineXP(UUID uuid, String skillType) {
|
||||||
@ -402,11 +384,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get XP for
|
||||||
* @return the amount of XP in a given skill
|
* @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
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static float getXPRaw(Player player, String skillType) {
|
public static float getXPRaw(Player player, String skillType) {
|
||||||
@ -419,11 +400,10 @@ public final class ExperienceAPI {
|
|||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to get XP for
|
* @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
|
* @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 InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -436,12 +416,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get XP for
|
||||||
* @return the amount of XP in a given skill
|
* @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 InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static float getOfflineXPRaw(UUID uuid, String skillType) {
|
public static float getOfflineXPRaw(UUID uuid, String skillType) {
|
||||||
@ -453,11 +432,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get the XP amount for
|
||||||
* @return the total amount of XP needed to reach the next level
|
* @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
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static int getXPToNextLevel(Player player, String skillType) {
|
public static int getXPToNextLevel(Player player, String skillType) {
|
||||||
@ -470,11 +448,10 @@ public final class ExperienceAPI {
|
|||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to get XP for
|
* @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
|
* @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 InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -487,12 +464,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get XP for
|
||||||
* @return the total amount of XP needed to reach the next level
|
* @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 InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static int getOfflineXPToNextLevel(UUID uuid, String skillType) {
|
public static int getOfflineXPToNextLevel(UUID uuid, String skillType) {
|
||||||
@ -504,11 +480,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get the XP amount for
|
||||||
* @return the amount of XP remaining until the next level
|
* @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
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static int getXPRemaining(Player player, String skillType) {
|
public static int getXPRemaining(Player player, String skillType) {
|
||||||
@ -525,11 +500,10 @@ public final class ExperienceAPI {
|
|||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to get XP for
|
* @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
|
* @return the 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 InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -545,12 +519,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get XP for
|
||||||
* @return the amount of XP needed to reach the next level
|
* @return the 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 InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static float getOfflineXPRemaining(UUID uuid, String skillType) {
|
public static float getOfflineXPRemaining(UUID uuid, String skillType) {
|
||||||
@ -565,10 +538,9 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 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
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
public static void addLevel(Player player, String skillType, int levels) {
|
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.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to add levels to
|
* @param playerName The player to add levels to
|
||||||
* @param skillType Type of skill 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
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -612,11 +583,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 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
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
public static void addLevelOffline(UUID uuid, String skillType, int levels) {
|
public static void addLevelOffline(UUID uuid, String skillType, int levels) {
|
||||||
@ -643,10 +613,9 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get the level for
|
||||||
* @return the level of a given skill
|
* @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
|
||||||
*/
|
*/
|
||||||
public static int getLevel(Player player, String skillType) {
|
public static int getLevel(Player player, String skillType) {
|
||||||
@ -659,10 +628,9 @@ public final class ExperienceAPI {
|
|||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to get the level for
|
* @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
|
* @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
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -675,11 +643,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param skillType The skill to get the level for
|
||||||
* @return the level of a given skill
|
* @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
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
public static int getLevelOffline(UUID uuid, String skillType) {
|
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
|
* @param playerName The player to get the power level for
|
||||||
* @return the power level of the player
|
* @return the power level of the player
|
||||||
*
|
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -727,7 +693,6 @@ public final class ExperienceAPI {
|
|||||||
*
|
*
|
||||||
* @param uuid The player to get the power level for
|
* @param uuid The player to get the power level for
|
||||||
* @return the power level of the player
|
* @return the power level of the player
|
||||||
*
|
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
public static int getPowerLevelOffline(UUID uuid) {
|
public static int getPowerLevelOffline(UUID uuid) {
|
||||||
@ -748,7 +713,6 @@ public final class ExperienceAPI {
|
|||||||
*
|
*
|
||||||
* @param skillType The skill to get the level cap for
|
* @param skillType The skill to get the level cap for
|
||||||
* @return the level cap of a given skill
|
* @return the level cap of a given skill
|
||||||
*
|
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
public static int getLevelCap(String skillType) {
|
public static int getLevelCap(String skillType) {
|
||||||
@ -762,7 +726,6 @@ public final class ExperienceAPI {
|
|||||||
*
|
*
|
||||||
* @param skillType The skill to get the level cap for
|
* @param skillType The skill to get the level cap for
|
||||||
* @return the level cap of a given skill
|
* @return the level cap of a given skill
|
||||||
*
|
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
public static int getLevelCap(PrimarySkillType skillType) {
|
public static int getLevelCap(PrimarySkillType skillType) {
|
||||||
@ -771,11 +734,11 @@ public final class ExperienceAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether or not a specific skill is level capped
|
* Checks whether or not a specific skill is level capped
|
||||||
|
*
|
||||||
* @param skillType target skill
|
* @param skillType target skill
|
||||||
* @return true if the skill has a level cap
|
* @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);
|
return mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(skillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,13 +759,11 @@ public final class ExperienceAPI {
|
|||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The name of the player to check
|
* @param playerName The name of the player to check
|
||||||
* @param skillType The skill 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
|
* @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
|
@Deprecated
|
||||||
public static int getPlayerRankSkill(String playerName, String skillType) {
|
public static int getPlayerRankSkill(String playerName, String skillType) {
|
||||||
@ -814,14 +775,12 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @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
|
* @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) {
|
public static int getPlayerRankSkill(UUID uuid, String skillType) {
|
||||||
return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(uuid).getName()).get(getNonChildSkillType(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.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The name of the player to check
|
* @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
|
* @return the position on the power level leaderboard
|
||||||
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static int getPlayerRankOverall(String playerName) {
|
public static int getPlayerRankOverall(String playerName) {
|
||||||
@ -849,10 +806,8 @@ public final class ExperienceAPI {
|
|||||||
* This function is designed for API usage.
|
* 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
|
||||||
*
|
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
*
|
|
||||||
* @return the position on the power level leaderboard
|
* @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) {
|
public static int getPlayerRankOverall(UUID uuid) {
|
||||||
return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(uuid).getName()).get(null);
|
return mcMMO.getDatabaseManager().readRank(mcMMO.p.getServer().getOfflinePlayer(uuid).getName()).get(null);
|
||||||
@ -863,10 +818,9 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param player The player to set the level of
|
* @param player 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
|
* @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
|
||||||
*/
|
*/
|
||||||
public static void setLevel(Player player, String skillType, int skillLevel) {
|
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.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to set the level of
|
* @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
|
* @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
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -895,11 +848,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param uuid The player to set the level of
|
* @param uuid 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
|
* @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
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
*/
|
*/
|
||||||
public static void setLevelOffline(UUID uuid, String skillType, int skillLevel) {
|
public static void setLevelOffline(UUID uuid, String skillType, int skillLevel) {
|
||||||
@ -911,11 +863,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to set the XP for
|
||||||
* @param newValue The value to set the XP to
|
* @param newValue The value to set the XP to
|
||||||
*
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static void setXP(Player player, String skillType, int newValue) {
|
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.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to set the XP of
|
* @param playerName The player to set the XP of
|
||||||
* @param skillType The skill to set the XP for
|
* @param skillType The skill to set the XP for
|
||||||
* @param newValue The value to set the XP to
|
* @param newValue The value to set the XP to
|
||||||
*
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -945,12 +895,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to set the XP for
|
||||||
* @param newValue The value to set the XP to
|
* @param newValue The value to set the XP to
|
||||||
*
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static void setXPOffline(UUID uuid, String skillType, int newValue) {
|
public static void setXPOffline(UUID uuid, String skillType, int newValue) {
|
||||||
@ -962,11 +911,10 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to change the XP for
|
||||||
* @param xp The amount of XP to remove
|
* @param xp The amount of XP to remove
|
||||||
*
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static void removeXP(Player player, String skillType, int xp) {
|
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.
|
* This function is designed for API usage.
|
||||||
*
|
*
|
||||||
* @param playerName The player to change the XP of
|
* @param playerName The player to change the XP of
|
||||||
* @param skillType The skill to change the XP for
|
* @param skillType The skill to change the XP for
|
||||||
* @param xp The amount of XP to remove
|
* @param xp The amount of XP to remove
|
||||||
*
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -996,12 +943,11 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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 skillType The skill to change the XP for
|
||||||
* @param xp The amount of XP to remove
|
* @param xp The amount of XP to remove
|
||||||
*
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
|
||||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static void removeXPOffline(UUID uuid, String skillType, int xp) {
|
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.
|
* 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
|
||||||
*
|
|
||||||
* @throws InvalidFormulaTypeException if the given formulaType is not valid
|
* @throws InvalidFormulaTypeException if the given formulaType is not valid
|
||||||
*/
|
*/
|
||||||
public static int getXpNeededToLevel(int level) {
|
public static int getXpNeededToLevel(int level) {
|
||||||
@ -1026,9 +971,8 @@ public final class ExperienceAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param formulaType The formula type to get the amount of XP for
|
||||||
*
|
|
||||||
* @throws InvalidFormulaTypeException if the given formulaType is not valid
|
* @throws InvalidFormulaTypeException if the given formulaType is not valid
|
||||||
*/
|
*/
|
||||||
public static int getXpNeededToLevel(int level, String formulaType) {
|
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
|
* 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 blockStates the blocks to reward XP for
|
||||||
* @param mcMMOPlayer the target player
|
* @param mcMMOPlayer the target player
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer)
|
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer) {
|
||||||
{
|
for (BlockState bs : blockStates) {
|
||||||
for(BlockState bs : blockStates)
|
for (PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||||
{
|
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
|
||||||
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);
|
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
|
* 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 blockStates the blocks to reward XP for
|
||||||
* @param mcMMOPlayer the target player
|
* @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)
|
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||||
{
|
for (BlockState bs : blockStates) {
|
||||||
for(BlockState bs : blockStates)
|
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
|
||||||
{
|
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
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
|
* 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
|
* @param mcMMOPlayer The target player
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer)
|
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) {
|
||||||
{
|
for (PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||||
for(PrimarySkillType skillType : PrimarySkillType.values())
|
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
|
||||||
{
|
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
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
|
* 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 mcMMOPlayer The target player
|
||||||
* @param skillType target primary skill
|
* @param skillType target primary skill
|
||||||
*/
|
*/
|
||||||
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
|
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||||
{
|
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
|
||||||
{
|
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Utility methods follow.
|
// Utility methods follow.
|
||||||
private static void addOfflineXP(UUID playerUniqueId, PrimarySkillType skill, int XP) {
|
private static void addOfflineXP(UUID playerUniqueId, PrimarySkillType skill, int XP) {
|
||||||
PlayerProfile profile = getOfflineProfile(playerUniqueId);
|
PlayerProfile profile = getOfflineProfile(playerUniqueId);
|
||||||
@ -1182,10 +1117,10 @@ public final class ExperienceAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use UserManager::getPlayer(Player player) instead
|
|
||||||
* @param player target player
|
* @param player target player
|
||||||
* @return McMMOPlayer for that player if the profile is loaded, otherwise null
|
* @return McMMOPlayer for that player if the profile is loaded, otherwise null
|
||||||
* @throws McMMOPlayerNotFoundException
|
* @throws McMMOPlayerNotFoundException
|
||||||
|
* @deprecated Use UserManager::getPlayer(Player player) instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private static McMMOPlayer getPlayer(Player player) throws McMMOPlayerNotFoundException {
|
private static McMMOPlayer getPlayer(Player player) throws McMMOPlayerNotFoundException {
|
||||||
|
@ -13,7 +13,8 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public final class PartyAPI {
|
public final class PartyAPI {
|
||||||
private PartyAPI() {}
|
private PartyAPI() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the party a player is in.
|
* 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
|
* @return true if the player is in a party, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean inParty(Player player) {
|
public static boolean inParty(Player player) {
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return UserManager.getPlayer(player).inParty();
|
return UserManager.getPlayer(player).inParty();
|
||||||
@ -75,23 +76,22 @@ public final class PartyAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param partyName The party to add the player to
|
||||||
* @deprecated parties can have limits, use the other method
|
* @deprecated parties can have limits, use the other method
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addToParty(Player player, String partyName) {
|
public static void addToParty(Player player, String partyName) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Party party = PartyManager.getParty(partyName);
|
Party party = PartyManager.getParty(partyName);
|
||||||
|
|
||||||
if (party == null) {
|
if (party == null) {
|
||||||
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
||||||
} else if(mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) {
|
} else if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) {
|
||||||
if(PartyManager.isPartyFull(player, party))
|
if (PartyManager.isPartyFull(player, party)) {
|
||||||
{
|
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -103,15 +103,16 @@ public final class PartyAPI {
|
|||||||
/**
|
/**
|
||||||
* The max party size of the server
|
* The max party size of the server
|
||||||
* Limits are only enforced if the enforcement setting is on
|
* Limits are only enforced if the enforcement setting is on
|
||||||
|
*
|
||||||
* @return the max party size on this server
|
* @return the max party size on this server
|
||||||
*/
|
*/
|
||||||
public static int getMaxPartySize()
|
public static int getMaxPartySize() {
|
||||||
{
|
|
||||||
return mcMMO.getConfigManager().getConfigParty().getPartySizeLimit();
|
return mcMMO.getConfigManager().getConfigParty().getPartySizeLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if parties are currently size capped which is determined by the user config
|
* Checks if parties are currently size capped which is determined by the user config
|
||||||
|
*
|
||||||
* @return true if parties are size capped
|
* @return true if parties are size capped
|
||||||
*/
|
*/
|
||||||
public static boolean isPartySizeCapped() {
|
public static boolean isPartySizeCapped() {
|
||||||
@ -123,14 +124,14 @@ public final class PartyAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param partyName The party to add the player to
|
||||||
* @param bypassLimit if true bypasses party size limits
|
* @param bypassLimit if true bypasses party size limits
|
||||||
*/
|
*/
|
||||||
//TODO: bypasslimit not used?
|
//TODO: bypasslimit not used?
|
||||||
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
|
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Party party = PartyManager.getParty(partyName);
|
Party party = PartyManager.getParty(partyName);
|
||||||
@ -151,7 +152,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
public static void removeFromParty(Player player) {
|
public static void removeFromParty(Player player) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PartyManager.removeFromParty(UserManager.getPlayer(player));
|
PartyManager.removeFromParty(UserManager.getPlayer(player));
|
||||||
@ -174,7 +175,7 @@ public final class PartyAPI {
|
|||||||
* </br>
|
* </br>
|
||||||
* This function is designed for API usage.
|
* 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
|
* @param playerName The playerName to set as leader
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -7,7 +7,8 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class SkillAPI {
|
public final class SkillAPI {
|
||||||
private SkillAPI() {}
|
private SkillAPI() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of strings with mcMMO's skills
|
* Returns a list of strings with mcMMO's skills
|
||||||
|
@ -41,26 +41,22 @@ public abstract class ChatManager {
|
|||||||
* Party Chat Spying
|
* Party Chat Spying
|
||||||
* Party messages will be copied to people with the mcmmo.admin.chatspy permission node
|
* 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
|
//We need to grab the party chat name
|
||||||
McMMOPartyChatEvent partyChatEvent = (McMMOPartyChatEvent) event;
|
McMMOPartyChatEvent partyChatEvent = (McMMOPartyChatEvent) event;
|
||||||
|
|
||||||
//Find the people with permissions
|
//Find the people with permissions
|
||||||
for(McMMOPlayer mcMMOPlayer : UserManager.getPlayers())
|
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||||
{
|
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
//Check for toggled players
|
//Check for toggled players
|
||||||
if(mcMMOPlayer.isPartyChatSpying())
|
if (mcMMOPlayer.isPartyChatSpying()) {
|
||||||
{
|
|
||||||
Party adminParty = mcMMOPlayer.getParty();
|
Party adminParty = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
//Only message admins not part of this party
|
//Only message admins not part of this party
|
||||||
if(adminParty != null)
|
if (adminParty != null) {
|
||||||
{
|
|
||||||
//TODO: Incorporate JSON
|
//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));
|
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
|
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
|
||||||
|
@ -70,17 +70,14 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
|
|
||||||
materialNames.get(type).add(materialName);
|
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("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");
|
mcMMO.p.getLogger().warning("Copy and paste latest.log to " + importFile.getParentFile().getAbsolutePath() + " and rename it to import.log");
|
||||||
return;
|
return;
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
tryClose(in);
|
tryClose(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,8 +111,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
c.close();
|
c.close();
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,14 +196,11 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
String skillName = "UNIDENTIFIED";
|
String skillName = "UNIDENTIFIED";
|
||||||
if (materialName.contains("ORE")) {
|
if (materialName.contains("ORE")) {
|
||||||
skillName = "Mining";
|
skillName = "Mining";
|
||||||
}
|
} else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
|
||||||
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
|
|
||||||
skillName = "Woodcutting";
|
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";
|
skillName = "Herbalism";
|
||||||
}
|
} else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
|
||||||
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
|
|
||||||
skillName = "Excavation";
|
skillName = "Excavation";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,8 +215,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (skillName.equals("Mining")) {
|
if (skillName.equals("Mining")) {
|
||||||
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
|
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
|
||||||
}
|
} else if (skillName.equals("Woodcutting")) {
|
||||||
else if (skillName.equals("Woodcutting")) {
|
|
||||||
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
|
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,20 +231,15 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
String toolType = "UNIDENTIFIED";
|
String toolType = "UNIDENTIFIED";
|
||||||
if (materialName.contains("PICKAXE")) {
|
if (materialName.contains("PICKAXE")) {
|
||||||
toolType = "Pickaxes";
|
toolType = "Pickaxes";
|
||||||
}
|
} else if (materialName.contains("AXE")) {
|
||||||
else if (materialName.contains("AXE")) {
|
|
||||||
toolType = "Axes";
|
toolType = "Axes";
|
||||||
}
|
} else if (materialName.contains("BOW")) {
|
||||||
else if (materialName.contains("BOW")) {
|
|
||||||
toolType = "Bows";
|
toolType = "Bows";
|
||||||
}
|
} else if (materialName.contains("HOE")) {
|
||||||
else if (materialName.contains("HOE")) {
|
|
||||||
toolType = "Hoes";
|
toolType = "Hoes";
|
||||||
}
|
} else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
|
||||||
else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
|
|
||||||
toolType = "Shovels";
|
toolType = "Shovels";
|
||||||
}
|
} else if (materialName.contains("SWORD")) {
|
||||||
else if (materialName.contains("SWORD")) {
|
|
||||||
toolType = "Swords";
|
toolType = "Swords";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,14 +266,11 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
String toolType = "UNIDENTIFIED";
|
String toolType = "UNIDENTIFIED";
|
||||||
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
|
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
|
||||||
toolType = "Boots";
|
toolType = "Boots";
|
||||||
}
|
} else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
|
||||||
else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
|
|
||||||
toolType = "Chestplates";
|
toolType = "Chestplates";
|
||||||
}
|
} else if (materialName.contains("HELM") || materialName.contains("HAT")) {
|
||||||
else if (materialName.contains("HELM") || materialName.contains("HAT")) {
|
|
||||||
toolType = "Helmets";
|
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";
|
toolType = "Leggings";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,6 @@ public class McconvertCommand implements TabExecutor {
|
|||||||
private static final List<String> DATABASE_TYPES;
|
private static final List<String> DATABASE_TYPES;
|
||||||
private static final List<String> SUBCOMMANDS = ImmutableList.of("database", "experience");
|
private static final List<String> SUBCOMMANDS = ImmutableList.of("database", "experience");
|
||||||
|
|
||||||
private CommandExecutor databaseConvertCommand = new ConvertDatabaseCommand();
|
|
||||||
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ArrayList<String> formulaTypes = new ArrayList<>();
|
ArrayList<String> formulaTypes = new ArrayList<>();
|
||||||
ArrayList<String> databaseTypes = 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
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
|
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
|
||||||
return databaseConvertCommand.onCommand(sender, command, label, args);
|
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);
|
return experienceConvertCommand.onCommand(sender, command, label, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class McmmoCommand implements CommandExecutor {
|
|||||||
|
|
||||||
private void displayOtherCommands(CommandSender sender) {
|
private void displayOtherCommands(CommandSender sender) {
|
||||||
//Don't show them this category if they have none of the permissions
|
//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;
|
return;
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
|
||||||
|
@ -19,7 +19,7 @@ public class McnotifyCommand implements TabExecutor {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
|
|
||||||
//Not Loaded yet
|
//Not Loaded yet
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null)
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
|
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
|
||||||
|
@ -71,7 +71,10 @@ public abstract class ToggleCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract boolean hasOtherPermission(CommandSender sender);
|
protected abstract boolean hasOtherPermission(CommandSender sender);
|
||||||
|
|
||||||
protected abstract boolean hasSelfPermission(CommandSender sender);
|
protected abstract boolean hasSelfPermission(CommandSender sender);
|
||||||
|
|
||||||
protected abstract void applyCommandAction(McMMOPlayer mcMMOPlayer);
|
protected abstract void applyCommandAction(McMMOPlayer mcMMOPlayer);
|
||||||
|
|
||||||
protected abstract void sendSuccessMessage(CommandSender sender, String playerName);
|
protected abstract void sendSuccessMessage(CommandSender sender, String playerName);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
if (!args[0].equalsIgnoreCase("reset") && !args[0].equalsIgnoreCase("clear")) {
|
if (!args[0].equalsIgnoreCase("reset") && !args[0].equalsIgnoreCase("clear")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,12 +36,11 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMO.p.isXPEventEnabled()) {
|
if (mcMMO.p.isXPEventEnabled()) {
|
||||||
|
|
||||||
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
|
if (AdvancedConfig.getInstance().useTitlesForXPEvent()) {
|
||||||
{
|
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Stop"),
|
LocaleLoader.getString("Commands.Event.Stop"),
|
||||||
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
|
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
|
||||||
10, 10*20, 20);
|
10, 10 * 20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
||||||
@ -65,36 +64,31 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (CommandUtils.shouldDisableToggle(args[1])) {
|
if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||||
mcMMO.p.setXPEventEnabled(false);
|
mcMMO.p.setXPEventEnabled(false);
|
||||||
}
|
} else if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||||
else if (CommandUtils.shouldEnableToggle(args[1])) {
|
|
||||||
mcMMO.p.setXPEventEnabled(true);
|
mcMMO.p.setXPEventEnabled(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newXpRate = Integer.parseInt(args[0]);
|
int newXpRate = Integer.parseInt(args[0]);
|
||||||
|
|
||||||
if(newXpRate < 0)
|
if (newXpRate < 0) {
|
||||||
{
|
sender.sendMessage(ChatColor.RED + LocaleLoader.getString("Commands.NegativeNumberWarn"));
|
||||||
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExperienceConfig.getInstance().setGlobalXPMultiplier(newXpRate);
|
ExperienceConfig.getInstance().setGlobalXPMultiplier(newXpRate);
|
||||||
|
|
||||||
if (mcMMO.p.isXPEventEnabled()) {
|
if (mcMMO.p.isXPEventEnabled()) {
|
||||||
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
|
if (AdvancedConfig.getInstance().useTitlesForXPEvent()) {
|
||||||
{
|
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Start"),
|
LocaleLoader.getString("Commands.Event.Start"),
|
||||||
LocaleLoader.getString("Commands.Event.XP", newXpRate),
|
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.Start"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate));
|
sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class ChatCommand implements TabExecutor {
|
public abstract class ChatCommand implements TabExecutor {
|
||||||
private ChatMode chatMode;
|
|
||||||
protected ChatManager chatManager;
|
protected ChatManager chatManager;
|
||||||
|
private ChatMode chatMode;
|
||||||
|
|
||||||
public ChatCommand(ChatMode chatMode) {
|
public ChatCommand(ChatMode chatMode) {
|
||||||
this.chatMode = chatMode;
|
this.chatMode = chatMode;
|
||||||
@ -47,8 +47,7 @@ public abstract class ChatCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMOPlayer.isChatEnabled(chatMode)) {
|
if (mcMMOPlayer.isChatEnabled(chatMode)) {
|
||||||
disableChatMode(mcMMOPlayer, sender);
|
disableChatMode(mcMMOPlayer, sender);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
enableChatMode(mcMMOPlayer, sender);
|
enableChatMode(mcMMOPlayer, sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public class PartyChatCommand extends ChatCommand {
|
|||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
party = UserManager.getPlayer((Player) sender).getParty();
|
party = UserManager.getPlayer((Player) sender).getParty();
|
||||||
@ -38,8 +38,7 @@ public class PartyChatCommand extends ChatCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message = buildChatMessage(args, 0);
|
message = buildChatMessage(args, 0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
|
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
|
||||||
return;
|
return;
|
||||||
|
@ -41,8 +41,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
|
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
|
||||||
}
|
} catch (Throwable e) {
|
||||||
catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
|
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
|
||||||
return true;
|
return true;
|
||||||
|
@ -26,8 +26,7 @@ public class McremoveCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMO.getDatabaseManager().removeUser(playerName)) {
|
if (mcMMO.getDatabaseManager().removeUser(playerName)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", 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.
|
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,12 +25,11 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
profile.addXp(skill, value);
|
profile.addXp(skill, value);
|
||||||
profile.scheduleAsyncSave();
|
profile.scheduleAsyncSave();
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,14 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class ExperienceCommand implements TabExecutor {
|
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
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
PrimarySkillType skill;
|
PrimarySkillType skill;
|
||||||
@ -45,15 +53,13 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
skill = null;
|
skill = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill != null && skill.isChildSkill())
|
if (skill != null && skill.isChildSkill()) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(sender.getName()) == null)
|
if (UserManager.getPlayer(sender.getName()) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -78,8 +84,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
skill = null;
|
skill = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skill != null && skill.isChildSkill())
|
if (skill != null && skill.isChildSkill()) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -103,8 +108,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editValues(null, profile, skill, value);
|
editValues(null, profile, skill, value);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value);
|
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 permissionsCheckSelf(CommandSender sender);
|
||||||
|
|
||||||
protected abstract boolean permissionsCheckOthers(CommandSender sender);
|
protected abstract boolean permissionsCheckOthers(CommandSender sender);
|
||||||
|
|
||||||
protected abstract void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value);
|
protected abstract void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value);
|
||||||
|
|
||||||
protected abstract void handlePlayerMessageAll(Player player, int value);
|
protected abstract void handlePlayerMessageAll(Player player, int value);
|
||||||
|
|
||||||
protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill);
|
protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill);
|
||||||
|
|
||||||
private boolean validateArguments(CommandSender sender, String skillName, String value) {
|
private boolean validateArguments(CommandSender sender, String skillName, String value) {
|
||||||
return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName)));
|
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) {
|
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
@ -157,8 +156,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
handlePlayerMessageAll(player, value);
|
handlePlayerMessageAll(player, value);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
handleCommand(player, profile, skill, value);
|
handleCommand(player, profile, skill, value);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
@ -27,6 +27,14 @@ import java.util.UUID;
|
|||||||
* value/quantity argument is removed.
|
* value/quantity argument is removed.
|
||||||
*/
|
*/
|
||||||
public class SkillresetCommand implements TabExecutor {
|
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
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
PrimarySkillType skill;
|
PrimarySkillType skill;
|
||||||
@ -47,8 +55,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (args[0].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("all")) {
|
||||||
skill = null;
|
skill = null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
skill = PrimarySkillType.getSkill(args[1]);
|
skill = PrimarySkillType.getSkill(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,8 +74,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (args[1].equalsIgnoreCase("all")) {
|
if (args[1].equalsIgnoreCase("all")) {
|
||||||
skill = null;
|
skill = null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
skill = PrimarySkillType.getSkill(args[1]);
|
skill = PrimarySkillType.getSkill(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,8 +95,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editValues(null, profile, skill);
|
editValues(null, profile, skill);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
|
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,15 +154,6 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
return skillName.equalsIgnoreCase("all") || !CommandUtils.isInvalidSkill(sender, skillName);
|
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) {
|
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill) {
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
@ -167,8 +163,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
handlePlayerMessageAll(player);
|
handlePlayerMessageAll(player);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
handleCommand(player, profile, skill);
|
handleCommand(player, profile, skill);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
@ -17,8 +17,7 @@ public class PartyAcceptCommand implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class PartyChangePasswordCommand implements CommandExecutor {
|
public class PartyChangePasswordCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
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"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -39,29 +39,29 @@ public class PartyCommand implements TabExecutor {
|
|||||||
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
|
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandExecutor partyJoinCommand = new PartyJoinCommand();
|
private CommandExecutor partyJoinCommand = new PartyJoinCommand();
|
||||||
private CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
|
private CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
|
||||||
private CommandExecutor partyCreateCommand = new PartyCreateCommand();
|
private CommandExecutor partyCreateCommand = new PartyCreateCommand();
|
||||||
private CommandExecutor partyQuitCommand = new PartyQuitCommand();
|
private CommandExecutor partyQuitCommand = new PartyQuitCommand();
|
||||||
private CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
|
private CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
|
||||||
private CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
|
private CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
|
||||||
private CommandExecutor partyInviteCommand = new PartyInviteCommand();
|
private CommandExecutor partyInviteCommand = new PartyInviteCommand();
|
||||||
private CommandExecutor partyKickCommand = new PartyKickCommand();
|
private CommandExecutor partyKickCommand = new PartyKickCommand();
|
||||||
private CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
|
private CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
|
||||||
private CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
|
private CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
|
||||||
private CommandExecutor partyLockCommand = new PartyLockCommand();
|
private CommandExecutor partyLockCommand = new PartyLockCommand();
|
||||||
private CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand();
|
private CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand();
|
||||||
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
|
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
|
||||||
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
|
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
|
||||||
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
|
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
|
||||||
private CommandExecutor partyTeleportCommand = new PtpCommand();
|
private CommandExecutor partyTeleportCommand = new PtpCommand();
|
||||||
private CommandExecutor partyChatCommand = new PartyChatCommand();
|
private CommandExecutor partyChatCommand = new PartyChatCommand();
|
||||||
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
|
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
//If the party system is disabled, don't fire this command
|
//If the party system is disabled, don't fire this command
|
||||||
if(!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled())
|
if (!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (CommandUtils.noConsoleUsage(sender)) {
|
if (CommandUtils.noConsoleUsage(sender)) {
|
||||||
@ -79,8 +79,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -210,8 +209,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
//Not Loaded
|
//Not Loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ public class PartyCreateCommand implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,7 @@ public class PartyDisbandCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -69,8 +68,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (isUnlockedFeature(party, partyFeature)) {
|
if (isUnlockedFeature(party, partyFeature)) {
|
||||||
unlockedPartyFeatures.add(partyFeature.getLocaleString());
|
unlockedPartyFeatures.add(partyFeature.getLocaleString());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
|
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,7 +125,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
int membersOnline = party.getVisibleMembers(player).size();
|
int membersOnline = party.getVisibleMembers(player).size();
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));
|
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));
|
player.sendMessage(party.createMembersList(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,7 @@ public class PartyInviteCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getPlayer();
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -53,12 +52,11 @@ public class PartyInviteCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Party playerParty = mcMMOPlayer.getParty();
|
Party playerParty = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if(mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
|
if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
|
||||||
if(PartyManager.isPartyFull(target, playerParty))
|
if (PartyManager.isPartyFull(target, playerParty)) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite",
|
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite",
|
||||||
target.getName(), playerParty.toString(),
|
target.getName(), playerParty.toString(),
|
||||||
mcMMO.getConfigManager().getConfigParty().getPartySizeLimit()));
|
mcMMO.getConfigManager().getConfigParty().getPartySizeLimit()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class PartyItemShareCommand implements CommandExecutor {
|
public class PartyItemShareCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
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"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -47,19 +46,16 @@ public class PartyItemShareCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (CommandUtils.shouldEnableToggle(args[2])) {
|
if (CommandUtils.shouldEnableToggle(args[2])) {
|
||||||
toggle = true;
|
toggle = true;
|
||||||
}
|
} else if (CommandUtils.shouldDisableToggle(args[2])) {
|
||||||
else if (CommandUtils.shouldDisableToggle(args[2])) {
|
|
||||||
toggle = false;
|
toggle = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
handleToggleItemShareCategory(party, ItemShareType.valueOf(args[1].toUpperCase()), toggle);
|
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>"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,8 +34,7 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -62,9 +61,8 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
|
if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
|
||||||
if(PartyManager.isPartyFull(player, targetParty))
|
if (PartyManager.isPartyFull(player, targetParty)) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ public class PartyKickCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,7 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
case 1:
|
case 1:
|
||||||
if (args[0].equalsIgnoreCase("lock")) {
|
if (args[0].equalsIgnoreCase("lock")) {
|
||||||
togglePartyLock(sender, true);
|
togglePartyLock(sender, true);
|
||||||
}
|
} else if (args[0].equalsIgnoreCase("unlock")) {
|
||||||
else if (args[0].equalsIgnoreCase("unlock")) {
|
|
||||||
togglePartyLock(sender, false);
|
togglePartyLock(sender, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,11 +31,9 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (CommandUtils.shouldEnableToggle(args[1])) {
|
if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||||
togglePartyLock(sender, true);
|
togglePartyLock(sender, true);
|
||||||
}
|
} else if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||||
else if (CommandUtils.shouldDisableToggle(args[1])) {
|
|
||||||
togglePartyLock(sender, false);
|
togglePartyLock(sender, false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sendUsageStrings(sender);
|
sendUsageStrings(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,8 +51,7 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void togglePartyLock(CommandSender sender, boolean lock) {
|
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"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ public class PartyQuitCommand implements CommandExecutor {
|
|||||||
case 1:
|
case 1:
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,20 +30,15 @@ public enum PartySubcommandType {
|
|||||||
|
|
||||||
if (commandName.equalsIgnoreCase("?")) {
|
if (commandName.equalsIgnoreCase("?")) {
|
||||||
return HELP;
|
return HELP;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
|
||||||
else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
|
|
||||||
return QUIT;
|
return QUIT;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("leader")) {
|
||||||
else if (commandName.equalsIgnoreCase("leader")) {
|
|
||||||
return OWNER;
|
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;
|
return XPSHARE;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
|
||||||
else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
|
|
||||||
return ITEMSHARE;
|
return ITEMSHARE;
|
||||||
}
|
} else if (commandName.equalsIgnoreCase("ally")) {
|
||||||
else if (commandName.equalsIgnoreCase("ally")) {
|
|
||||||
return ALLIANCE;
|
return ALLIANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class PartyXpShareCommand implements CommandExecutor {
|
public class PartyXpShareCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
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"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -33,11 +32,9 @@ public class PartyXpShareCommand implements CommandExecutor {
|
|||||||
case 2:
|
case 2:
|
||||||
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
|
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
|
||||||
handleChangingShareMode(party, ShareMode.NONE);
|
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);
|
handleChangingShareMode(party, ShareMode.EQUAL);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,7 @@ public class PartyAllianceAcceptCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PartyAllianceCommand implements TabExecutor {
|
public class PartyAllianceCommand implements TabExecutor {
|
||||||
|
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
|
||||||
private Player player;
|
private Player player;
|
||||||
private Party playerParty;
|
private Party playerParty;
|
||||||
private Party targetParty;
|
private Party targetParty;
|
||||||
|
|
||||||
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
|
|
||||||
|
|
||||||
private CommandExecutor partyAllianceInviteCommand = new PartyAllianceInviteCommand();
|
private CommandExecutor partyAllianceInviteCommand = new PartyAllianceInviteCommand();
|
||||||
private CommandExecutor partyAllianceAcceptCommand = new PartyAllianceAcceptCommand();
|
private CommandExecutor partyAllianceAcceptCommand = new PartyAllianceAcceptCommand();
|
||||||
private CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
|
private CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
|
||||||
@ -36,8 +34,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,7 @@ public class PartyAllianceDisbandCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getPlayer();
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,7 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (ptpRecord.isConfirmRequired()) {
|
if (ptpRecord.isConfirmRequired()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -55,8 +54,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||||
return true;
|
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()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,64 @@ public class PtpCommand implements TabExecutor {
|
|||||||
private CommandExecutor ptpAcceptAnyCommand = new PtpAcceptAnyCommand();
|
private CommandExecutor ptpAcceptAnyCommand = new PtpAcceptAnyCommand();
|
||||||
private CommandExecutor ptpAcceptCommand = new PtpAcceptCommand();
|
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
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (CommandUtils.noConsoleUsage(sender)) {
|
if (CommandUtils.noConsoleUsage(sender)) {
|
||||||
@ -44,22 +102,20 @@ public class PtpCommand implements TabExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
{
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(player.getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(player.getWorld()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (!UserManager.hasPlayerDataKey(player)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
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()));
|
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<>(TELEPORT_SUBCOMMANDS.size()));
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return ImmutableList.of();
|
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.Request1", player.getName()));
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", mcMMO.getConfigManager().getConfigParty().getPTP().getPtpRequestTimeout()));
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,7 @@ public class PtpToggleCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if (ptpRecord.isEnabled()) {
|
if (ptpRecord.isEnabled()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,8 +65,7 @@ public class InspectCommand implements TabExecutor {
|
|||||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Player target = mcMMOPlayer.getPlayer();
|
Player target = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
|
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
|
||||||
@ -74,8 +73,7 @@ public class InspectCommand implements TabExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
||||||
else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -58,8 +57,7 @@ public class MccooldownCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (seconds <= 0) {
|
if (seconds <= 0) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getName()));
|
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getName()));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getName(), seconds));
|
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getName(), seconds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
if (CommandUtils.tooFar(sender, player, Permissions.mcrankFar(sender))) {
|
if (CommandUtils.tooFar(sender, player, Permissions.mcrankFar(sender))) {
|
||||||
return true;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,8 +90,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||||
|
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,7 @@ public class McstatsCommand implements TabExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -53,8 +52,7 @@ public class McstatsCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevel().isLevelCapEnabled()) {
|
if (mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevel().isLevelCapEnabled()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
|
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
|
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,26 +54,25 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
|
|
||||||
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
|
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
|
||||||
|
|
||||||
if(abstractSubSkill != null)
|
if (abstractSubSkill != null) {
|
||||||
{
|
|
||||||
double rollChance, graceChance;
|
double rollChance, graceChance;
|
||||||
|
|
||||||
//Chance to roll at half
|
//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
|
//Chance to graceful roll
|
||||||
RandomChanceSkill grace_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
|
RandomChanceSkill grace_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
|
||||||
grace_rcs.setSkillLevel(grace_rcs.getSkillLevel() * 2); //Double Odds
|
grace_rcs.setSkillLevel(grace_rcs.getSkillLevel() * 2); //Double Odds
|
||||||
|
|
||||||
//Chance Stat Calculations
|
//Chance Stat Calculations
|
||||||
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
|
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
|
||||||
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
||||||
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
||||||
|
|
||||||
String[] rollStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_ROLL);
|
String[] rollStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_ROLL);
|
||||||
|
|
||||||
//Format
|
//Format
|
||||||
double rollChanceLucky = rollChance * 1.333D;
|
double rollChanceLucky = rollChance * 1.333D;
|
||||||
double graceChanceLucky = graceChance * 1.333D;
|
double graceChanceLucky = graceChance * 1.333D;
|
||||||
|
|
||||||
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
|
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
|
||||||
|
@ -18,8 +18,8 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
private String brewSpeed;
|
private String brewSpeed;
|
||||||
private String brewSpeedLucky;
|
private String brewSpeedLucky;
|
||||||
|
|
||||||
private int tier;
|
private int tier;
|
||||||
private int ingredientCount;
|
private int ingredientCount;
|
||||||
private String ingredientList;
|
private String ingredientList;
|
||||||
|
|
||||||
private boolean canCatalysis;
|
private boolean canCatalysis;
|
||||||
@ -31,10 +31,9 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
|
|
||||||
protected String[] calculateAbilityDisplayValues(Player player) {
|
protected String[] calculateAbilityDisplayValues(Player player) {
|
||||||
//TODO: Needed?
|
//TODO: Needed?
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
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();
|
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
||||||
|
@ -74,7 +74,7 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
|
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,
|
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK))));
|
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK))));
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
|
+ (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,
|
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.AXES_AXES_LIMIT_BREAK))));
|
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.AXES_AXES_LIMIT_BREAK))));
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(totalEnchantChance >= 1)
|
if (totalEnchantChance >= 1)
|
||||||
magicChance = percent.format(totalEnchantChance / 100.0);
|
magicChance = percent.format(totalEnchantChance / 100.0);
|
||||||
else
|
else
|
||||||
magicChance = percent.format(0);
|
magicChance = percent.format(0);
|
||||||
@ -116,8 +116,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
biteChance = percent.format((rawBiteChance * 100.0D) * luckyModifier);
|
biteChance = percent.format((rawBiteChance * 100.0D) * luckyModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canInnerPeace)
|
if (canInnerPeace) {
|
||||||
{
|
|
||||||
innerPeaceMult = String.valueOf(fishingManager.getInnerPeaceMultiplier());
|
innerPeaceMult = String.valueOf(fishingManager.getInnerPeaceMultiplier());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,7 +155,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
|
|
||||||
if (canShake) {
|
if (canShake) {
|
||||||
messages.add(getStatMessage(SubSkillType.FISHING_SHAKE, shakeChance)
|
messages.add(getStatMessage(SubSkillType.FISHING_SHAKE, shakeChance)
|
||||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shakeChanceLucky) : ""));
|
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shakeChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canTreasureHunt) {
|
if (canTreasureHunt) {
|
||||||
@ -170,8 +169,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
String.valueOf(recordTreasure)));
|
String.valueOf(recordTreasure)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canInnerPeace)
|
if (canInnerPeace) {
|
||||||
{
|
|
||||||
messages.add(getStatMessage(SubSkillType.FISHING_INNER_PEACE, innerPeaceMult));
|
messages.add(getStatMessage(SubSkillType.FISHING_INNER_PEACE, innerPeaceMult));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (canGreenThumbPlants) {
|
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) {
|
if (hasHylianLuck) {
|
||||||
|
@ -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)));
|
//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(getStatMessage(SubSkillType.MINING_DEMOLITIONS_EXPERTISE, blastDamageDecrease));
|
||||||
//messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
|
//messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
|
||||||
}
|
}
|
||||||
|
@ -27,26 +27,22 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
/*
|
/*
|
||||||
* Only allow players to use this command
|
* Only allow players to use this command
|
||||||
*/
|
*/
|
||||||
if(commandSender instanceof Player)
|
if (commandSender instanceof Player) {
|
||||||
{
|
if (args.length < 1)
|
||||||
if(args.length < 1)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Player player = (Player) commandSender;
|
Player player = (Player) commandSender;
|
||||||
if(Permissions.mmoinfo(player))
|
if (Permissions.mmoinfo(player)) {
|
||||||
{
|
if (args == null || args[0] == null)
|
||||||
if(args == null || args[0] == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase( "???"))
|
if (args[0].equalsIgnoreCase("???")) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Mystery"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Mystery"));
|
||||||
return true;
|
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]);
|
displayInfo(player, args[0]);
|
||||||
return true;
|
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
|
//Check to see if the skill exists in the new system
|
||||||
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName(subSkillName);
|
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName(subSkillName);
|
||||||
if(abstractSubSkill != null)
|
if (abstractSubSkill != null) {
|
||||||
{
|
|
||||||
/* New System Skills are programmable */
|
/* New System Skills are programmable */
|
||||||
abstractSubSkill.printInfo(player);
|
abstractSubSkill.printInfo(player);
|
||||||
//TextComponentFactory.sendPlayerUrlHeader(player);
|
//TextComponentFactory.sendPlayerUrlHeader(player);
|
||||||
@ -89,9 +83,8 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(SubSkillType subSkillType : SubSkillType.values())
|
for (SubSkillType subSkillType : SubSkillType.values()) {
|
||||||
{
|
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(subSkillName))
|
||||||
if(subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(subSkillName))
|
|
||||||
subSkillName = subSkillType.getWikiName(subSkillType.toString());
|
subSkillName = subSkillType.getWikiName(subSkillType.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,9 @@ import java.util.Set;
|
|||||||
|
|
||||||
public abstract class SkillCommand implements TabExecutor {
|
public abstract class SkillCommand implements TabExecutor {
|
||||||
protected PrimarySkillType skill;
|
protected PrimarySkillType skill;
|
||||||
private String skillName;
|
|
||||||
|
|
||||||
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||||
protected DecimalFormat decimal = new DecimalFormat("##0.00");
|
protected DecimalFormat decimal = new DecimalFormat("##0.00");
|
||||||
|
private String skillName;
|
||||||
private CommandExecutor skillGuideCommand;
|
private CommandExecutor skillGuideCommand;
|
||||||
|
|
||||||
public SkillCommand(PrimarySkillType skill) {
|
public SkillCommand(PrimarySkillType skill) {
|
||||||
@ -46,6 +44,15 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
skillGuideCommand = new SkillGuideCommand(skill);
|
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
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (CommandUtils.noConsoleUsage(sender)) {
|
if (CommandUtils.noConsoleUsage(sender)) {
|
||||||
@ -56,8 +63,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
{
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -72,9 +78,8 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
float skillValue = mcMMOPlayer.getSkillLevel(skill);
|
float skillValue = mcMMOPlayer.getSkillLevel(skill);
|
||||||
|
|
||||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||||
if(AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
|
if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
|
||||||
for(int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++) {
|
||||||
{
|
|
||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,8 +110,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
|
|
||||||
//Link Header
|
//Link Header
|
||||||
if(mcMMO.getConfigManager().getConfigAds().isShowWebsiteLinks())
|
if (mcMMO.getConfigManager().getConfigAds().isShowWebsiteLinks()) {
|
||||||
{
|
|
||||||
player.sendMessage(LocaleLoader.getString("Overhaul.mcMMO.Header"));
|
player.sendMessage(LocaleLoader.getString("Overhaul.mcMMO.Header"));
|
||||||
TextComponentFactory.sendPlayerUrlHeader(player);
|
TextComponentFactory.sendPlayerUrlHeader(player);
|
||||||
}
|
}
|
||||||
@ -114,7 +118,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled()
|
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled()
|
||||||
&& mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes()
|
&& mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes()
|
||||||
.getConfigSectionSkillBoard().isUseThisBoard()) {
|
.getConfigSectionSkillBoard().isUseThisBoard()) {
|
||||||
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,8 +150,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
||||||
|
|
||||||
if(!skill.isChildSkill())
|
if (!skill.isChildSkill()) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* NON-CHILD SKILLS
|
* NON-CHILD SKILLS
|
||||||
*/
|
*/
|
||||||
@ -173,10 +176,8 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
StringBuilder parentMessage = new StringBuilder();
|
StringBuilder parentMessage = new StringBuilder();
|
||||||
|
|
||||||
for(int i = 0; i < parentList.size(); i++)
|
for (int i = 0; i < parentList.size(); i++) {
|
||||||
{
|
if (i + 1 < parentList.size()) {
|
||||||
if(i+1 < parentList.size())
|
|
||||||
{
|
|
||||||
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||||
parentMessage.append(ChatColor.GRAY + ", ");
|
parentMessage.append(ChatColor.GRAY + ", ");
|
||||||
} else {
|
} else {
|
||||||
@ -237,11 +238,9 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
if(abilityLengthCap <= 0)
|
if (abilityLengthCap <= 0) {
|
||||||
{
|
|
||||||
length = 2 + (int) (skillValue / abilityLengthVar);
|
length = 2 + (int) (skillValue / abilityLengthVar);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
|
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,38 +250,25 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
length = Math.min(length, maxLength);
|
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);
|
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 templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
|
||||||
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
||||||
|
|
||||||
if(isCustom)
|
if (isCustom)
|
||||||
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
|
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
String[] mergedList = addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
|
String[] mergedList = addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
|
||||||
return LocaleLoader.getString(templateKey, mergedList);
|
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 dataCalculations(Player player, float skillValue);
|
||||||
|
|
||||||
protected abstract void permissionsCheck(Player player);
|
protected abstract void permissionsCheck(Player player);
|
||||||
@ -295,12 +281,12 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a player can use a skill
|
* Checks if a player can use a skill
|
||||||
* @param player target player
|
*
|
||||||
|
* @param player target player
|
||||||
* @param subSkillType target subskill
|
* @param subSkillType target subskill
|
||||||
* @return true if the player has permission and has the skill unlocked
|
* @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);
|
return Permissions.isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,8 +75,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
|||||||
while (allStrings.size() < 9) {
|
while (allStrings.size() < 9) {
|
||||||
if (pageIndexStart + allStrings.size() > guide.size()) {
|
if (pageIndexStart + allStrings.size() > guide.size()) {
|
||||||
allStrings.add("");
|
allStrings.add("");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
|
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,8 +70,8 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
List<String> messages = new ArrayList<>();
|
List<String> messages = new ArrayList<>();
|
||||||
|
|
||||||
int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
|
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 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 ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamageMobs() * 1.5D : AdvancedConfig.getInstance().getRuptureDamageMobs();
|
||||||
|
|
||||||
if (canCounter) {
|
if (canCounter) {
|
||||||
messages.add(getStatMessage(SubSkillType.SWORDS_COUNTER_ATTACK, counterChance)
|
messages.add(getStatMessage(SubSkillType.SWORDS_COUNTER_ATTACK, counterChance)
|
||||||
@ -94,13 +94,12 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
+ (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,
|
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
|
||||||
String.valueOf(UserManager.getPlayer(player).getSwordsManager().getStabDamage())));
|
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,
|
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK))));
|
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK))));
|
||||||
}
|
}
|
||||||
|
@ -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) : ""));
|
//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,
|
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))));
|
String.valueOf(CombatUtils.getLimitBreakDamage(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))));
|
||||||
}
|
}
|
||||||
|
@ -130,16 +130,12 @@ public class AdvancedConfig extends ConfigValidated {
|
|||||||
super("advanced", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
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 grabs an instance of this config class from the Config Manager
|
||||||
* This method is deprecated and will be removed in the future
|
* This method is deprecated and will be removed in the future
|
||||||
* @see mcMMO#getConfigManager()
|
*
|
||||||
* @return the instance of this config
|
* @return the instance of this config
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -147,6 +143,11 @@ public class AdvancedConfig extends ConfigValidated {
|
|||||||
return mcMMO.getConfigManager().getAdvancedConfig();
|
return mcMMO.getConfigManager().getAdvancedConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unload() {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The version of this config
|
* The version of this config
|
||||||
*
|
*
|
||||||
@ -239,8 +240,7 @@ public class AdvancedConfig extends ConfigValidated {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* AXES */
|
/* AXES */
|
||||||
if(getAxeMasteryRankDamageMultiplier() < 0)
|
if (getAxeMasteryRankDamageMultiplier() < 0) {
|
||||||
{
|
|
||||||
reason.add(SKILLS + "." + AXES + "." + AXE_MASTERY + "." + RANK_DAMAGE_MULTIPLIER + " should be at least 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.
|
* 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
|
* 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
|
* @return the level at which abilities stop increasing in length
|
||||||
*/
|
*/
|
||||||
public int getAbilityLengthCap() {
|
public int getAbilityLengthCap() {
|
||||||
if(!mcMMO.isRetroModeEnabled())
|
if (!mcMMO.isRetroModeEnabled())
|
||||||
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, CAP_LEVEL);
|
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, CAP_LEVEL);
|
||||||
else
|
else
|
||||||
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, CAP_LEVEL);
|
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
|
* 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
|
* 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
|
* @return the number of levels required per ability length increase
|
||||||
*/
|
*/
|
||||||
public int getAbilityLength() {
|
public int getAbilityLength() {
|
||||||
if(!mcMMO.isRetroModeEnabled())
|
if (!mcMMO.isRetroModeEnabled())
|
||||||
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, INCREASE_LEVEL);
|
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, INCREASE_LEVEL);
|
||||||
else
|
else
|
||||||
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, INCREASE_LEVEL);
|
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
|
* 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
|
* 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
|
* 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
|
* @param subSkillType target subskill
|
||||||
* @return the level at which this skills max benefits will be reached on the curve
|
* @return the level at which this skills max benefits will be reached on the curve
|
||||||
*/
|
*/
|
||||||
public int getMaxBonusLevel(SubSkillType subSkillType) {
|
public int getMaxBonusLevel(SubSkillType subSkillType) {
|
||||||
String[] category = subSkillType.getAdvConfigAddress();
|
String[] category = subSkillType.getAdvConfigAddress();
|
||||||
|
|
||||||
if(!mcMMO.isRetroModeEnabled())
|
if (!mcMMO.isRetroModeEnabled())
|
||||||
return getIntValue(category[0], category[1], category[2], MAX_BONUS_LEVEL, STANDARD);
|
return getIntValue(category[0], category[1], category[2], MAX_BONUS_LEVEL, STANDARD);
|
||||||
else
|
else
|
||||||
return getIntValue(category[0], category[1], category[2], MAX_BONUS_LEVEL, RETRO_MODE);
|
return getIntValue(category[0], category[1], category[2], MAX_BONUS_LEVEL, RETRO_MODE);
|
||||||
@ -550,31 +555,26 @@ public class AdvancedConfig extends ConfigValidated {
|
|||||||
return maximumProbability;
|
return maximumProbability;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMaximumProbability(AbstractSubSkill abstractSubSkill)
|
public double getMaximumProbability(AbstractSubSkill abstractSubSkill) {
|
||||||
{
|
|
||||||
return getMaximumProbability(abstractSubSkill.getSubSkillType());
|
return getMaximumProbability(abstractSubSkill.getSubSkillType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notification Settings */
|
/* Notification Settings */
|
||||||
|
|
||||||
public boolean doesSkillCommandSendBlankLines()
|
public boolean doesSkillCommandSendBlankLines() {
|
||||||
{
|
return getBooleanValue(FEEDBACK, SKILL_COMMAND, BLANK_LINES_ABOVE_HEADER);
|
||||||
return getBooleanValue(FEEDBACK, SKILL_COMMAND, BLANK_LINES_ABOVE_HEADER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doesNotificationUseActionBar(NotificationType notificationType)
|
public boolean doesNotificationUseActionBar(NotificationType notificationType) {
|
||||||
{
|
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), ENABLED);
|
||||||
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), ENABLED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doesNotificationSendCopyToChat(NotificationType notificationType)
|
public boolean doesNotificationSendCopyToChat(NotificationType notificationType) {
|
||||||
{
|
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), SEND_COPY_OF_MESSAGE_TO_CHAT);
|
||||||
return getBooleanValue(FEEDBACK, ACTION_BAR_NOTIFICATIONS, notificationType.toString(), SEND_COPY_OF_MESSAGE_TO_CHAT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useTitlesForXPEvent()
|
public boolean useTitlesForXPEvent() {
|
||||||
{
|
return getBooleanValue(FEEDBACK, EVENTS, XP, SEND_TITLES);
|
||||||
return getBooleanValue(FEEDBACK, EVENTS, XP, SEND_TITLES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChatColor getChatColorFromKey(String keyLocation) {
|
private ChatColor getChatColorFromKey(String keyLocation) {
|
||||||
@ -595,57 +595,109 @@ public class AdvancedConfig extends ConfigValidated {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ACROBATICS */
|
/* 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 */
|
/* 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 getCatalysisMinSpeed() {
|
||||||
public double getCatalysisMaxSpeed() { return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MAX_SPEED); }
|
return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MIN_SPEED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getCatalysisMaxSpeed() {
|
||||||
|
return getDoubleValue(SKILLS, ALCHEMY, CATALYSIS, MAX_SPEED);
|
||||||
|
}
|
||||||
|
|
||||||
/* ARCHERY */
|
/* ARCHERY */
|
||||||
public double getSkillShotRankDamageMultiplier() { return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, RANK_DAMAGE_MULTIPLIER); }
|
public double getSkillShotRankDamageMultiplier() {
|
||||||
public double getSkillShotDamageMax() { return getDoubleValue(SKILLS, ARCHERY, SKILL_SHOT, MAX_DAMAGE); }
|
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 */
|
/* 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 getCriticalStrikesPVPModifier() {
|
||||||
public double getCriticalStrikesPVEModifier() { return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVE_MODIFIER); }
|
return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVP_MODIFIER);
|
||||||
|
}
|
||||||
|
|
||||||
public double getGreaterImpactChance() { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, CHANCE); }
|
public double getCriticalStrikesPVEModifier() {
|
||||||
public double getGreaterImpactModifier() { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, KNOCKBACK_MODIFIER); }
|
return getDoubleValue(SKILLS, AXES, CRITICAL_STRIKES, PVE_MODIFIER);
|
||||||
public double getGreaterImpactBonusDamage() { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, BONUS_DAMAGE); }
|
}
|
||||||
|
|
||||||
|
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() {
|
public int getArmorImpactIncreaseLevel() {
|
||||||
int increaseLevel = getIntValue(SKILLS, AXES, ARMOR_IMPACT, INCREASE_LEVEL);
|
int increaseLevel = getIntValue(SKILLS, AXES, ARMOR_IMPACT, INCREASE_LEVEL);
|
||||||
|
|
||||||
if(mcMMO.isRetroModeEnabled())
|
if (mcMMO.isRetroModeEnabled())
|
||||||
return increaseLevel * 10;
|
return increaseLevel * 10;
|
||||||
|
|
||||||
return increaseLevel;
|
return increaseLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getImpactChance() { return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, CHANCE); }
|
public double getImpactChance() {
|
||||||
public double getArmorImpactMaxDurabilityDamage() { return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, MAX_PERCENTAGE_DURABILITY_DAMAGE); }
|
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 */
|
/* EXCAVATION */
|
||||||
//Nothing to configure, everything is already configurable in config.yml
|
//Nothing to configure, everything is already configurable in config.yml
|
||||||
|
|
||||||
/* FISHING */
|
/* FISHING */
|
||||||
public double getShakeChance(int rank) { return getDoubleValue(SKILLS, FISHING, SHAKE, CHANCE, RANK, String.valueOf(rank)); }
|
public double getShakeChance(int rank) {
|
||||||
public double getMasterAnglerBoatModifier() {return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BOAT_MODIFIER); }
|
return getDoubleValue(SKILLS, FISHING, SHAKE, CHANCE, RANK, String.valueOf(rank));
|
||||||
public double getMasterAnglerBiomeModifier() {return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER); }
|
}
|
||||||
|
|
||||||
|
public double getMasterAnglerBoatModifier() {
|
||||||
|
return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BOAT_MODIFIER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getMasterAnglerBiomeModifier() {
|
||||||
|
return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER);
|
||||||
|
}
|
||||||
|
|
||||||
/* HERBALISM */
|
/* HERBALISM */
|
||||||
//public int getFarmerDietRankChange() { return getIntValue(SKILLS, ".Herbalism.FarmersDiet.RankChange"); }
|
//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"); }
|
//public int getGreenThumbStageChange() { return getIntValue(SKILLS, ".Herbalism.GreenThumb.StageChange"); }
|
||||||
|
|
||||||
/* MINING */
|
/* MINING */
|
||||||
public boolean getDoubleDropSilkTouchEnabled() { return getBooleanValue(SKILLS, MINING, "DoubleDrops", "SilkTouch"); }
|
public boolean getDoubleDropSilkTouchEnabled() {
|
||||||
public int getBlastMiningRankLevel(int rank) { return getIntValue(SKILLS, MINING, BLAST_MINING, RANK, LEVELS, RANK, String.valueOf(rank)); }
|
return getBooleanValue(SKILLS, MINING, "DoubleDrops", "SilkTouch");
|
||||||
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 getBlastMiningRankLevel(int rank) {
|
||||||
public int getDropMultiplier(int rank) { return getIntValue(SKILLS, MINING, BLAST_MINING, DROP_MULTIPLIER, RANK, String.valueOf(rank)); }
|
return getIntValue(SKILLS, MINING, BLAST_MINING, RANK, LEVELS, RANK, String.valueOf(rank));
|
||||||
public double getBlastRadiusModifier(int rank) { return getDoubleValue(SKILLS, MINING, BLAST_MINING, BLAST_RADIUS, MODIFIER, 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 */
|
/* 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); }
|
//public int getRepairMasteryMaxLevel() { return getIntValue(SKILLS, REPAIR, REPAIR_MASTERY, MAX_BONUS_LEVEL); }
|
||||||
|
|
||||||
/* Arcane Forging */
|
/* Arcane Forging */
|
||||||
public boolean getArcaneForgingEnchantLossEnabled() { return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, MAY_LOSE_ENCHANTS); }
|
public boolean getArcaneForgingEnchantLossEnabled() {
|
||||||
public double getArcaneForgingKeepEnchantsChance(int rank) { return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, KEEP_ENCHANTS, CHANCE, RANK, String.valueOf(rank)); }
|
return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, MAY_LOSE_ENCHANTS);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getArcaneForgingDowngradeEnabled() { return getBooleanValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES_ENABLED); }
|
public double getArcaneForgingKeepEnchantsChance(int rank) {
|
||||||
public double getArcaneForgingDowngradeChance(int rank) { return getDoubleValue(SKILLS, REPAIR, ARCANE_FORGING, DOWNGRADES, CHANCE, RANK, String.valueOf(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 */
|
/* SALVAGE */
|
||||||
|
|
||||||
public boolean getArcaneSalvageEnchantDowngradeEnabled() { return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_DOWNGRADE_ENABLED); }
|
public boolean getArcaneSalvageEnchantDowngradeEnabled() {
|
||||||
public boolean getArcaneSalvageEnchantLossEnabled() { return getBooleanValue(SKILLS, SALVAGE, ARCANE_SALVAGE, ENCHANT_LOSS_ENABLED); }
|
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 boolean getArcaneSalvageEnchantLossEnabled() {
|
||||||
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return getDoubleValue(SKILLS, SALVAGE, ARCANE_SALVAGE, EXTRACT_PARTIAL_ENCHANT, RANK, String.valueOf(rank)); }
|
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 */
|
/* SMELTING */
|
||||||
//public int getBurnModifierMaxLevel() { return getIntValue(SKILLS, SMELTING, FUEL_EFFICIENCY, MAX_BONUS_LEVEL); }
|
//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 */
|
/* SWORDS */
|
||||||
public double getRuptureDamagePlayer() { return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_PLAYER); }
|
public double getRuptureDamagePlayer() {
|
||||||
public double getRuptureDamageMobs() { return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_MOBS); }
|
return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_PLAYER);
|
||||||
|
}
|
||||||
|
|
||||||
public int getRuptureMaxTicks() { return getIntValue(SKILLS, SWORDS, RUPTURE, MAX_TICKS); }
|
public double getRuptureDamageMobs() {
|
||||||
public int getRuptureBaseTicks() { return getIntValue(SKILLS, SWORDS, RUPTURE, BASE_TICKS); }
|
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); }
|
//public int getSerratedStrikesTicks() { return getIntValue(SKILLS, SWORDS, SERRATED_STRIKES, RUPTURE, TICKS); }
|
||||||
|
|
||||||
/* TAMING */
|
/* TAMING */
|
||||||
public double getGoreModifier() { return getDoubleValue(SKILLS, TAMING, GORE, MODIFIER); }
|
public double getGoreModifier() {
|
||||||
public double getFastFoodChance() { return getDoubleValue(SKILLS, TAMING, FAST_FOOD_SERVICE, CHANCE); }
|
return getDoubleValue(SKILLS, TAMING, GORE, MODIFIER);
|
||||||
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 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 getPummelChance() {
|
||||||
public double getMaxHorseJumpStrength() { return getDoubleValue(SKILLS, TAMING, CALL_OF_THE_WILD, MAX_HORSE_JUMP_STRENGTH); }
|
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 */
|
/* UNARMED */
|
||||||
public boolean getDisarmProtected() { return getBooleanValue(SKILLS, UNARMED, DISARM, ANTI_THEFT); }
|
public boolean getDisarmProtected() {
|
||||||
|
return getBooleanValue(SKILLS, UNARMED, DISARM, ANTI_THEFT);
|
||||||
|
}
|
||||||
|
|
||||||
/* WOODCUTTING */
|
/* WOODCUTTING */
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,11 @@ public class BonusDropManager implements Unload {
|
|||||||
|
|
||||||
private HashMap<Material, Boolean> bonusDropWhitelist;
|
private HashMap<Material, Boolean> bonusDropWhitelist;
|
||||||
|
|
||||||
public BonusDropManager()
|
public BonusDropManager() {
|
||||||
{
|
|
||||||
bonusDropWhitelist = new HashMap<>();
|
bonusDropWhitelist = new HashMap<>();
|
||||||
|
|
||||||
//Start by setting all Materials to false to avoid null checks
|
//Start by setting all Materials to false to avoid null checks
|
||||||
for(Material material : Material.values())
|
for (Material material : Material.values()) {
|
||||||
{
|
|
||||||
registerMaterial(material, false);
|
registerMaterial(material, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,28 +29,25 @@ public class BonusDropManager implements Unload {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds materials to the bonus drop whitelist
|
* Adds materials to the bonus drop whitelist
|
||||||
|
*
|
||||||
* @param materials target material list
|
* @param materials target material list
|
||||||
*/
|
*/
|
||||||
public void addToWhitelistByMaterial(List<Material> materials)
|
public void addToWhitelistByMaterial(List<Material> materials) {
|
||||||
{
|
for (Material material : materials) {
|
||||||
for(Material material : materials)
|
|
||||||
{
|
|
||||||
registerMaterial(material, true);
|
registerMaterial(material, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds materials to the bonus drop whitelist
|
* Adds materials to the bonus drop whitelist
|
||||||
|
*
|
||||||
* @param materials target material list
|
* @param materials target material list
|
||||||
*/
|
*/
|
||||||
public void addToWhitelistByNameID(List<String> materials)
|
public void addToWhitelistByNameID(List<String> materials) {
|
||||||
{
|
for (String material : materials) {
|
||||||
for(String material : materials)
|
|
||||||
{
|
|
||||||
Material m = Material.matchMaterial(material);
|
Material m = Material.matchMaterial(material);
|
||||||
if(m == null)
|
if (m == null) {
|
||||||
{
|
mcMMO.p.getLogger().severe("Error registering Bonus Drop -- Invalid Minecraft Name ID: " + material);
|
||||||
mcMMO.p.getLogger().severe("Error registering Bonus Drop -- Invalid Minecraft Name ID: "+material);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +57,7 @@ public class BonusDropManager implements Unload {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a material to the bonus drop whitelist
|
* Adds a material to the bonus drop whitelist
|
||||||
|
*
|
||||||
* @param material target material
|
* @param material target material
|
||||||
*/
|
*/
|
||||||
private void registerMaterial(Material material, boolean isWhitelisted) {
|
private void registerMaterial(Material material, boolean isWhitelisted) {
|
||||||
@ -70,11 +66,11 @@ public class BonusDropManager implements Unload {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a material can provide bonus drops
|
* Check if a material can provide bonus drops
|
||||||
|
*
|
||||||
* @param material target material
|
* @param material target material
|
||||||
* @return true if the material can provide bonus drops
|
* @return true if the material can provide bonus drops
|
||||||
*/
|
*/
|
||||||
public boolean isBonusDropWhitelisted(Material material)
|
public boolean isBonusDropWhitelisted(Material material) {
|
||||||
{
|
|
||||||
return bonusDropWhitelist.get(material);
|
return bonusDropWhitelist.get(material);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,22 +21,20 @@ import java.util.List;
|
|||||||
public abstract class Config implements VersionedConfig, Unload {
|
public abstract class Config implements VersionedConfig, Unload {
|
||||||
|
|
||||||
public static final String HOCON_FILE_EXTENSION = ".conf";
|
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 */
|
/* SETTINGS */
|
||||||
//private static final String FILE_EXTENSION = ".conf"; //HOCON
|
//private static final String FILE_EXTENSION = ".conf"; //HOCON
|
||||||
private boolean mergeNewKeys; //Whether or not to merge keys found in the default config
|
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
|
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 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 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
|
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 */
|
/* LOADERS */
|
||||||
|
|
||||||
private HoconConfigurationLoader defaultCopyLoader;
|
private HoconConfigurationLoader defaultCopyLoader;
|
||||||
private HoconConfigurationLoader userCopyLoader;
|
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
|
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
|
//Attempt IO Operations
|
||||||
try {
|
try {
|
||||||
//Makes sure we have valid Files corresponding to this config
|
//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
|
* Registers with the config managers unloader
|
||||||
* The unloader runs when the plugin gets disabled which cleans up registries to make reloading safe
|
* 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);
|
mcMMO.getConfigManager().registerUnloadable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,13 +111,13 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
* Registers with the config managers file list
|
* Registers with the config managers file list
|
||||||
* Used for backing up configs with our zip library
|
* Used for backing up configs with our zip library
|
||||||
*/
|
*/
|
||||||
private void registerFileBackup()
|
private void registerFileBackup() {
|
||||||
{
|
|
||||||
mcMMO.getConfigManager().registerUserFile(getUserConfigFile());
|
mcMMO.getConfigManager().registerUserFile(getUserConfigFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the default copy File and the user config File
|
* Initializes the default copy File and the user config File
|
||||||
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private void initConfigFiles() 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
|
* Loads the root node for the default config File and user config File
|
||||||
*/
|
*/
|
||||||
private void loadConfig()
|
private void loadConfig() {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
final CommentedConfigurationNode defaultConfig = this.defaultCopyLoader.load();
|
final CommentedConfigurationNode defaultConfig = this.defaultCopyLoader.load();
|
||||||
defaultRootNode = defaultConfig;
|
defaultRootNode = defaultConfig;
|
||||||
@ -152,20 +147,19 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
/**
|
/**
|
||||||
* Initializes the Configuration Loaders for this config
|
* Initializes the Configuration Loaders for this config
|
||||||
*/
|
*/
|
||||||
private void initConfigLoaders()
|
private void initConfigLoaders() {
|
||||||
{
|
|
||||||
this.defaultCopyLoader = HoconConfigurationLoader.builder().setPath(resourceConfigCopy.toPath()).build();
|
this.defaultCopyLoader = HoconConfigurationLoader.builder().setPath(resourceConfigCopy.toPath()).build();
|
||||||
this.userCopyLoader = HoconConfigurationLoader.builder().setPath(resourceUserCopy.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
|
* 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
|
* @throws IOException
|
||||||
|
* @see Config#resourceConfigCopy
|
||||||
*/
|
*/
|
||||||
private File initDefaultConfig() throws IOException {
|
private File initDefaultConfig() throws IOException {
|
||||||
if(generateDefaults)
|
if (generateDefaults) {
|
||||||
{
|
|
||||||
return generateDefaultFile();
|
return generateDefaultFile();
|
||||||
} else
|
} else
|
||||||
return copyDefaultFromJar(getDefaultConfigCopyRelativePath(), true);
|
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
|
* 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
|
* Assigns the default root node to the newly loaded default config if successful
|
||||||
|
*
|
||||||
* @return the File for the newly created config
|
* @return the File for the newly created config
|
||||||
*/
|
*/
|
||||||
private File generateDefaultFile()
|
private File generateDefaultFile() {
|
||||||
{
|
mcMMO.p.getLogger().info("Attempting to create a default config for " + fileName);
|
||||||
mcMMO.p.getLogger().info("Attempting to create a default config for "+fileName);
|
|
||||||
|
|
||||||
//Not sure if this will work properly...
|
//Not sure if this will work properly...
|
||||||
Path potentialFile = Paths.get(getDefaultConfigCopyRelativePath());
|
Path potentialFile = Paths.get(getDefaultConfigCopyRelativePath());
|
||||||
@ -186,9 +180,9 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
= HoconConfigurationLoader.builder().setPath(potentialFile).build();
|
= HoconConfigurationLoader.builder().setPath(potentialFile).build();
|
||||||
|
|
||||||
try {
|
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
|
//Delete any existing default config
|
||||||
if(getDefaultConfigFile().exists())
|
if (getDefaultConfigFile().exists())
|
||||||
getDefaultConfigFile().delete();
|
getDefaultConfigFile().delete();
|
||||||
|
|
||||||
//Make new file
|
//Make new file
|
||||||
@ -200,8 +194,8 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
//Save to a new file
|
//Save to a new file
|
||||||
generation_loader.save(defaultRootNode);
|
generation_loader.save(defaultRootNode);
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Generated a default file for "+fileName);
|
mcMMO.p.getLogger().info("Generated a default file for " + fileName);
|
||||||
} catch(IOException e) {
|
} catch (IOException e) {
|
||||||
mcMMO.p.getLogger().severe("Error when trying to generate a default configuration file for " + getDefaultConfigCopyRelativePath());
|
mcMMO.p.getLogger().severe("Error when trying to generate a default configuration file for " + getDefaultConfigCopyRelativePath());
|
||||||
e.printStackTrace();
|
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
|
* 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
|
* @return user config File
|
||||||
* @see Config#resourceUserCopy
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
* @see Config#resourceUserCopy
|
||||||
*/
|
*/
|
||||||
private File initUserConfig() throws IOException {
|
private File initUserConfig() throws IOException {
|
||||||
File userCopy = new File(DIRECTORY_DATA_FOLDER, FILE_RELATIVE_PATH); //Load the user file;
|
File userCopy = new File(DIRECTORY_DATA_FOLDER, FILE_RELATIVE_PATH); //Load the user file;
|
||||||
|
|
||||||
if(userCopy.exists())
|
if (userCopy.exists()) {
|
||||||
{
|
|
||||||
// Yay
|
// Yay
|
||||||
return userCopy;
|
return userCopy;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
//If it's gone we copy default files
|
//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
|
//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);
|
return copyDefaultFromJar(FILE_RELATIVE_PATH, false);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
//Make a new empty file
|
//Make a new empty file
|
||||||
userCopy.createNewFile();
|
userCopy.createNewFile();
|
||||||
return userCopy;
|
return userCopy;
|
||||||
@ -241,6 +232,7 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the File representation of the this users config
|
* Gets the File representation of the this users config
|
||||||
|
*
|
||||||
* @return the users config File
|
* @return the users config File
|
||||||
*/
|
*/
|
||||||
public File getUserConfigFile() {
|
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
|
* 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 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
|
* @return a copy of the default config within the JAR
|
||||||
* @throws IOException
|
* @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
|
* 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 = McmmoCore.getResource(FILE_RELATIVE_PATH);
|
||||||
InputStream inputStream = mcMMO.p.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);
|
File targetFile = new File(DIRECTORY_DATA_FOLDER, relativeOutputPath);
|
||||||
|
|
||||||
//Wipe old default file on disk
|
//Wipe old default file on disk
|
||||||
if (targetFile.exists() && deleteOld)
|
if (targetFile.exists() && deleteOld) {
|
||||||
{
|
|
||||||
mcMMO.p.getLogger().info("Updating file " + relativeOutputPath);
|
mcMMO.p.getLogger().info("Updating file " + relativeOutputPath);
|
||||||
targetFile.delete(); //Necessary?
|
targetFile.delete(); //Necessary?
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!targetFile.exists())
|
if (!targetFile.exists()) {
|
||||||
{
|
|
||||||
targetFile.getParentFile().mkdirs();
|
targetFile.getParentFile().mkdirs();
|
||||||
targetFile.createNewFile(); //New File Boys
|
targetFile.createNewFile(); //New File Boys
|
||||||
}
|
}
|
||||||
@ -292,6 +282,7 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The path to the defaults directory
|
* The path to the defaults directory
|
||||||
|
*
|
||||||
* @return the path to the defaults directory
|
* @return the path to the defaults directory
|
||||||
*/
|
*/
|
||||||
private String getDefaultConfigCopyRelativePath() {
|
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
|
* 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.
|
* 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
|
* @return the copy of the default config file, stored in the defaults directory
|
||||||
*/
|
*/
|
||||||
private File getDefaultConfigFile() {
|
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
|
* Configs are versioned based on when they had significant changes to keys
|
||||||
|
*
|
||||||
* @return current MainConfig Version String
|
* @return current MainConfig Version String
|
||||||
*/
|
*/
|
||||||
public String getVersion()
|
public String getVersion() {
|
||||||
{
|
return String.valueOf(getConfigVersion());
|
||||||
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
|
* Compares the users config file to the default and adds any missing nodes and applies any necessary updates
|
||||||
*/
|
*/
|
||||||
private void updateConfig()
|
private void updateConfig() {
|
||||||
{
|
mcMMO.p.getLogger().info(defaultRootNode.getChildrenMap().size() + " items in default children map");
|
||||||
mcMMO.p.getLogger().info(defaultRootNode.getChildrenMap().size() +" items in default children map");
|
mcMMO.p.getLogger().info(userRootNode.getChildrenMap().size() + " items in default root map");
|
||||||
mcMMO.p.getLogger().info(userRootNode.getChildrenMap().size() +" items in default root map");
|
|
||||||
|
|
||||||
// Merge Values from default
|
// Merge Values from default
|
||||||
if(mergeNewKeys)
|
if (mergeNewKeys)
|
||||||
userRootNode = userRootNode.mergeValuesFrom(defaultRootNode);
|
userRootNode = userRootNode.mergeValuesFrom(defaultRootNode);
|
||||||
|
|
||||||
removeOldKeys();
|
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
|
* Finds any keys in the users config that are not present in the default config and removes them
|
||||||
*/
|
*/
|
||||||
//TODO: Finish this
|
//TODO: Finish this
|
||||||
private void removeOldKeys()
|
private void removeOldKeys() {
|
||||||
{
|
if (!removeOldKeys)
|
||||||
if(!removeOldKeys)
|
|
||||||
return;
|
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)
|
* Saves the current state information of the config to the users copy (which they may edit)
|
||||||
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private void saveUserCopy() throws IOException
|
private void saveUserCopy() throws IOException {
|
||||||
{
|
|
||||||
mcMMO.p.getLogger().info("Saving new node");
|
mcMMO.p.getLogger().info("Saving new node");
|
||||||
userCopyLoader.save(userRootNode);
|
userCopyLoader.save(userRootNode);
|
||||||
}
|
}
|
||||||
@ -395,11 +384,12 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
private void updateConfigVersion() {
|
private void updateConfigVersion() {
|
||||||
// Set a version for our config
|
// Set a version for our config
|
||||||
this.userRootNode.getNode("ConfigVersion").setValue(getConfigVersion());
|
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
|
* Returns the root node of this config
|
||||||
|
*
|
||||||
* @return the root node of this config
|
* @return the root node of this config
|
||||||
*/
|
*/
|
||||||
protected CommentedConfigurationNode getUserRootNode() {
|
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
|
* Gets an int from the config and casts it to short before returning
|
||||||
|
*
|
||||||
* @param path the path to the int
|
* @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
|
* @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
|
* Grabs an int from the specified node
|
||||||
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @return the int from the node, null references will zero initialize
|
* @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();
|
return userRootNode.getNode(path).getInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grabs a double from the specified node
|
* Grabs a double from the specified node
|
||||||
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @return the double from the node, null references will zero initialize
|
* @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();
|
return userRootNode.getNode(path).getDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grabs a long from the specified node
|
* Grabs a long from the specified node
|
||||||
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @return the long from the node, null references will zero initialize
|
* @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();
|
return userRootNode.getNode(path).getLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grabs a boolean from the specified node
|
* Grabs a boolean from the specified node
|
||||||
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @return the boolean from the node, null references will zero initialize
|
* @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();
|
return userRootNode.getNode(path).getBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grabs a string from the specified node
|
* Grabs a string from the specified node
|
||||||
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @return the string from the node, null references will zero initialize
|
* @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();
|
return userRootNode.getNode(path).getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if a node exists in the user's config file
|
* Checks to see if a node exists in the user's config file
|
||||||
|
*
|
||||||
* @param path path to the node
|
* @param path path to the node
|
||||||
* @return true if the node exists
|
* @return true if the node exists
|
||||||
*/
|
*/
|
||||||
@ -473,6 +468,7 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the children of a specific node
|
* Returns the children of a specific node
|
||||||
|
*
|
||||||
* @param path the path to the parent node
|
* @param path the path to the parent node
|
||||||
* @return the list of children for the target 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();
|
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));
|
return userRootNode.getNode(path).getList(TypeToken.of(String.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@ public abstract class ConfigCollection<T> extends Config implements Registers, G
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pathToParentFolder Path to the "parent" folder on disk
|
* @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 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 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 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 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) {
|
public ConfigCollection(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
||||||
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
|
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
|
||||||
|
@ -9,11 +9,19 @@ import java.util.ArrayList;
|
|||||||
* Constants relating to config folders and paths
|
* Constants relating to config folders and paths
|
||||||
*/
|
*/
|
||||||
public class ConfigConstants {
|
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 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 " +
|
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.";
|
"\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
|
//Add the worlds to the list
|
||||||
static {
|
static {
|
||||||
@ -23,23 +31,12 @@ public class ConfigConstants {
|
|||||||
EXAMPLE_BLACKLIST_WORLDS_LIST_DEFAULT.add(EXAMPLE_BLACKLIST_WORLDS[2]);
|
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 data folder for mcMMO
|
||||||
|
*
|
||||||
* @return the File for the data folder used by mcMMO
|
* @return the File for the data folder used by mcMMO
|
||||||
*/
|
*/
|
||||||
public static File getDataFolder()
|
public static File getDataFolder() {
|
||||||
{
|
|
||||||
return mcMMO.p.getDataFolder();
|
return mcMMO.p.getDataFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,33 +71,32 @@ public class ConfigConstants {
|
|||||||
/**
|
/**
|
||||||
* Creates all directories used by mcMMO config files
|
* Creates all directories used by mcMMO config files
|
||||||
*/
|
*/
|
||||||
public static void makeAllConfigDirectories()
|
public static void makeAllConfigDirectories() {
|
||||||
{
|
|
||||||
/* CONFIG DIRECTORY */
|
/* CONFIG DIRECTORY */
|
||||||
|
|
||||||
if(!getConfigFolder().exists())
|
if (!getConfigFolder().exists())
|
||||||
getConfigFolder().mkdirs();
|
getConfigFolder().mkdirs();
|
||||||
|
|
||||||
/* DEFAULT DIRECTORIES */
|
/* DEFAULT DIRECTORIES */
|
||||||
|
|
||||||
if(!getDefaultsFolder().exists())
|
if (!getDefaultsFolder().exists())
|
||||||
getDefaultsFolder().mkdirs();
|
getDefaultsFolder().mkdirs();
|
||||||
|
|
||||||
if(!getDefaultsConfigFolder().exists())
|
if (!getDefaultsConfigFolder().exists())
|
||||||
getDefaultsConfigFolder().mkdirs();
|
getDefaultsConfigFolder().mkdirs();
|
||||||
|
|
||||||
if(!getDefaultsSkillFolder().exists())
|
if (!getDefaultsSkillFolder().exists())
|
||||||
getDefaultsSkillFolder().mkdirs();
|
getDefaultsSkillFolder().mkdirs();
|
||||||
|
|
||||||
if(!getDefaultsXPFolder().exists())
|
if (!getDefaultsXPFolder().exists())
|
||||||
getDefaultsXPFolder().mkdirs();
|
getDefaultsXPFolder().mkdirs();
|
||||||
|
|
||||||
/* CONFIG SUBDIRECTORIES */
|
/* CONFIG SUBDIRECTORIES */
|
||||||
|
|
||||||
if(!getConfigSkillFolder().exists())
|
if (!getConfigSkillFolder().exists())
|
||||||
getConfigSkillFolder().mkdirs();
|
getConfigSkillFolder().mkdirs();
|
||||||
|
|
||||||
if(!getConfigXPFolder().exists())
|
if (!getConfigXPFolder().exists())
|
||||||
getConfigXPFolder().mkdirs();
|
getConfigXPFolder().mkdirs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,37 +65,32 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* The Config Manager handles initializing, loading, and unloading registers for all configs that mcMMO uses
|
* 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
|
* This makes sure that mcMMO properly loads and unloads its values on reload
|
||||||
*
|
* <p>
|
||||||
* Config Manager also holds all of our MultiConfigContainers
|
* Config Manager also holds all of our MultiConfigContainers
|
||||||
*/
|
*/
|
||||||
public final class ConfigManager {
|
public final class ConfigManager {
|
||||||
|
|
||||||
/* UNLOAD REGISTER */
|
/* UNLOAD REGISTER */
|
||||||
|
|
||||||
|
SkillPropertiesManager skillPropertiesManager;
|
||||||
private ArrayList<Unload> unloadables;
|
private ArrayList<Unload> unloadables;
|
||||||
private ArrayList<File> userFiles;
|
|
||||||
|
|
||||||
/* COLLECTION MANAGERS */
|
/* COLLECTION MANAGERS */
|
||||||
|
private ArrayList<File> userFiles;
|
||||||
private RepairableManager repairableManager;
|
private RepairableManager repairableManager;
|
||||||
private SalvageableManager salvageableManager;
|
private SalvageableManager salvageableManager;
|
||||||
private BonusDropManager bonusDropManager;
|
|
||||||
|
|
||||||
/* CUSTOM SERIALIZERS */
|
/* CUSTOM SERIALIZERS */
|
||||||
|
private BonusDropManager bonusDropManager;
|
||||||
private TypeSerializerCollection customSerializers;
|
|
||||||
|
|
||||||
/* MOD MANAGERS */
|
/* MOD MANAGERS */
|
||||||
|
|
||||||
//TODO: Add these back when modded servers become a thing again
|
//TODO: Add these back when modded servers become a thing again
|
||||||
|
|
||||||
/* MISC MANAGERS */
|
/* MISC MANAGERS */
|
||||||
|
private TypeSerializerCollection customSerializers;
|
||||||
SkillPropertiesManager skillPropertiesManager;
|
|
||||||
|
|
||||||
private ExperienceMapManager experienceMapManager;
|
private ExperienceMapManager experienceMapManager;
|
||||||
|
|
||||||
/* CONFIG INSTANCES */
|
/* CONFIG INSTANCES */
|
||||||
@ -163,14 +158,12 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
private ArrayList<String> configErrors; //Collect errors to whine about to server admins
|
private ArrayList<String> configErrors; //Collect errors to whine about to server admins
|
||||||
|
|
||||||
public ConfigManager()
|
public ConfigManager() {
|
||||||
{
|
|
||||||
unloadables = new ArrayList<>();
|
unloadables = new ArrayList<>();
|
||||||
userFiles = new ArrayList<>();
|
userFiles = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadConfigs()
|
public void loadConfigs() {
|
||||||
{
|
|
||||||
//Register Custom Serializers
|
//Register Custom Serializers
|
||||||
registerCustomTypeSerializers();
|
registerCustomTypeSerializers();
|
||||||
|
|
||||||
@ -314,9 +307,12 @@ public final class ConfigManager {
|
|||||||
customSerializers = TypeSerializers.getDefaultSerializers().newChild();
|
customSerializers = TypeSerializers.getDefaultSerializers().newChild();
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Registering custom type serializers for Configurate...");
|
mcMMO.p.getLogger().info("Registering custom type serializers for Configurate...");
|
||||||
customSerializers.registerType(new TypeToken<Material>() {}, new CustomEnumValueSerializer());
|
customSerializers.registerType(new TypeToken<Material>() {
|
||||||
customSerializers.registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer());
|
}, new CustomEnumValueSerializer());
|
||||||
customSerializers.registerType(new TypeToken<FormulaType>() {}, 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(Repairable.class), new RepairableSerializer());
|
||||||
customSerializers.registerType(TypeToken.of(Salvageable.class), new SalvageableSerializer());
|
customSerializers.registerType(TypeToken.of(Salvageable.class), new SalvageableSerializer());
|
||||||
customSerializers.registerType(TypeToken.of(MinecraftMaterialWrapper.class), new MinecraftMaterialWrapperSerializer());
|
customSerializers.registerType(TypeToken.of(MinecraftMaterialWrapper.class), new MinecraftMaterialWrapperSerializer());
|
||||||
@ -325,22 +321,21 @@ public final class ConfigManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the serializers registered and used by mcMMO
|
* Gets the serializers registered and used by mcMMO
|
||||||
* This includes all default serializers
|
* This includes all default serializers
|
||||||
|
*
|
||||||
* @return our custom serializers
|
* @return our custom serializers
|
||||||
*/
|
*/
|
||||||
public TypeSerializerCollection getCustomSerializers() {
|
public TypeSerializerCollection getCustomSerializers() {
|
||||||
return customSerializers;
|
return customSerializers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz)
|
private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz) {
|
||||||
{
|
|
||||||
skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(primarySkillType, clazz));
|
skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(primarySkillType, clazz));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Misc managers
|
* Misc managers
|
||||||
*/
|
*/
|
||||||
private void initMiscManagers()
|
private void initMiscManagers() {
|
||||||
{
|
|
||||||
experienceMapManager = new ExperienceMapManager();
|
experienceMapManager = new ExperienceMapManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,8 +356,7 @@ public final class ConfigManager {
|
|||||||
/**
|
/**
|
||||||
* Initializes any managers related to config collections
|
* Initializes any managers related to config collections
|
||||||
*/
|
*/
|
||||||
private void initCollectionManagers()
|
private void initCollectionManagers() {
|
||||||
{
|
|
||||||
// Handles registration of repairables
|
// Handles registration of repairables
|
||||||
repairableManager = new RepairableManager(getRepairables());
|
repairableManager = new RepairableManager(getRepairables());
|
||||||
unloadables.add(repairableManager);
|
unloadables.add(repairableManager);
|
||||||
@ -378,30 +372,28 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all loaded repairables (loaded from all repairable configs)
|
* Get all loaded repairables (loaded from all repairable configs)
|
||||||
|
*
|
||||||
* @return the currently loaded repairables
|
* @return the currently loaded repairables
|
||||||
*/
|
*/
|
||||||
public ArrayList<Repairable> getRepairables()
|
public ArrayList<Repairable> getRepairables() {
|
||||||
{
|
|
||||||
return getConfigRepair().getConfigRepairablesList();
|
return getConfigRepair().getConfigRepairablesList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all loaded salvageables (loaded from all salvageable configs)
|
* Get all loaded salvageables (loaded from all salvageable configs)
|
||||||
|
*
|
||||||
* @return the currently loaded salvageables
|
* @return the currently loaded salvageables
|
||||||
*/
|
*/
|
||||||
public ArrayList<Salvageable> getSalvageables()
|
public ArrayList<Salvageable> getSalvageables() {
|
||||||
{
|
|
||||||
return getConfigSalvage().getConfigSalvageablesList();
|
return getConfigSalvage().getConfigSalvageablesList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads all config options (prepares for reload)
|
* Unloads all config options (prepares for reload)
|
||||||
*/
|
*/
|
||||||
public void unloadAllConfigsAndRegisters()
|
public void unloadAllConfigsAndRegisters() {
|
||||||
{
|
|
||||||
//Unload
|
//Unload
|
||||||
for(Unload unloadable : unloadables)
|
for (Unload unloadable : unloadables) {
|
||||||
{
|
|
||||||
unloadable.unload();
|
unloadable.unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,9 +406,8 @@ public final class ConfigManager {
|
|||||||
* Registers an unloadable
|
* Registers an unloadable
|
||||||
* Unloadables call unload() on plugin disable to cleanup registries
|
* Unloadables call unload() on plugin disable to cleanup registries
|
||||||
*/
|
*/
|
||||||
public void registerUnloadable(Unload unload)
|
public void registerUnloadable(Unload unload) {
|
||||||
{
|
if (!unloadables.contains(unload))
|
||||||
if(!unloadables.contains(unload))
|
|
||||||
unloadables.add(unload);
|
unloadables.add(unload);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,24 +415,21 @@ public final class ConfigManager {
|
|||||||
* Registers an unloadable
|
* Registers an unloadable
|
||||||
* Unloadables call unload() on plugin disable to cleanup registries
|
* Unloadables call unload() on plugin disable to cleanup registries
|
||||||
*/
|
*/
|
||||||
public void registerUserFile(File userFile)
|
public void registerUserFile(File userFile) {
|
||||||
{
|
if (!userFiles.contains(userFile))
|
||||||
if(!userFiles.contains(userFile))
|
|
||||||
userFiles.add(userFile);
|
userFiles.add(userFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers bonus drops from several skill configs
|
* Registers bonus drops from several skill configs
|
||||||
*/
|
*/
|
||||||
public void registerBonusDrops()
|
public void registerBonusDrops() {
|
||||||
{
|
|
||||||
bonusDropManager.addToWhitelistByNameID(getConfigMining().getBonusDrops());
|
bonusDropManager.addToWhitelistByNameID(getConfigMining().getBonusDrops());
|
||||||
// bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops());
|
// bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops());
|
||||||
// bonusDropManager.addToWhitelistByNameID(configWoodcutting.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
|
* Used to back up our zip files real easily
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ArrayList<File> getConfigFiles()
|
public ArrayList<File> getConfigFiles() {
|
||||||
{
|
|
||||||
return userFiles;
|
return userFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,9 +498,13 @@ public final class ConfigManager {
|
|||||||
return experienceMapManager;
|
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() {
|
public ConfigLeveling getConfigLeveling() {
|
||||||
return configLeveling.getConfig();
|
return configLeveling.getConfig();
|
||||||
@ -658,25 +650,22 @@ public final class ConfigManager {
|
|||||||
* Checks if this plugin is using retro mode
|
* Checks if this plugin is using retro mode
|
||||||
* Retro mode is a 0-1000 skill system
|
* Retro mode is a 0-1000 skill system
|
||||||
* Standard mode is scaled for 1-100
|
* Standard mode is scaled for 1-100
|
||||||
|
*
|
||||||
* @return true if retro mode is enabled
|
* @return true if retro mode is enabled
|
||||||
*/
|
*/
|
||||||
public boolean isRetroMode()
|
public boolean isRetroMode() {
|
||||||
{
|
|
||||||
return getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled();
|
return getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBonusDropsEnabled(Material material)
|
public boolean isBonusDropsEnabled(Material material) {
|
||||||
{
|
|
||||||
return getBonusDropManager().isBonusDropWhitelisted(material);
|
return getBonusDropManager().isBonusDropWhitelisted(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getSkillMaxBonusLevel(SubSkillType subSkillType)
|
public double getSkillMaxBonusLevel(SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
return skillPropertiesManager.getMaxBonusLevel(subSkillType);
|
return skillPropertiesManager.getMaxBonusLevel(subSkillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getSkillMaxChance(SubSkillType subSkillType)
|
public double getSkillMaxChance(SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
return skillPropertiesManager.getMaxChance(subSkillType);
|
return skillPropertiesManager.getMaxChance(subSkillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,12 +9,11 @@ import java.io.File;
|
|||||||
public abstract class ConfigValidated extends Config implements UnsafeValueValidation {
|
public abstract class ConfigValidated extends Config implements UnsafeValueValidation {
|
||||||
/**
|
/**
|
||||||
* @param pathToParentFolder File for the "parent" folder on disk
|
* @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 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 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 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);
|
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
|
||||||
validateEntries();
|
validateEntries();
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,9 @@ public class CoreSkillsConfig extends Config {
|
|||||||
/**
|
/**
|
||||||
* This grabs an instance of the class from the Config Manager
|
* This grabs an instance of the class from the Config Manager
|
||||||
* This method is deprecated and will be removed in the future
|
* This method is deprecated and will be removed in the future
|
||||||
* @see mcMMO#getConfigManager()
|
*
|
||||||
* @return the instance of this config
|
* @return the instance of this config
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -55,7 +56,7 @@ public class CoreSkillsConfig extends Config {
|
|||||||
* @return true if subskill is enabled
|
* @return true if subskill is enabled
|
||||||
*/
|
*/
|
||||||
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill) {
|
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
|
* @return true if enabled
|
||||||
*/
|
*/
|
||||||
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) {
|
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) {
|
||||||
return getBooleanValue(StringUtils.getCapitalized(primarySkillType.toString()), ENABLED);
|
return getBooleanValue(StringUtils.getCapitalized(primarySkillType.toString()), ENABLED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,13 @@ import java.util.Collection;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a class that contains a generic collection
|
* Represents a class that contains a generic collection
|
||||||
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public interface GenericCollectionContainer<T> {
|
public interface GenericCollectionContainer<T> {
|
||||||
/**
|
/**
|
||||||
* Grab the collection held by this class
|
* Grab the collection held by this class
|
||||||
|
*
|
||||||
* @return the collection held by this class
|
* @return the collection held by this class
|
||||||
*/
|
*/
|
||||||
Collection<T> getLoadedCollection();
|
Collection<T> getLoadedCollection();
|
||||||
|
@ -208,8 +208,9 @@ public class MainConfig extends ConfigValidated {
|
|||||||
/**
|
/**
|
||||||
* This grabs an instance of this config class from the Config Manager
|
* This grabs an instance of this config class from the Config Manager
|
||||||
* This method is deprecated and will be removed in the future
|
* This method is deprecated and will be removed in the future
|
||||||
* @see mcMMO#getConfigManager()
|
*
|
||||||
* @return the instance of this config
|
* @return the instance of this config
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -23,8 +23,9 @@ public class RankConfig extends ConfigValidated {
|
|||||||
/**
|
/**
|
||||||
* This grabs an instance of this config class from the Config Manager
|
* This grabs an instance of this config class from the Config Manager
|
||||||
* This method is deprecated and will be removed in the future
|
* This method is deprecated and will be removed in the future
|
||||||
* @see mcMMO#getConfigManager()
|
*
|
||||||
* @return the instance of this config
|
* @return the instance of this config
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -6,11 +6,10 @@ import com.gmail.nossr50.util.StringUtils;
|
|||||||
|
|
||||||
public class SkillConfigFactory {
|
public class SkillConfigFactory {
|
||||||
|
|
||||||
protected static SerializedConfigLoader initSkillConfig(PrimarySkillType primarySkillType, Class<?> clazz)
|
protected static SerializedConfigLoader initSkillConfig(PrimarySkillType primarySkillType, Class<?> clazz) {
|
||||||
{
|
|
||||||
return new SerializedConfigLoader(clazz,
|
return new SerializedConfigLoader(clazz,
|
||||||
primarySkillType.toString().toLowerCase() + ".conf",
|
primarySkillType.toString().toLowerCase() + ".conf",
|
||||||
StringUtils.getCapitalized(primarySkillType.toString()),
|
StringUtils.getCapitalized(primarySkillType.toString()),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,37 +14,31 @@ public class SkillPropertiesManager {
|
|||||||
private HashMap<SubSkillType, Double> maxBonusLevelMap;
|
private HashMap<SubSkillType, Double> maxBonusLevelMap;
|
||||||
private HashMap<SubSkillType, Double> maxBonusPercentage;
|
private HashMap<SubSkillType, Double> maxBonusPercentage;
|
||||||
|
|
||||||
public SkillPropertiesManager()
|
public SkillPropertiesManager() {
|
||||||
{
|
|
||||||
maxChanceMap = new HashMap<>();
|
maxChanceMap = new HashMap<>();
|
||||||
maxBonusLevelMap = new HashMap<>();
|
maxBonusLevelMap = new HashMap<>();
|
||||||
maxBonusPercentage = new HashMap<>();
|
maxBonusPercentage = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerRNG(SubSkillType subSkillType, ConfigSubSkillScalingRNG config)
|
public void registerRNG(SubSkillType subSkillType, ConfigSubSkillScalingRNG config) {
|
||||||
{
|
|
||||||
maxChanceMap.put(subSkillType, config.getMaxChance());
|
maxChanceMap.put(subSkillType, config.getMaxChance());
|
||||||
maxBonusLevelMap.put(subSkillType, config.getMaxBonusLevel());
|
maxBonusLevelMap.put(subSkillType, config.getMaxBonusLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMaxChance(SubSkillType subSkillType)
|
public double getMaxChance(SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
return maxChanceMap.get(subSkillType);
|
return maxChanceMap.get(subSkillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMaxBonusLevel(SubSkillType subSkillType)
|
public double getMaxBonusLevel(SubSkillType subSkillType) {
|
||||||
{
|
|
||||||
return maxBonusLevelMap.get(subSkillType);
|
return maxBonusLevelMap.get(subSkillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillRegisters()
|
public void fillRegisters() {
|
||||||
{
|
|
||||||
|
|
||||||
fillRNGRegisters();
|
fillRNGRegisters();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillRNGRegisters()
|
private void fillRNGRegisters() {
|
||||||
{
|
|
||||||
//Acrobatics
|
//Acrobatics
|
||||||
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getDodge().getRNGSettings());
|
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getDodge().getRNGSettings());
|
||||||
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getRoll().getRNGSettings());
|
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getRoll().getRNGSettings());
|
||||||
|
@ -24,8 +24,9 @@ public class SoundConfig extends ConfigValidated {
|
|||||||
/**
|
/**
|
||||||
* This grabs an instance of this config class from the Config Manager
|
* This grabs an instance of this config class from the Config Manager
|
||||||
* This method is deprecated and will be removed in the future
|
* This method is deprecated and will be removed in the future
|
||||||
* @see mcMMO#getConfigManager()
|
*
|
||||||
* @return the instance of this config
|
* @return the instance of this config
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -13,18 +13,15 @@ public interface UnsafeValueValidation {
|
|||||||
/**
|
/**
|
||||||
* Prints all errors found when validating the config
|
* Prints all errors found when validating the config
|
||||||
*/
|
*/
|
||||||
default void validateEntries()
|
default void validateEntries() {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Print Errors about Keys
|
* Print Errors about Keys
|
||||||
*/
|
*/
|
||||||
|
|
||||||
List<String> validKeyErrors = validateKeys(); // Validate Keys
|
List<String> validKeyErrors = validateKeys(); // Validate Keys
|
||||||
|
|
||||||
if(validKeyErrors != null && validKeyErrors.size() > 0)
|
if (validKeyErrors != null && validKeyErrors.size() > 0) {
|
||||||
{
|
for (String error : validKeyErrors) {
|
||||||
for(String error : validKeyErrors)
|
|
||||||
{
|
|
||||||
mcMMO.p.getLogger().severe(error);
|
mcMMO.p.getLogger().severe(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ package com.gmail.nossr50.config;
|
|||||||
public interface VersionedConfig {
|
public interface VersionedConfig {
|
||||||
/**
|
/**
|
||||||
* The version of this config
|
* The version of this config
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
double getConfigVersion();
|
double getConfigVersion();
|
||||||
|
@ -86,8 +86,9 @@ public class ExperienceConfig extends ConfigValidated {
|
|||||||
/**
|
/**
|
||||||
* This grabs an instance of this config class from the Config Manager
|
* This grabs an instance of this config class from the Config Manager
|
||||||
* This method is deprecated and will be removed in the future
|
* This method is deprecated and will be removed in the future
|
||||||
* @see mcMMO#getConfigManager()
|
*
|
||||||
* @return the instance of this config
|
* @return the instance of this config
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -168,9 +169,6 @@ public class ExperienceConfig extends ConfigValidated {
|
|||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FORMULA SETTINGS
|
* FORMULA SETTINGS
|
||||||
*/
|
*/
|
||||||
@ -185,8 +183,7 @@ public class ExperienceConfig extends ConfigValidated {
|
|||||||
return getDoubleValue(EXPERIENCE_FORMULA, MULTIPLIER, GLOBAL);
|
return getDoubleValue(EXPERIENCE_FORMULA, MULTIPLIER, GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlobalXPMultiplier(double newXpMultiplier)
|
public void setGlobalXPMultiplier(double newXpMultiplier) {
|
||||||
{
|
|
||||||
getUserRootNode().getNode(EXPERIENCE_FORMULA, MULTIPLIER, GLOBAL).setValue(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
|
* 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
|
* @param blockType the type of block
|
||||||
* @return the raw amount of XP for this block before modifiers
|
* @return the raw amount of XP for this block before modifiers
|
||||||
*/
|
*/
|
||||||
//public int getXp(PrimarySkillType skill, BlockType blockType) {
|
//public int getXp(PrimarySkillType skill, BlockType blockType) {
|
||||||
public int getXp(PrimarySkillType skill, Material blockType) {
|
public int getXp(PrimarySkillType skill, Material blockType) {
|
||||||
//TODO: This is going to need to be changed, this code here is only placeholder
|
//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);
|
return getIntValue(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,14 +4,12 @@ import com.gmail.nossr50.util.StringUtils;
|
|||||||
|
|
||||||
public final class HOCONUtil {
|
public final class HOCONUtil {
|
||||||
|
|
||||||
public static String serializeENUMName(String hyphenedString)
|
public static String serializeENUMName(String hyphenedString) {
|
||||||
{
|
|
||||||
String[] split = hyphenedString.split("_");
|
String[] split = hyphenedString.split("_");
|
||||||
StringBuilder formattedString = new StringBuilder();
|
StringBuilder formattedString = new StringBuilder();
|
||||||
|
|
||||||
for(int x = 0; x < split.length; x++)
|
for (int x = 0; x < split.length; x++) {
|
||||||
{
|
if (x + 1 >= split.length)
|
||||||
if(x + 1 >= split.length)
|
|
||||||
formattedString.append(StringUtils.getCapitalized(split[x]));
|
formattedString.append(StringUtils.getCapitalized(split[x]));
|
||||||
else
|
else
|
||||||
formattedString.append(StringUtils.getCapitalized(split[x])).append('-');
|
formattedString.append(StringUtils.getCapitalized(split[x])).append('-');
|
||||||
@ -20,14 +18,12 @@ public final class HOCONUtil {
|
|||||||
return formattedString.toString();
|
return formattedString.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String deserializeENUMName(String serializedName)
|
public static String deserializeENUMName(String serializedName) {
|
||||||
{
|
|
||||||
String[] split = serializedName.split("-");
|
String[] split = serializedName.split("-");
|
||||||
StringBuilder formattedString = new StringBuilder();
|
StringBuilder formattedString = new StringBuilder();
|
||||||
|
|
||||||
for(int x = 0; x < split.length; x++)
|
for (int x = 0; x < split.length; x++) {
|
||||||
{
|
if (x + 1 >= split.length)
|
||||||
if(x + 1 >= split.length)
|
|
||||||
formattedString.append(split[x].toUpperCase());
|
formattedString.append(split[x].toUpperCase());
|
||||||
else
|
else
|
||||||
formattedString.append(split[x]).append('_');
|
formattedString.append(split[x]).append('_');
|
||||||
|
@ -46,7 +46,8 @@ public class RepairableSerializer implements TypeSerializer<Repairable> {
|
|||||||
/* Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) */
|
/* Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) */
|
||||||
|
|
||||||
String item = value.getNode(ITEM).getValue(TypeToken.of(String.class));
|
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());
|
/*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());
|
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
|
//noinspection RedundantCast
|
||||||
Optional<Enum> ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class),
|
Optional<Enum> ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class),
|
||||||
enumConstant); // XXX: intellij says this cast is optional but it isnt
|
enumConstant); // XXX: intellij says this cast is optional but it isnt
|
||||||
|
@ -61,8 +61,7 @@ public class SalvageableSerializer implements TypeSerializer<Salvageable> {
|
|||||||
value.getNode(OVERRIDE_LEVEL_REQUIREMENT).setValue(obj.getMinimumLevel());
|
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
|
//noinspection RedundantCast
|
||||||
Optional<Enum> ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class),
|
Optional<Enum> ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class),
|
||||||
enumConstant); // XXX: intellij says this cast is optional but it isnt
|
enumConstant); // XXX: intellij says this cast is optional but it isnt
|
||||||
|
@ -49,6 +49,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles loading serialized configs with configurate
|
* Handles loading serialized configs with configurate
|
||||||
|
*
|
||||||
* @param <T> the class type of the config
|
* @param <T> the class type of the config
|
||||||
*/
|
*/
|
||||||
public class SerializedConfigLoader<T> {
|
public class SerializedConfigLoader<T> {
|
||||||
@ -61,20 +62,15 @@ public class SerializedConfigLoader<T> {
|
|||||||
"\nOfficial mcMMO Discord - https://discord.gg/bJ7pFS9\n" +
|
"\nOfficial mcMMO Discord - https://discord.gg/bJ7pFS9\n" +
|
||||||
"\nYou can also consult the new official wiki" +
|
"\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!";
|
"\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 String ROOT_NODE_ADDRESS;
|
||||||
|
|
||||||
private final Path path;
|
private final Path path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parent configuration - values are inherited from this
|
* The parent configuration - values are inherited from this
|
||||||
*/
|
*/
|
||||||
private final SerializedConfigLoader parent;
|
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
|
* The loader (mapped to a file) used to read/write the config to disk
|
||||||
*/
|
*/
|
||||||
@ -110,13 +106,12 @@ public class SerializedConfigLoader<T> {
|
|||||||
reload();
|
reload();
|
||||||
save();
|
save();
|
||||||
} catch (Exception e) {
|
} 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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Path getPathFromFileName(String fileName)
|
private Path getPathFromFileName(String fileName) {
|
||||||
{
|
|
||||||
File configFile = new File(ConfigConstants.getConfigFolder(), fileName);
|
File configFile = new File(ConfigConstants.getConfigFolder(), fileName);
|
||||||
return configFile.toPath();
|
return configFile.toPath();
|
||||||
}
|
}
|
||||||
@ -143,7 +138,7 @@ public class SerializedConfigLoader<T> {
|
|||||||
this.loader.save(saveNode);
|
this.loader.save(saveNode);
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException | ObjectMappingException e) {
|
} 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();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -169,7 +164,7 @@ public class SerializedConfigLoader<T> {
|
|||||||
// populate the config object
|
// populate the config object
|
||||||
populateInstance();
|
populateInstance();
|
||||||
} catch (Exception e) {
|
} 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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,18 +5,17 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
|||||||
|
|
||||||
@ConfigSerializable
|
@ConfigSerializable
|
||||||
public class AntiExploit {
|
public class AntiExploit {
|
||||||
|
public static final boolean SPAWNED_MOBS_DEFAULT = true;
|
||||||
private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true;
|
private static final boolean ENDERMEN_ENDERMITE_DEFAULT = true;
|
||||||
private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true;
|
private static final boolean PISTONS_MARK_BLOCKS_DEFAULT = true;
|
||||||
public static final boolean SPAWNED_MOBS_DEFAULT = true;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CONFIG NODES
|
* CONFIG NODES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Setting(value = "Endermen-Endermite-Fix",
|
@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." +
|
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" +
|
"\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;
|
private boolean endermenEndermiteFix = ENDERMEN_ENDERMITE_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Pistons-Mark-Blocks-As-Unnatural",
|
@Setting(value = "Pistons-Mark-Blocks-As-Unnatural",
|
||||||
@ -26,7 +25,7 @@ public class AntiExploit {
|
|||||||
|
|
||||||
@Setting(value = "Spawned-Mobs-Give-No-XP",
|
@Setting(value = "Spawned-Mobs-Give-No-XP",
|
||||||
comment = "Spawned mobs will not give players combat XP." +
|
comment = "Spawned mobs will not give players combat XP." +
|
||||||
"\nThis includes mobs spawned from a nether portal, mob spawner, or eggs." +
|
"\nThis includes mobs spawned from a nether portal, mob spawner, or eggs." +
|
||||||
"\nThis will not include mobs spawned from commands, typically.")
|
"\nThis will not include mobs spawned from commands, typically.")
|
||||||
private boolean spawnedMobsGiveNoXP = SPAWNED_MOBS_DEFAULT;
|
private boolean spawnedMobsGiveNoXP = SPAWNED_MOBS_DEFAULT;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class ConfigSectionExploitAcrobatics {
|
|||||||
"\nPlayers cannot gain XP from falling in the same location twice." +
|
"\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," +
|
"\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." +
|
"\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;
|
private int acrobaticLocationLimit = ACROBATIC_LOCATION_LIMIT_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Prevent-Acrobatics-Farming",
|
@Setting(value = "Prevent-Acrobatics-Farming",
|
||||||
@ -26,16 +26,16 @@ public class ConfigSectionExploitAcrobatics {
|
|||||||
"\nEnabled tracking player fall locations" +
|
"\nEnabled tracking player fall locations" +
|
||||||
"\nEnables tracking when a player last teleported" +
|
"\nEnables tracking when a player last teleported" +
|
||||||
"\nEnables tracking when a player last respawned" +
|
"\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;
|
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." +
|
@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;
|
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." +
|
@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." +
|
"\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;
|
private int rollXPGainCooldownSeconds = ROLL_XP_GAIN_CD_DEFAULT;
|
||||||
|
|
||||||
public int getRollXPGainCooldownSeconds() {
|
public int getRollXPGainCooldownSeconds() {
|
||||||
|
@ -6,24 +6,23 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
|||||||
@ConfigSerializable
|
@ConfigSerializable
|
||||||
public class ConfigSectionExploitFishing {
|
public class ConfigSectionExploitFishing {
|
||||||
|
|
||||||
private static final boolean PREVENT_FISHING_EXPLOITS_DEFAULT = true;
|
|
||||||
public static final int OVER_FISHING_LIMIT_DEFAULT = 3;
|
public static final int OVER_FISHING_LIMIT_DEFAULT = 3;
|
||||||
public static final boolean ADMINS_OVER_FISHING_DEFAULT = true;
|
public static final boolean ADMINS_OVER_FISHING_DEFAULT = true;
|
||||||
public static final float OVER_FISHING_SIZE = 1.0F;
|
public static final float OVER_FISHING_SIZE = 1.0F;
|
||||||
public static final int FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT = 200;
|
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",
|
@Setting(value = "Prevent-Fishing-AFK-Farming",
|
||||||
comment = "Prevents many methods for automatically farming Fishing XP." +
|
comment = "Prevents many methods for automatically farming Fishing XP." +
|
||||||
"\nSuch as farming in the same spot more than once." +
|
"\nSuch as farming in the same spot more than once." +
|
||||||
"\nSpam-click fishing." +
|
"\nSpam-click fishing." +
|
||||||
"\nDefault value: "+PREVENT_FISHING_EXPLOITS_DEFAULT)
|
"\nDefault value: " + PREVENT_FISHING_EXPLOITS_DEFAULT)
|
||||||
private boolean preventFishingExploits = 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" +
|
@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." +
|
"\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." +
|
"\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." +
|
"\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;
|
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." +
|
@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" +
|
"\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," +
|
"\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." +
|
"\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;
|
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." +
|
@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." +
|
"\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;
|
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." +
|
@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." +
|
"\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." +
|
"\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;
|
private long fishingRodSpamMilliseconds = FISHING_ROD_SPAM_THRESHOLD_MILLISECONDS_DEFAULT;
|
||||||
|
|
||||||
public long getFishingRodSpamMilliseconds() {
|
public long getFishingRodSpamMilliseconds() {
|
||||||
|
@ -6,39 +6,38 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
|||||||
@ConfigSerializable
|
@ConfigSerializable
|
||||||
public class ConfigSectionGeneral {
|
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 SPAWNED_MOBS_DEFAULT = true;
|
||||||
public static final boolean TAMED_MOB_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",
|
@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." +
|
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" +
|
"\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;
|
private boolean endermenEndermiteFix = ENDERMEN_ENDERMITE_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Pistons-Mark-Blocks-As-Unnatural",
|
@Setting(value = "Pistons-Mark-Blocks-As-Unnatural",
|
||||||
comment = "Unnatural blocks give no XP." +
|
comment = "Unnatural blocks give no XP." +
|
||||||
"This helps prevent complex automated stone farms that enable auto clickers to gain XP passively." +
|
"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;
|
private boolean pistonsMarkBlocksUnnatural = PISTONS_MARK_BLOCKS_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Spawned-Mobs-Have-Modified-XP-Values",
|
@Setting(value = "Spawned-Mobs-Have-Modified-XP-Values",
|
||||||
comment =
|
comment =
|
||||||
"Spawned mobs will give different XP values than their naturally spawning counterparts" +
|
"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." +
|
"\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." +
|
"\nSpawned mobs include mobs spawned from a nether portal, mob spawner, or eggs." +
|
||||||
"\nThis will not include mobs spawned from commands, typically." +
|
"\nThis will not include mobs spawned from commands, typically." +
|
||||||
"\nDefault value: "+SPAWNED_MOBS_DEFAULT)
|
"\nDefault value: " + SPAWNED_MOBS_DEFAULT)
|
||||||
private boolean markSpawnedMobs = SPAWNED_MOBS_DEFAULT;
|
private boolean markSpawnedMobs = SPAWNED_MOBS_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Tamed-Entities-Have-Modified-XP-Values",
|
@Setting(value = "Tamed-Entities-Have-Modified-XP-Values",
|
||||||
comment =
|
comment =
|
||||||
"Prevents tamed entities from giving normal combat XP when struck by players" +
|
"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." +
|
"\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." +
|
"\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." +
|
"\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)
|
"\nDefault value: " + TAMED_MOB_DEFAULT)
|
||||||
private boolean preventTamedMobXp = TAMED_MOB_DEFAULT;
|
private boolean preventTamedMobXp = TAMED_MOB_DEFAULT;
|
||||||
|
|
||||||
public boolean getEndermenEndermiteFix() {
|
public boolean getEndermenEndermiteFix() {
|
||||||
|
@ -14,12 +14,12 @@ public class ConfigAutomatedBackups {
|
|||||||
"\nYou can find the backups in the following directory inside your mcMMO folder - \\mcMMO\\backup" +
|
"\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." +
|
"\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" +
|
"\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;
|
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?" +
|
@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\"." +
|
"\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;
|
private int backupDayLimit = BACKUP_DAY_LIMIT_DEFAULT;
|
||||||
|
|
||||||
public boolean isZipBackupsEnabled() {
|
public boolean isZipBackupsEnabled() {
|
||||||
|
@ -8,18 +8,16 @@ public class ConfigCommandsAdminChat {
|
|||||||
|
|
||||||
private static final String ADMIN_CHAT_PREFIX_DEFAULT = "&b[&f{0}&b]";
|
private static final String ADMIN_CHAT_PREFIX_DEFAULT = "&b[&f{0}&b]";
|
||||||
private static final boolean USE_DISPLAY_NAMES_DEFAULT = true;
|
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." +
|
@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." +
|
"\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." +
|
"\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." +
|
"\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;
|
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() {
|
public String getAdminChatPrefix() {
|
||||||
return adminChatPrefix;
|
return adminChatPrefix;
|
||||||
|
@ -13,17 +13,17 @@ public class ConfigCommandsInspect {
|
|||||||
|
|
||||||
@Setting(value = "Inspect-Max-Distance", comment = "The maximum range at which players can inspect one another." +
|
@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." +
|
"\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;
|
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." +
|
@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
|
"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;
|
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." +
|
@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." +
|
"\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;
|
private boolean allowInspectOnOfflinePlayers = ALLOW_OFFLINE_INSPECTION_DEFAULT;
|
||||||
|
|
||||||
public double getInspectCommandMaxDistance() {
|
public double getInspectCommandMaxDistance() {
|
||||||
|
@ -10,7 +10,7 @@ public class ConfigDatabaseFlatFile {
|
|||||||
|
|
||||||
@Setting(value = "Scoreboard-Leaderboard-Update-Interval", comment = "How often the scoreboard leaderboards will update." +
|
@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." +
|
"\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;
|
private int leaderboardUpdateIntervalMinutes = LEADERBOARD_SCOREBOARD_UPDATE_INTERVAL_MINUTES_DEFAULT;
|
||||||
|
|
||||||
public int getLeaderboardUpdateIntervalMinutes() {
|
public int getLeaderboardUpdateIntervalMinutes() {
|
||||||
|
@ -19,26 +19,26 @@ public class ConfigSectionCleaning {
|
|||||||
|
|
||||||
@Setting(value = "Purge-Old-Users",
|
@Setting(value = "Purge-Old-Users",
|
||||||
comment = "Turn this on to enable automatic database pruning of 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;
|
private boolean purgeOldUsers = PURGE_OLD_USERS;
|
||||||
|
|
||||||
@Setting(value = "Purge-Powerless-Users", comment = "Powerless users are players who have not" +
|
@Setting(value = "Purge-Powerless-Users", comment = "Powerless users are players who have not" +
|
||||||
" leveled up in a single skill." +
|
" leveled up in a single skill." +
|
||||||
"\nDefault value: "+PURGE_POWERLESS_USERS)
|
"\nDefault value: " + PURGE_POWERLESS_USERS)
|
||||||
private boolean purgePowerlessUsers = PURGE_POWERLESS_USERS;
|
private boolean purgePowerlessUsers = PURGE_POWERLESS_USERS;
|
||||||
|
|
||||||
@Setting(value = "Only-Purge-At-Plugin-Startup",
|
@Setting(value = "Only-Purge-At-Plugin-Startup",
|
||||||
comment = "If set to true, then purging will only happen when the plugin first loads." +
|
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." +
|
"\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." +
|
"\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;
|
private boolean onlyPurgeAtStartup = ONLY_PURGE_AT_STARTUP;
|
||||||
|
|
||||||
@Setting(value = "Purge-Interval-In-Hours", comment = "How many hours between automatic purging?")
|
@Setting(value = "Purge-Interval-In-Hours", comment = "How many hours between automatic purging?")
|
||||||
private int purgeInterval = PURGE_INTERVAL_DEFAULT;
|
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" +
|
@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;
|
private int oldUserCutoffMonths = OLD_USER_CUTOFF_IN_MONTHS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -12,7 +12,7 @@ public class ConfigSectionDatabaseGeneral {
|
|||||||
"\nSaving the database is an expensive operation although it is done in an ASYNC thread." +
|
"\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" +
|
"\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." +
|
"\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;
|
private int saveIntervalMinutes = SAVE_INTERVAL_MINUTES_DEFAULT;
|
||||||
|
|
||||||
public int getSaveIntervalMinutes() {
|
public int getSaveIntervalMinutes() {
|
||||||
|
@ -15,13 +15,13 @@ public class ConfigSectionMaxConnections {
|
|||||||
* CONFIG NODES
|
* 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;
|
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;
|
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;
|
private int save = 30;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -15,13 +15,13 @@ public class ConfigSectionMaxPoolSize {
|
|||||||
* CONFIG NODES
|
* CONFIG NODES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Setting(value = "Misc-Pool", comment = "Default value: "+MISC_DEFAULT)
|
@Setting(value = "Misc-Pool", comment = "Default value: " + MISC_DEFAULT)
|
||||||
private int misc = 10;
|
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;
|
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;
|
private int save = 20;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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" +
|
@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," +
|
"\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." +
|
" 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;
|
private boolean useMySQL = USE_MYSQL_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "User", comment = "Your MySQL User Settings")
|
@Setting(value = "User", comment = "Your MySQL User Settings")
|
||||||
@ -53,10 +53,8 @@ public class ConfigSectionMySQL {
|
|||||||
* HELPER METHODS
|
* HELPER METHODS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int getMaxPoolSize(PoolIdentifier poolIdentifier)
|
public int getMaxPoolSize(PoolIdentifier poolIdentifier) {
|
||||||
{
|
switch (poolIdentifier) {
|
||||||
switch (poolIdentifier)
|
|
||||||
{
|
|
||||||
case LOAD:
|
case LOAD:
|
||||||
return userConfigSectionServer.getConfigSectionMaxPoolSize().getLoad();
|
return userConfigSectionServer.getConfigSectionMaxPoolSize().getLoad();
|
||||||
case SAVE:
|
case SAVE:
|
||||||
@ -68,10 +66,8 @@ public class ConfigSectionMySQL {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxConnections(PoolIdentifier poolIdentifier)
|
public int getMaxConnections(PoolIdentifier poolIdentifier) {
|
||||||
{
|
switch (poolIdentifier) {
|
||||||
switch (poolIdentifier)
|
|
||||||
{
|
|
||||||
case LOAD:
|
case LOAD:
|
||||||
return userConfigSectionServer.getConfigSectionMaxConnections().getLoad();
|
return userConfigSectionServer.getConfigSectionMaxConnections().getLoad();
|
||||||
case SAVE:
|
case SAVE:
|
||||||
|
@ -15,20 +15,20 @@ public class UserConfigSectionServer {
|
|||||||
* CONFIG NODES
|
* CONFIG NODES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Setting(value = "Use-SSL", comment = "Enables SSL for MySQL/MariaDB connections." +
|
@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 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." +
|
"\nIf you run into any issues involving SSL, its best to just turn this off." +
|
||||||
"\nDefault value: "+USE_SSL_DEFAULT)
|
"\nDefault value: " + USE_SSL_DEFAULT)
|
||||||
private boolean useSSL = USE_SSL_DEFAULT;
|
private boolean useSSL = USE_SSL_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Server-Port", comment = "Your MySQL/MariaDB server port" +
|
@Setting(value = "Server-Port", comment = "Your MySQL/MariaDB server port" +
|
||||||
"\nThe default port is typically 3306 for MySQL, but every server configuration is different!" +
|
"\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;
|
private int serverPort = SERVER_PORT_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Server-Address", comment = "The address for your MySQL/MariaDB server" +
|
@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" +
|
"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;
|
private String serverAddress = SERVER_ADDRESS_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Max-Connections", comment = "This setting is the max simultaneous MySQL/MariaDB connections allowed at a time." +
|
@Setting(value = "Max-Connections", comment = "This setting is the max simultaneous MySQL/MariaDB connections allowed at a time." +
|
||||||
|
@ -14,13 +14,13 @@ public class ConfigAuthorAdvertisements {
|
|||||||
comment = "Shows donation info in various mcMMO commands." +
|
comment = "Shows donation info in various mcMMO commands." +
|
||||||
"\nSuch as a paypal link for the author on the /mcmmo command" +
|
"\nSuch as a paypal link for the author on the /mcmmo command" +
|
||||||
"\nSupport through donations helps keep mcMMO development going." +
|
"\nSupport through donations helps keep mcMMO development going." +
|
||||||
"\nDefault value: "+ SHOW_DONATION_DEFAULT)
|
"\nDefault value: " + SHOW_DONATION_DEFAULT)
|
||||||
private boolean showDonationInfo = SHOW_DONATION_DEFAULT;
|
private boolean showDonationInfo = SHOW_DONATION_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Show-Patreon-Links",
|
@Setting(value = "Show-Patreon-Links",
|
||||||
comment = "Shows patreon links for the mcMMO author in various mcMMO commands." +
|
comment = "Shows patreon links for the mcMMO author in various mcMMO commands." +
|
||||||
"\nSupport through Patreon helps keep mcMMO development going" +
|
"\nSupport through Patreon helps keep mcMMO development going" +
|
||||||
"\nDefault value: "+SHOW_PATREON_DEFAULT)
|
"\nDefault value: " + SHOW_PATREON_DEFAULT)
|
||||||
private boolean showPatreonInfo = SHOW_PATREON_DEFAULT;
|
private boolean showPatreonInfo = SHOW_PATREON_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Show-Website-Links", comment = "Allows links to various affiliated websites for mcMMO." +
|
@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 mcMMO authors Patreon" +
|
||||||
"\nThe Official mcMMO Spigot Listing" +
|
"\nThe Official mcMMO Spigot Listing" +
|
||||||
"\nThe Official translation website for mcMMO" +
|
"\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;
|
private boolean showWebsiteLinks = SHOW_WEBSITE_LINKS_DEFAULT;
|
||||||
|
|
||||||
public boolean isShowDonationInfo() {
|
public boolean isShowDonationInfo() {
|
||||||
|
@ -23,7 +23,7 @@ public class ConfigExperienceAcrobatics {
|
|||||||
|
|
||||||
@Setting(value = "Feather-Fall-XP-Multiplier", comment = "Feather Fall grants bonus XP to fall related XP gains." +
|
@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." +
|
"\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;
|
private Double featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT;
|
||||||
|
|
||||||
public HashMap<String, Integer> getAcrobaticsXPMap() {
|
public HashMap<String, Integer> getAcrobaticsXPMap() {
|
||||||
@ -34,15 +34,15 @@ public class ConfigExperienceAcrobatics {
|
|||||||
return featherFallMultiplier;
|
return featherFallMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDodgeXP(){
|
public int getDodgeXP() {
|
||||||
return acrobaticsXPMap.get("Dodge");
|
return acrobaticsXPMap.get("Dodge");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRollXP(){
|
public int getRollXP() {
|
||||||
return acrobaticsXPMap.get("Roll");
|
return acrobaticsXPMap.get("Roll");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFallXP(){
|
public int getFallXP() {
|
||||||
return acrobaticsXPMap.get("Fall");
|
return acrobaticsXPMap.get("Fall");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@ public class ConfigExperienceAlchemy {
|
|||||||
private final static HashMap<String, Integer> ALCHEMY_DEFAULT_XP_MAP;
|
private final static HashMap<String, Integer> ALCHEMY_DEFAULT_XP_MAP;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ALCHEMY_DEFAULT_XP_MAP = new HashMap<>();
|
ALCHEMY_DEFAULT_XP_MAP = new HashMap<>();
|
||||||
ALCHEMY_DEFAULT_XP_MAP.put("Stage-One-Potion", 15);
|
ALCHEMY_DEFAULT_XP_MAP.put("Stage-One-Potion", 15);
|
||||||
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Two-Potion", 30);
|
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Two-Potion", 30);
|
||||||
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Three-Potion", 60);
|
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Three-Potion", 60);
|
||||||
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Four-Potion", 120);
|
ALCHEMY_DEFAULT_XP_MAP.put("Stage-Four-Potion", 120);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Setting(value = "Alchemy-Experience-Values", comment = "Experience values for alchemy.")
|
@Setting(value = "Alchemy-Experience-Values", comment = "Experience values for alchemy.")
|
||||||
@ -26,23 +26,19 @@ public class ConfigExperienceAlchemy {
|
|||||||
return alchemyXPMap;
|
return alchemyXPMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStageOnePotionXP()
|
public int getStageOnePotionXP() {
|
||||||
{
|
|
||||||
return alchemyXPMap.get("Stage-One-Potion");
|
return alchemyXPMap.get("Stage-One-Potion");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStageTwoPotionXP()
|
public int getStageTwoPotionXP() {
|
||||||
{
|
|
||||||
return alchemyXPMap.get("Stage-Two-Potion");
|
return alchemyXPMap.get("Stage-Two-Potion");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStageThreePotionXP()
|
public int getStageThreePotionXP() {
|
||||||
{
|
|
||||||
return alchemyXPMap.get("Stage-Three-Potion");
|
return alchemyXPMap.get("Stage-Three-Potion");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStageFourPotionXP()
|
public int getStageFourPotionXP() {
|
||||||
{
|
|
||||||
return alchemyXPMap.get("Stage-Four-Potion");
|
return alchemyXPMap.get("Stage-Four-Potion");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,10 +48,8 @@ public class ConfigExperienceAlchemy {
|
|||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public int getPotionXPByStage(int potionStage)
|
public int getPotionXPByStage(int potionStage) {
|
||||||
{
|
switch (potionStage) {
|
||||||
switch(potionStage)
|
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
return getStageOnePotionXP();
|
return getStageOnePotionXP();
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -13,7 +13,7 @@ public class ConfigExperienceArchery {
|
|||||||
"\nThe maximum distance bonus is 50, so expect this multiplier to peak at being multiplied against 50." +
|
"\nThe maximum distance bonus is 50, so expect this multiplier to peak at being multiplied against 50." +
|
||||||
"\nDistance is in blocks traveled." +
|
"\nDistance is in blocks traveled." +
|
||||||
"\nThis value is added on to normal XP gains from damage for Archery." +
|
"\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;
|
private double distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT;
|
||||||
|
|
||||||
public double getDistanceMultiplier() {
|
public double getDistanceMultiplier() {
|
||||||
|
@ -9,6 +9,7 @@ import java.util.HashMap;
|
|||||||
public class ConfigExperienceCombat {
|
public class ConfigExperienceCombat {
|
||||||
|
|
||||||
private static final HashMap<String, Double> COMBAT_EXPERIENCE_DEFAULT;
|
private static final HashMap<String, Double> COMBAT_EXPERIENCE_DEFAULT;
|
||||||
|
private static final boolean PVP_XP_ENABLED_DEFAULT = false;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();
|
COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();
|
||||||
@ -73,14 +74,12 @@ public class ConfigExperienceCombat {
|
|||||||
COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0D);
|
COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final boolean PVP_XP_ENABLED_DEFAULT = false;
|
|
||||||
|
|
||||||
@Setting(value = "Combat-XP-Multipliers")
|
@Setting(value = "Combat-XP-Multipliers")
|
||||||
private HashMap<String, Double> combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT;
|
private HashMap<String, Double> combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." +
|
@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." +
|
"\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;
|
private boolean pvpXPEnabled = PVP_XP_ENABLED_DEFAULT;
|
||||||
|
|
||||||
public boolean isPvpXPEnabled() {
|
public boolean isPvpXPEnabled() {
|
||||||
|
@ -8,8 +8,8 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
@ConfigSerializable
|
@ConfigSerializable
|
||||||
public class ConfigExperienceFishing {
|
public class ConfigExperienceFishing {
|
||||||
private final static HashMap<String, Integer> FISHING_DEFAULT_XP_MAP;
|
|
||||||
public static final int SHAKE_XP_DEFAULT = 50;
|
public static final int SHAKE_XP_DEFAULT = 50;
|
||||||
|
private final static HashMap<String, Integer> FISHING_DEFAULT_XP_MAP;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
FISHING_DEFAULT_XP_MAP = new HashMap<>();
|
FISHING_DEFAULT_XP_MAP = new HashMap<>();
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user