mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 11:44:42 +02:00
Changing the style of our code
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
|
||||
plugins {
|
||||
java
|
||||
}
|
||||
|
@ -1,14 +1,15 @@
|
||||
package com.gmail.nossr50.core.api;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class AbilityAPI {
|
||||
private AbilityAPI() {}
|
||||
private AbilityAPI() {
|
||||
}
|
||||
|
||||
public static boolean berserkEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.BERSERK);
|
||||
|
@ -3,25 +3,26 @@ package com.gmail.nossr50.core.api;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.chat.ChatManagerFactory;
|
||||
import com.gmail.nossr50.chat.PartyChatManager;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public final class ChatAPI {
|
||||
private ChatAPI() {}
|
||||
private ChatAPI() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to all members of a party
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender
|
||||
* @param displayName The display name of the sender
|
||||
* @param party The name of the party to send to
|
||||
* @param message The message to send
|
||||
* @param party The name of the party to send to
|
||||
* @param message The message to send
|
||||
*/
|
||||
public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
|
||||
getPartyChatManager(plugin, party).handleChat(sender, displayName, message);
|
||||
@ -32,9 +33,9 @@ public final class ChatAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender to display in the chat
|
||||
* @param party The name of the party to send to
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender to display in the chat
|
||||
* @param party The name of the party to send to
|
||||
* @param message The message to send
|
||||
*/
|
||||
public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
|
||||
@ -46,10 +47,10 @@ public final class ChatAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender
|
||||
* @param displayName The display name of the sender
|
||||
* @param message The message to send
|
||||
* @param message The message to send
|
||||
*/
|
||||
public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
|
||||
ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, displayName, message);
|
||||
@ -60,8 +61,8 @@ public final class ChatAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender to display in the chat
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender to display in the chat
|
||||
* @param message The message to send
|
||||
*/
|
||||
public static void sendAdminChat(Plugin plugin, String sender, String message) {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package com.gmail.nossr50.core.api;
|
||||
|
||||
import com.gmail.nossr50.api.exceptions.*;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.api.exceptions.*;
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainSource;
|
||||
@ -12,7 +13,6 @@ import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -21,7 +21,8 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class ExperienceAPI {
|
||||
private ExperienceAPI() {}
|
||||
private ExperienceAPI() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether given string is a valid type of skill suitable for the
|
||||
@ -62,10 +63,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*
|
||||
* @param XP The amount of XP to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
@Deprecated
|
||||
@ -78,12 +78,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param xpGainReason The reason to gain XP
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason) {
|
||||
@ -95,13 +94,12 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param xpGainReason The reason to gain XP
|
||||
* @param isUnshared true if the XP cannot be shared with party members
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param isUnshared true if the XP cannot be shared with party members
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason, boolean isUnshared) {
|
||||
@ -131,15 +129,13 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @deprecated We're using uuids to get an offline player
|
||||
* replaced by {@link #addRawXPOffline(UUID uuid, String skillType, float XP)}
|
||||
*
|
||||
* @param playerName The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addRawXPOffline(String playerName, String skillType, float XP) {
|
||||
@ -151,11 +147,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The UUID of player to add XP to
|
||||
* @param uuid The UUID of player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param XP The amount of XP to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static void addRawXPOffline(UUID uuid, String skillType, float XP) {
|
||||
@ -167,10 +162,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*
|
||||
* @param XP The amount of XP to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
@Deprecated
|
||||
@ -183,12 +177,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param xpGainReason The reason to gain XP
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addMultipliedXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||
@ -201,10 +194,9 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
@Deprecated
|
||||
@ -217,10 +209,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*
|
||||
* @param XP The amount of XP to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
@Deprecated
|
||||
@ -233,12 +224,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param xpGainReason The reason to gain XP
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||
@ -250,13 +240,12 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param xpGainReason The reason to gain XP
|
||||
* @param isUnshared true if the XP cannot be shared with party members
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param isUnshared true if the XP cannot be shared with party members
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
|
||||
@ -276,10 +265,9 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
@Deprecated
|
||||
@ -295,10 +283,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*
|
||||
* @param XP The amount of XP to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
@Deprecated
|
||||
@ -312,12 +299,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param xpGainReason The reason to gain XP
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||
@ -330,13 +316,12 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @param xpGainReason The reason to gain XP
|
||||
* @param isUnshared true if the XP cannot be shared with party members
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param isUnshared true if the XP cannot be shared with party members
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
|
||||
@ -353,11 +338,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get XP for
|
||||
* @param player The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static int getXP(Player player, String skillType) {
|
||||
@ -370,11 +354,10 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
@Deprecated
|
||||
@ -387,12 +370,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The player to get XP for
|
||||
* @param uuid The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static int getOfflineXP(UUID uuid, String skillType) {
|
||||
@ -404,11 +386,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get XP for
|
||||
* @param player The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static float getXPRaw(Player player, String skillType) {
|
||||
@ -421,11 +402,10 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
@Deprecated
|
||||
@ -438,12 +418,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The player to get XP for
|
||||
* @param uuid The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static float getOfflineXPRaw(UUID uuid, String skillType) {
|
||||
@ -455,11 +434,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get the XP amount for
|
||||
* @param player The player to get the XP amount for
|
||||
* @param skillType The skill to get the XP amount for
|
||||
* @return the total amount of XP needed to reach the next level
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static int getXPToNextLevel(Player player, String skillType) {
|
||||
@ -472,11 +450,10 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the total amount of XP needed to reach the next level
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
@Deprecated
|
||||
@ -489,12 +466,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The player to get XP for
|
||||
* @param uuid The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the total amount of XP needed to reach the next level
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static int getOfflineXPToNextLevel(UUID uuid, String skillType) {
|
||||
@ -506,11 +482,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get the XP amount for
|
||||
* @param player The player to get the XP amount for
|
||||
* @param skillType The skill to get the XP amount for
|
||||
* @return the amount of XP remaining until the next level
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static int getXPRemaining(Player player, String skillType) {
|
||||
@ -527,11 +502,10 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP needed to reach the next level
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
@Deprecated
|
||||
@ -547,12 +521,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The player to get XP for
|
||||
* @param uuid The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP needed to reach the next level
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static float getOfflineXPRemaining(UUID uuid, String skillType) {
|
||||
@ -567,10 +540,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add levels to
|
||||
* @param player The player to add levels to
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
*
|
||||
* @param levels Number of levels to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
public static void addLevel(Player player, String skillType, int levels) {
|
||||
@ -583,10 +555,9 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to add levels to
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
@Deprecated
|
||||
@ -614,11 +585,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The player to add levels to
|
||||
* @param uuid The player to add levels to
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param levels Number of levels to add
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static void addLevelOffline(UUID uuid, String skillType, int levels) {
|
||||
@ -645,10 +615,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get the level for
|
||||
* @param player The player to get the level for
|
||||
* @param skillType The skill to get the level for
|
||||
* @return the level of a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
public static int getLevel(Player player, String skillType) {
|
||||
@ -661,10 +630,9 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to get the level for
|
||||
* @param skillType The skill to get the level for
|
||||
* @param skillType The skill to get the level for
|
||||
* @return the level of a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
@Deprecated
|
||||
@ -677,11 +645,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The player to get the level for
|
||||
* @param uuid The player to get the level for
|
||||
* @param skillType The skill to get the level for
|
||||
* @return the level of a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static int getLevelOffline(UUID uuid, String skillType) {
|
||||
@ -707,7 +674,6 @@ public final class ExperienceAPI {
|
||||
*
|
||||
* @param playerName The player to get the power level for
|
||||
* @return the power level of the player
|
||||
*
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
@Deprecated
|
||||
@ -729,7 +695,6 @@ public final class ExperienceAPI {
|
||||
*
|
||||
* @param uuid The player to get the power level for
|
||||
* @return the power level of the player
|
||||
*
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static int getPowerLevelOffline(UUID uuid) {
|
||||
@ -750,7 +715,6 @@ public final class ExperienceAPI {
|
||||
*
|
||||
* @param skillType The skill to get the level cap for
|
||||
* @return the level cap of a given skill
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
public static int getLevelCap(String skillType) {
|
||||
@ -774,13 +738,11 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
* @param skillType The skill to check
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*
|
||||
* @param skillType The skill to check
|
||||
* @return the position on the leaderboard
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getPlayerRankSkill(String playerName, String skillType) {
|
||||
@ -792,14 +754,12 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The name of the player to check
|
||||
* @param uuid The name of the player to check
|
||||
* @param skillType The skill to check
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*
|
||||
* @return the position on the leaderboard
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static int getPlayerRankSkill(UUID uuid, String skillType) {
|
||||
return mcMMO.getDatabaseManager().readRank(getOfflineProfile(uuid).getPlayerName()).get(getNonChildSkillType(skillType));
|
||||
@ -811,10 +771,8 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
*
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*
|
||||
* @return the position on the power level leaderboard
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getPlayerRankOverall(String playerName) {
|
||||
@ -827,10 +785,8 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The name of the player to check
|
||||
*
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*
|
||||
* @return the position on the power level leaderboard
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static int getPlayerRankOverall(UUID uuid) {
|
||||
return mcMMO.getDatabaseManager().readRank(getOfflineProfile(uuid).getPlayerName()).get(null);
|
||||
@ -841,10 +797,9 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to set the level of
|
||||
* @param skillType The skill to set the level for
|
||||
* @param player The player to set the level of
|
||||
* @param skillType The skill to set the level for
|
||||
* @param skillLevel The value to set the level to
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
public static void setLevel(Player player, String skillType, int skillLevel) {
|
||||
@ -857,10 +812,9 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to set the level of
|
||||
* @param skillType The skill to set the level for
|
||||
* @param skillType The skill to set the level for
|
||||
* @param skillLevel The value to set the level to
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
@Deprecated
|
||||
@ -873,11 +827,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The player to set the level of
|
||||
* @param skillType The skill to set the level for
|
||||
* @param uuid The player to set the level of
|
||||
* @param skillType The skill to set the level for
|
||||
* @param skillLevel The value to set the level to
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
*/
|
||||
public static void setLevelOffline(UUID uuid, String skillType, int skillLevel) {
|
||||
@ -889,11 +842,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to set the XP of
|
||||
* @param player The player to set the XP of
|
||||
* @param skillType The skill to set the XP for
|
||||
* @param newValue The value to set the XP to
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param newValue The value to set the XP to
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static void setXP(Player player, String skillType, int newValue) {
|
||||
@ -906,11 +858,10 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to set the XP of
|
||||
* @param skillType The skill to set the XP for
|
||||
* @param newValue The value to set the XP to
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @param skillType The skill to set the XP for
|
||||
* @param newValue The value to set the XP to
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
@Deprecated
|
||||
@ -923,12 +874,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The player to set the XP of
|
||||
* @param uuid The player to set the XP of
|
||||
* @param skillType The skill to set the XP for
|
||||
* @param newValue The value to set the XP to
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @param newValue The value to set the XP to
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static void setXPOffline(UUID uuid, String skillType, int newValue) {
|
||||
@ -940,11 +890,10 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to change the XP of
|
||||
* @param player The player to change the XP of
|
||||
* @param skillType The skill to change the XP for
|
||||
* @param xp The amount of XP to remove
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @param xp The amount of XP to remove
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static void removeXP(Player player, String skillType, int xp) {
|
||||
@ -957,11 +906,10 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The player to change the XP of
|
||||
* @param skillType The skill to change the XP for
|
||||
* @param xp The amount of XP to remove
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @param skillType The skill to change the XP for
|
||||
* @param xp The amount of XP to remove
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
@Deprecated
|
||||
@ -974,12 +922,11 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param uuid The player to change the XP of
|
||||
* @param uuid The player to change the XP of
|
||||
* @param skillType The skill to change the XP for
|
||||
* @param xp The amount of XP to remove
|
||||
*
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @param xp The amount of XP to remove
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
* @throws InvalidPlayerException if the given player does not exist in the database
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static void removeXPOffline(UUID uuid, String skillType, int xp) {
|
||||
@ -992,7 +939,6 @@ public final class ExperienceAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param level The level to get the amount of XP for
|
||||
*
|
||||
* @throws InvalidFormulaTypeException if the given formulaType is not valid
|
||||
*/
|
||||
public static int getXpNeededToLevel(int level) {
|
||||
@ -1004,9 +950,8 @@ public final class ExperienceAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param level The level to get the amount of XP for
|
||||
* @param level The level to get the amount of XP for
|
||||
* @param formulaType The formula type to get the amount of XP for
|
||||
*
|
||||
* @throws InvalidFormulaTypeException if the given formulaType is not valid
|
||||
*/
|
||||
public static int getXpNeededToLevel(int level, String formulaType) {
|
||||
@ -1015,17 +960,14 @@ public final class ExperienceAPI {
|
||||
|
||||
/**
|
||||
* Will add the appropriate type of XP from the block to the player based on the material of the blocks given
|
||||
*
|
||||
* @param blockStates the blocks to reward XP for
|
||||
* @param mcMMOPlayer the target player
|
||||
*/
|
||||
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer)
|
||||
{
|
||||
for(BlockState bs : blockStates)
|
||||
{
|
||||
for(PrimarySkillType skillType : PrimarySkillType.values())
|
||||
{
|
||||
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
||||
{
|
||||
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer) {
|
||||
for (BlockState bs : blockStates) {
|
||||
for (PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
}
|
||||
@ -1034,16 +976,14 @@ public final class ExperienceAPI {
|
||||
|
||||
/**
|
||||
* Will add the appropriate type of XP from the block to the player based on the material of the blocks given if it matches the given skillType
|
||||
*
|
||||
* @param blockStates the blocks to reward XP for
|
||||
* @param mcMMOPlayer the target player
|
||||
* @param skillType target primary skill
|
||||
* @param skillType target primary skill
|
||||
*/
|
||||
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
|
||||
{
|
||||
for(BlockState bs : blockStates)
|
||||
{
|
||||
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
||||
{
|
||||
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||
for (BlockState bs : blockStates) {
|
||||
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
}
|
||||
@ -1051,15 +991,13 @@ public final class ExperienceAPI {
|
||||
|
||||
/**
|
||||
* Will add the appropriate type of XP from the block to the player based on the material of the blocks given
|
||||
* @param blockState The target blockstate
|
||||
*
|
||||
* @param blockState The target blockstate
|
||||
* @param mcMMOPlayer The target player
|
||||
*/
|
||||
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer)
|
||||
{
|
||||
for(PrimarySkillType skillType : PrimarySkillType.values())
|
||||
{
|
||||
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
||||
{
|
||||
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) {
|
||||
for (PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
}
|
||||
@ -1067,20 +1005,18 @@ public final class ExperienceAPI {
|
||||
|
||||
/**
|
||||
* Will add the appropriate type of XP from the block to the player based on the material of the blocks given if it matches the given skillType
|
||||
* @param blockState The target blockstate
|
||||
*
|
||||
* @param blockState The target blockstate
|
||||
* @param mcMMOPlayer The target player
|
||||
* @param skillType target primary skill
|
||||
* @param skillType target primary skill
|
||||
*/
|
||||
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
|
||||
{
|
||||
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
||||
{
|
||||
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Utility methods follow.
|
||||
private static void addOfflineXP(UUID playerUniqueId, PrimarySkillType skill, int XP) {
|
||||
PlayerProfile profile = getOfflineProfile(playerUniqueId);
|
||||
|
@ -1,20 +1,21 @@
|
||||
package com.gmail.nossr50.core.api;
|
||||
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyLeader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public final class PartyAPI {
|
||||
private PartyAPI() {}
|
||||
private PartyAPI() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the party a player is in.
|
||||
@ -73,7 +74,7 @@ public final class PartyAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add to the party
|
||||
* @param player The player to add to the party
|
||||
* @param partyName The party to add the player to
|
||||
* @deprecated parties can have limits, use the other method
|
||||
*/
|
||||
@ -84,8 +85,7 @@ public final class PartyAPI {
|
||||
if (party == null) {
|
||||
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
||||
} else {
|
||||
if(PartyManager.isPartyFull(player, party))
|
||||
{
|
||||
if (PartyManager.isPartyFull(player, party)) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
||||
return;
|
||||
}
|
||||
@ -97,10 +97,10 @@ public final class PartyAPI {
|
||||
/**
|
||||
* The max party size of the server
|
||||
* 0 or less for no size limit
|
||||
*
|
||||
* @return the max party size on this server
|
||||
*/
|
||||
public static int getMaxPartySize()
|
||||
{
|
||||
public static int getMaxPartySize() {
|
||||
return Config.getInstance().getPartyMaxSize();
|
||||
}
|
||||
|
||||
@ -109,8 +109,8 @@ public final class PartyAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add to the party
|
||||
* @param partyName The party to add the player to
|
||||
* @param player The player to add to the party
|
||||
* @param partyName The party to add the player to
|
||||
* @param bypassLimit if true bypasses party size limits
|
||||
*/
|
||||
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
|
||||
@ -151,7 +151,7 @@ public final class PartyAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param partyName The name of the party to set the leader of
|
||||
* @param partyName The name of the party to set the leader of
|
||||
* @param playerName The playerName to set as leader
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -7,7 +7,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public final class SkillAPI {
|
||||
private SkillAPI() {}
|
||||
private SkillAPI() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of strings with mcMMO's skills
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.core.chat;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.events.chat.McMMOChatEvent;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -40,24 +40,20 @@ public abstract class ChatManager {
|
||||
* Party Chat Spying
|
||||
* Party messages will be copied to people with the mcmmo.admin.chatspy permission node
|
||||
*/
|
||||
if(event instanceof McMMOPartyChatEvent)
|
||||
{
|
||||
if (event instanceof McMMOPartyChatEvent) {
|
||||
//We need to grab the party chat name
|
||||
McMMOPartyChatEvent partyChatEvent = (McMMOPartyChatEvent) event;
|
||||
|
||||
//Find the people with permissions
|
||||
for(Player player : event.getPlugin().getServer().getOnlinePlayers())
|
||||
{
|
||||
for (Player player : event.getPlugin().getServer().getOnlinePlayers()) {
|
||||
//Check for toggled players
|
||||
if(UserManager.getPlayer(player).isPartyChatSpying())
|
||||
{
|
||||
if (UserManager.getPlayer(player).isPartyChatSpying()) {
|
||||
Party adminParty = UserManager.getPlayer(player).getParty();
|
||||
|
||||
//Only message admins not part of this party
|
||||
if(adminParty != null)
|
||||
{
|
||||
if (adminParty != null) {
|
||||
//TODO: Incorporate JSON
|
||||
if(!adminParty.getName().equalsIgnoreCase(partyChatEvent.getParty()))
|
||||
if (!adminParty.getName().equalsIgnoreCase(partyChatEvent.getParty()))
|
||||
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
|
||||
|
@ -2,8 +2,8 @@ package com.gmail.nossr50.core.chat;
|
||||
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.core.runnables.party.PartyChatTask;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class PartyChatManager extends ChatManager {
|
||||
|
@ -32,7 +32,8 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
protected void loadKeys() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
@ -142,59 +143,115 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
*/
|
||||
|
||||
/* EXPLOIT TOGGLES */
|
||||
public boolean isEndermanEndermiteFarmingPrevented() { return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true); }
|
||||
public boolean isEndermanEndermiteFarmingPrevented() {
|
||||
return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true);
|
||||
}
|
||||
|
||||
/* Curve settings */
|
||||
public FormulaType getFormulaType() { return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve")); }
|
||||
public boolean getCumulativeCurveEnabled() { return config.getBoolean("Experience_Formula.Cumulative_Curve", false); }
|
||||
public FormulaType getFormulaType() {
|
||||
return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve"));
|
||||
}
|
||||
|
||||
public boolean getCumulativeCurveEnabled() {
|
||||
return config.getBoolean("Experience_Formula.Cumulative_Curve", false);
|
||||
}
|
||||
|
||||
/* Curve values */
|
||||
public double getMultiplier(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier"); }
|
||||
public int getBase(FormulaType type) { return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base"); }
|
||||
public double getExponent(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent"); }
|
||||
public double getMultiplier(FormulaType type) {
|
||||
return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier");
|
||||
}
|
||||
|
||||
public int getBase(FormulaType type) {
|
||||
return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base");
|
||||
}
|
||||
|
||||
public double getExponent(FormulaType type) {
|
||||
return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent");
|
||||
}
|
||||
|
||||
/* Global modifier */
|
||||
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience_Formula.Multiplier.Global", 1.0); }
|
||||
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience_Formula.Multiplier.Global", value); }
|
||||
public double getExperienceGainsGlobalMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Multiplier.Global", 1.0);
|
||||
}
|
||||
|
||||
public void setExperienceGainsGlobalMultiplier(double value) {
|
||||
config.set("Experience_Formula.Multiplier.Global", value);
|
||||
}
|
||||
|
||||
/* PVP modifier */
|
||||
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0); }
|
||||
public double getPlayerVersusPlayerXP() {
|
||||
return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0);
|
||||
}
|
||||
|
||||
/* Spawned Mob modifier */
|
||||
public double getSpawnedMobXpMultiplier() { return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0); }
|
||||
public double getBredMobXpMultiplier() { return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0); }
|
||||
public double getSpawnedMobXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0);
|
||||
}
|
||||
|
||||
public double getBredMobXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0);
|
||||
}
|
||||
|
||||
/* Skill modifiers */
|
||||
public double getFormulaSkillModifier(PrimarySkillType skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); }
|
||||
public double getFormulaSkillModifier(PrimarySkillType skill) {
|
||||
return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString()));
|
||||
}
|
||||
|
||||
/* Custom XP perk */
|
||||
public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
||||
public double getCustomXpPerkBoost() {
|
||||
return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25);
|
||||
}
|
||||
|
||||
/* Diminished Returns */
|
||||
public float getDiminishedReturnsCap() { return (float) config.getDouble("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D); }
|
||||
public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); }
|
||||
public int getDiminishedReturnsThreshold(PrimarySkillType skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); }
|
||||
public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); }
|
||||
public float getDiminishedReturnsCap() {
|
||||
return (float) config.getDouble("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D);
|
||||
}
|
||||
|
||||
public boolean getDiminishedReturnsEnabled() {
|
||||
return config.getBoolean("Diminished_Returns.Enabled", false);
|
||||
}
|
||||
|
||||
public int getDiminishedReturnsThreshold(PrimarySkillType skill) {
|
||||
return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000);
|
||||
}
|
||||
|
||||
public int getDiminishedReturnsTimeInterval() {
|
||||
return config.getInt("Diminished_Returns.Time_Interval", 10);
|
||||
}
|
||||
|
||||
/* Conversion */
|
||||
public double getExpModifier() { return config.getDouble("Conversion.Exp_Modifier", 1); }
|
||||
public double getExpModifier() {
|
||||
return config.getDouble("Conversion.Exp_Modifier", 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* XP SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); }
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() {
|
||||
return config.getBoolean("Experience.PVP.Rewards", true);
|
||||
}
|
||||
|
||||
/* Combat XP Multipliers */
|
||||
public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); }
|
||||
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
|
||||
public boolean hasCombatXP(EntityType entity) {return config.contains("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
public double getCombatXP(EntityType entity) {
|
||||
return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"));
|
||||
}
|
||||
|
||||
public double getAnimalsXP(EntityType entity) {
|
||||
return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP());
|
||||
}
|
||||
|
||||
public double getAnimalsXP() {
|
||||
return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0);
|
||||
}
|
||||
|
||||
public boolean hasCombatXP(EntityType entity) {
|
||||
return config.contains("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"));
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, Material data)
|
||||
{
|
||||
public int getXp(PrimarySkillType skill, Material data) {
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
if (config.contains(explicitString))
|
||||
@ -209,8 +266,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, BlockData data)
|
||||
{
|
||||
public int getXp(PrimarySkillType skill, BlockData data) {
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
if (config.contains(explicitString))
|
||||
@ -224,8 +280,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data)
|
||||
{
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data) {
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
if (config.contains(explicitString))
|
||||
@ -237,8 +292,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return config.contains(wildcardString);
|
||||
}
|
||||
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data)
|
||||
{
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data) {
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
if (config.contains(explicitString))
|
||||
@ -254,32 +308,35 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
* Experience Bar Stuff
|
||||
*/
|
||||
|
||||
public boolean isPartyExperienceBarsEnabled()
|
||||
{
|
||||
public boolean isPartyExperienceBarsEnabled() {
|
||||
return config.getBoolean("Experience_Bars.Update.Party", true);
|
||||
}
|
||||
|
||||
public boolean isPassiveGainsExperienceBarsEnabled()
|
||||
{
|
||||
public boolean isPassiveGainsExperienceBarsEnabled() {
|
||||
return config.getBoolean("Experience_Bars.Update.Passive", true);
|
||||
}
|
||||
|
||||
public boolean getDoExperienceBarsAlwaysUpdateTitle()
|
||||
{
|
||||
public boolean getDoExperienceBarsAlwaysUpdateTitle() {
|
||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.Enable", false) || getAddExtraDetails();
|
||||
}
|
||||
|
||||
public boolean getAddExtraDetails() { return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);}
|
||||
public boolean isExperienceBarsEnabled() { return config.getBoolean("Experience_Bars.Enable", true); }
|
||||
public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Enable", true);}
|
||||
public boolean getAddExtraDetails() {
|
||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);
|
||||
}
|
||||
|
||||
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType)
|
||||
{
|
||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Color");
|
||||
public boolean isExperienceBarsEnabled() {
|
||||
return config.getBoolean("Experience_Bars.Enable", true);
|
||||
}
|
||||
|
||||
for(BarColor barColor : BarColor.values())
|
||||
{
|
||||
if(barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) {
|
||||
return config.getBoolean("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Enable", true);
|
||||
}
|
||||
|
||||
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType) {
|
||||
String colorValueFromConfig = config.getString("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Color");
|
||||
|
||||
for (BarColor barColor : BarColor.values()) {
|
||||
if (barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
return barColor;
|
||||
}
|
||||
|
||||
@ -287,13 +344,11 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return BarColor.WHITE;
|
||||
}
|
||||
|
||||
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType)
|
||||
{
|
||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".BarStyle");
|
||||
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType) {
|
||||
String colorValueFromConfig = config.getString("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".BarStyle");
|
||||
|
||||
for(BarStyle barStyle : BarStyle.values())
|
||||
{
|
||||
if(barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
for (BarStyle barStyle : BarStyle.values()) {
|
||||
if (barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
return barStyle;
|
||||
}
|
||||
|
||||
@ -302,27 +357,47 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Acrobatics */
|
||||
public int getDodgeXPModifier() { return config.getInt("Experience.Acrobatics.Dodge", 120); }
|
||||
public int getRollXPModifier() { return config.getInt("Experience.Acrobatics.Roll", 80); }
|
||||
public int getFallXPModifier() { return config.getInt("Experience.Acrobatics.Fall", 120); }
|
||||
public int getDodgeXPModifier() {
|
||||
return config.getInt("Experience.Acrobatics.Dodge", 120);
|
||||
}
|
||||
|
||||
public double getFeatherFallXPModifier() { return config.getDouble("Experience.Acrobatics.FeatherFall_Multiplier", 2.0); }
|
||||
public int getRollXPModifier() {
|
||||
return config.getInt("Experience.Acrobatics.Roll", 80);
|
||||
}
|
||||
|
||||
public int getFallXPModifier() {
|
||||
return config.getInt("Experience.Acrobatics.Fall", 120);
|
||||
}
|
||||
|
||||
public double getFeatherFallXPModifier() {
|
||||
return config.getDouble("Experience.Acrobatics.FeatherFall_Multiplier", 2.0);
|
||||
}
|
||||
|
||||
/* Alchemy */
|
||||
public double getPotionXP(PotionStage stage) { return config.getDouble("Experience.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
|
||||
public double getPotionXP(PotionStage stage) {
|
||||
return config.getDouble("Experience.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D);
|
||||
}
|
||||
|
||||
/* Archery */
|
||||
public double getArcheryDistanceMultiplier() { return config.getDouble("Experience.Archery.Distance_Multiplier", 0.025); }
|
||||
public double getArcheryDistanceMultiplier() {
|
||||
return config.getDouble("Experience.Archery.Distance_Multiplier", 0.025);
|
||||
}
|
||||
|
||||
public int getFishingShakeXP() { return config.getInt("Experience.Fishing.Shake", 50); }
|
||||
public int getFishingShakeXP() {
|
||||
return config.getInt("Experience.Fishing.Shake", 50);
|
||||
}
|
||||
|
||||
/* Repair */
|
||||
public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
|
||||
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
||||
public double getRepairXPBase() {
|
||||
return config.getDouble("Experience.Repair.Base", 1000.0);
|
||||
}
|
||||
|
||||
public double getRepairXP(MaterialType repairMaterialType) {
|
||||
return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString()));
|
||||
}
|
||||
|
||||
/* Taming */
|
||||
public int getTamingXP(EntityType type)
|
||||
{
|
||||
public int getTamingXP(EntityType type) {
|
||||
return config.getInt("Experience.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
|
||||
}
|
||||
}
|
||||
|
@ -15,14 +15,12 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomArmorConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customBoots = new ArrayList<Material>();
|
||||
public List<Material> customBoots = new ArrayList<Material>();
|
||||
public List<Material> customChestplates = new ArrayList<Material>();
|
||||
public List<Material> customHelmets = new ArrayList<Material>();
|
||||
public List<Material> customLeggings = new ArrayList<Material>();
|
||||
|
||||
public List<Material> customHelmets = new ArrayList<Material>();
|
||||
public List<Material> customLeggings = new ArrayList<Material>();
|
||||
public List<Repairable> repairables = new ArrayList<Repairable>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
protected CustomArmorConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
|
@ -11,17 +11,15 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomBlockConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||
public List<Material> customOres = new ArrayList<>();
|
||||
public List<Material> customLogs = new ArrayList<>();
|
||||
public List<Material> customLeaves = new ArrayList<>();
|
||||
public List<Material> customAbilityBlocks = new ArrayList<>();
|
||||
|
||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||
public List<Material> customOres = new ArrayList<>();
|
||||
public List<Material> customLogs = new ArrayList<>();
|
||||
public List<Material> customLeaves = new ArrayList<>();
|
||||
public List<Material> customAbilityBlocks = new ArrayList<>();
|
||||
public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
protected CustomBlockConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
@ -84,12 +82,10 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||
customOres.add(blockMaterial);
|
||||
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
||||
}
|
||||
else if (skillType.equals("Woodcutting")) {
|
||||
} else if (skillType.equals("Woodcutting")) {
|
||||
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
||||
customLogs.add(blockMaterial);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
customLeaves.add(blockMaterial);
|
||||
xp = 0; // Leaves don't grant XP
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import java.util.HashMap;
|
||||
|
||||
public class CustomEntityConfig extends ConfigLoader {
|
||||
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
|
||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
|
||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
|
||||
|
||||
protected CustomEntityConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
@ -30,8 +30,7 @@ public class CustomEntityConfig extends ConfigLoader {
|
||||
|
||||
try {
|
||||
clazz = ClassUtils.getClass(className);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
plugin.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
|
||||
plugin.getLogger().warning("This custom entity may not function properly.");
|
||||
}
|
||||
|
@ -17,18 +17,15 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomToolConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customAxes = new ArrayList<Material>();
|
||||
public List<Material> customBows = new ArrayList<Material>();
|
||||
public List<Material> customHoes = new ArrayList<Material>();
|
||||
public List<Material> customAxes = new ArrayList<Material>();
|
||||
public List<Material> customBows = new ArrayList<Material>();
|
||||
public List<Material> customHoes = new ArrayList<Material>();
|
||||
public List<Material> customPickaxes = new ArrayList<Material>();
|
||||
public List<Material> customShovels = new ArrayList<Material>();
|
||||
public List<Material> customSwords = new ArrayList<Material>();
|
||||
|
||||
public List<Material> customShovels = new ArrayList<Material>();
|
||||
public List<Material> customSwords = new ArrayList<Material>();
|
||||
public HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
|
||||
|
||||
public List<Repairable> repairables = new ArrayList<Repairable>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
protected CustomToolConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
|
@ -39,5 +39,6 @@ public class ItemWeightConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
protected void loadKeys() {
|
||||
}
|
||||
}
|
||||
|
@ -131,8 +131,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* AXES */
|
||||
if(getAxeMasteryRankDamageMultiplier() < 0)
|
||||
{
|
||||
if (getAxeMasteryRankDamageMultiplier() < 0) {
|
||||
reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
|
||||
}
|
||||
|
||||
@ -645,18 +644,22 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
protected void loadKeys() {
|
||||
}
|
||||
|
||||
/* GENERAL */
|
||||
public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 1); }
|
||||
public int getStartingLevel() {
|
||||
return config.getInt("Skills.General.StartingLevel", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
|
||||
* It returns a different value depending on whether or not the server is in retro mode
|
||||
*
|
||||
* @return the level at which abilities stop increasing in length
|
||||
*/
|
||||
public int getAbilityLengthCap() {
|
||||
if(!mcMMO.isRetroModeEnabled())
|
||||
if (!mcMMO.isRetroModeEnabled())
|
||||
return config.getInt("Skills.General.Ability.Length.Standard.CapLevel", 50);
|
||||
else
|
||||
return config.getInt("Skills.General.Ability.Length.RetroMode.CapLevel", 500);
|
||||
@ -665,27 +668,31 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
/**
|
||||
* This returns the frequency at which abilities will increase in length
|
||||
* It returns a different value depending on whether or not the server is in retro mode
|
||||
*
|
||||
* @return the number of levels required per ability length increase
|
||||
*/
|
||||
public int getAbilityLength() {
|
||||
if(!mcMMO.isRetroModeEnabled())
|
||||
if (!mcMMO.isRetroModeEnabled())
|
||||
return config.getInt("Skills.General.Ability.Length.Standard.IncreaseLevel", 5);
|
||||
else
|
||||
return config.getInt("Skills.General.Ability.Length.RetroMode.IncreaseLevel", 50);
|
||||
}
|
||||
|
||||
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
|
||||
public int getEnchantBuff() {
|
||||
return config.getInt("Skills.General.Ability.EnchantBuff", 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grabs the max bonus level for a skill used in RNG calculations
|
||||
* All max level values in the config are multiplied by 10 if the server is in retro mode as the values in the config are based around the new 1-100 skill system scaling
|
||||
* A value of 10 in the file will be returned as 100 for retro mode servers to accommodate the change in scaling
|
||||
*
|
||||
* @param subSkillType target subskill
|
||||
* @return the level at which this skills max benefits will be reached on the curve
|
||||
*/
|
||||
public int getMaxBonusLevel(SubSkillType subSkillType) {
|
||||
String keyPath = subSkillType.getAdvConfigAddress() + ".MaxBonusLevel.";
|
||||
return mcMMO.isRetroModeEnabled() ? config.getInt(keyPath+"RetroMode", 1000) : config.getInt(keyPath+"Standard", 100);
|
||||
return mcMMO.isRetroModeEnabled() ? config.getInt(keyPath + "RetroMode", 1000) : config.getInt(keyPath + "Standard", 100);
|
||||
}
|
||||
|
||||
public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) {
|
||||
@ -698,30 +705,25 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
return maximumProbability;
|
||||
}
|
||||
|
||||
public double getMaximumProbability(AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
public double getMaximumProbability(AbstractSubSkill abstractSubSkill) {
|
||||
return getMaximumProbability(abstractSubSkill.getSubSkillType());
|
||||
}
|
||||
|
||||
/* Notification Settings */
|
||||
|
||||
public boolean doesSkillCommandSendBlankLines()
|
||||
{
|
||||
public boolean doesSkillCommandSendBlankLines() {
|
||||
return config.getBoolean("Feedback.SkillCommand.BlankLinesAboveHeader", true);
|
||||
}
|
||||
|
||||
public boolean doesNotificationUseActionBar(NotificationType notificationType)
|
||||
{
|
||||
return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".Enabled", true);
|
||||
public boolean doesNotificationUseActionBar(NotificationType notificationType) {
|
||||
return config.getBoolean("Feedback.ActionBarNotifications." + notificationType.toString() + ".Enabled", true);
|
||||
}
|
||||
|
||||
public boolean doesNotificationSendCopyToChat(NotificationType notificationType)
|
||||
{
|
||||
return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".SendCopyOfMessageToChat", false);
|
||||
public boolean doesNotificationSendCopyToChat(NotificationType notificationType) {
|
||||
return config.getBoolean("Feedback.ActionBarNotifications." + notificationType.toString() + ".SendCopyOfMessageToChat", false);
|
||||
}
|
||||
|
||||
public boolean useTitlesForXPEvent()
|
||||
{
|
||||
public boolean useTitlesForXPEvent() {
|
||||
return config.getBoolean("Feedback.Events.XP.SendTitles", true);
|
||||
}
|
||||
|
||||
@ -740,6 +742,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Used to color our details header in our JSON Hover Object tooltips
|
||||
*
|
||||
* @return the ChatColor for this element
|
||||
*/
|
||||
/*public ChatColor getJSONStatHoverDetailsColor()
|
||||
@ -788,7 +791,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
{
|
||||
return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
|
||||
}*/
|
||||
|
||||
private ChatColor getChatColorFromKey(String keyLocation) {
|
||||
String colorName = config.getString(keyLocation);
|
||||
|
||||
@ -829,180 +831,365 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Some SubSkills have the ability to retain classic functionality
|
||||
*
|
||||
* @param subSkillType SubSkillType with classic functionality
|
||||
* @return true if the subskill is in classic mode
|
||||
*/
|
||||
public boolean isSubSkillClassic(SubSkillType subSkillType)
|
||||
{
|
||||
return config.getBoolean(subSkillType.getAdvConfigAddress()+".Classic");
|
||||
public boolean isSubSkillClassic(SubSkillType subSkillType) {
|
||||
return config.getBoolean(subSkillType.getAdvConfigAddress() + ".Classic");
|
||||
}
|
||||
|
||||
/* ACROBATICS */
|
||||
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }
|
||||
public double getDodgeDamageModifier() {
|
||||
return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D); }
|
||||
public double getRollDamageThreshold() {
|
||||
return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D);
|
||||
}
|
||||
|
||||
public double getGracefulRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D); }
|
||||
public double getGracefulRollDamageThreshold() {
|
||||
return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D);
|
||||
}
|
||||
|
||||
/* ALCHEMY */
|
||||
/*public int getCatalysisUnlockLevel() { return config.getInt("Skills.Alchemy.Catalysis.UnlockLevel", 100); }*/
|
||||
public int getCatalysisMaxBonusLevel() { return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000); }
|
||||
public int getCatalysisMaxBonusLevel() {
|
||||
return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000);
|
||||
}
|
||||
|
||||
public double getCatalysisMinSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D); }
|
||||
public double getCatalysisMaxSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D); }
|
||||
public double getCatalysisMinSpeed() {
|
||||
return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D);
|
||||
}
|
||||
|
||||
public double getCatalysisMaxSpeed() {
|
||||
return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D);
|
||||
}
|
||||
|
||||
//public int getConcoctionsTierLevel(Alchemy.Tier tier) { return config.getInt("Skills.Alchemy.Rank_Levels.Rank_" + rank); }
|
||||
|
||||
/* ARCHERY */
|
||||
public double getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
|
||||
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
|
||||
public double getSkillShotRankDamageMultiplier() {
|
||||
return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D);
|
||||
}
|
||||
|
||||
public double getDazeBonusDamage() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
|
||||
public double getSkillShotDamageMax() {
|
||||
return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D);
|
||||
}
|
||||
|
||||
public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }
|
||||
public double getDazeBonusDamage() {
|
||||
return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D);
|
||||
}
|
||||
|
||||
public double getForceMultiplier() {
|
||||
return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D);
|
||||
}
|
||||
|
||||
/* AXES */
|
||||
public double getAxeMasteryRankDamageMultiplier() { return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D); }
|
||||
public double getAxeMasteryRankDamageMultiplier() {
|
||||
return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D);
|
||||
}
|
||||
|
||||
public double getCriticalStrikesPVPModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D); }
|
||||
public double getCriticalStrikesPVEModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D); }
|
||||
public double getCriticalStrikesPVPModifier() {
|
||||
return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D);
|
||||
}
|
||||
|
||||
public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D); }
|
||||
public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D); }
|
||||
public double getGreaterImpactBonusDamage() { return config.getDouble("Skills.Axes.GreaterImpact.BonusDamage", 2.0D); }
|
||||
public double getCriticalStrikesPVEModifier() {
|
||||
return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getGreaterImpactChance() {
|
||||
return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D);
|
||||
}
|
||||
|
||||
public double getGreaterImpactModifier() {
|
||||
return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D);
|
||||
}
|
||||
|
||||
public double getGreaterImpactBonusDamage() {
|
||||
return config.getDouble("Skills.Axes.GreaterImpact.BonusDamage", 2.0D);
|
||||
}
|
||||
|
||||
public int getArmorImpactIncreaseLevel() {
|
||||
int increaseLevel = config.getInt("Skills.Axes.ArmorImpact.IncreaseLevel", 5);
|
||||
|
||||
if(mcMMO.isRetroModeEnabled())
|
||||
if (mcMMO.isRetroModeEnabled())
|
||||
return increaseLevel * 10;
|
||||
|
||||
return increaseLevel;
|
||||
}
|
||||
|
||||
public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D); }
|
||||
public double getArmorImpactMaxDurabilityDamage() { return config.getDouble("Skills.Axes.ArmorImpact.MaxPercentageDurabilityDamage", 20.0D); }
|
||||
public double getImpactChance() {
|
||||
return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D);
|
||||
}
|
||||
|
||||
public double getSkullSplitterModifier() { return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D); }
|
||||
public double getArmorImpactMaxDurabilityDamage() {
|
||||
return config.getDouble("Skills.Axes.ArmorImpact.MaxPercentageDurabilityDamage", 20.0D);
|
||||
}
|
||||
|
||||
public double getSkullSplitterModifier() {
|
||||
return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D);
|
||||
}
|
||||
|
||||
/* EXCAVATION */
|
||||
//Nothing to configure, everything is already configurable in config.yml
|
||||
|
||||
/* FISHING */
|
||||
//public int getFishingTierLevel(int rank) { return config.getInt("Skills.Fishing.Rank_Levels.Rank_" + rank); }
|
||||
public double getShakeChance(int rank) { return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank); }
|
||||
public int getFishingVanillaXPModifier(int rank) { return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank); }
|
||||
public double getShakeChance(int rank) {
|
||||
return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank);
|
||||
}
|
||||
|
||||
public int getFishermanDietRankChange() { return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200); }
|
||||
public int getFishingVanillaXPModifier(int rank) {
|
||||
return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank);
|
||||
}
|
||||
|
||||
public int getFishermanDietRankChange() {
|
||||
return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200);
|
||||
}
|
||||
|
||||
/*public int getIceFishingUnlockLevel() { return config.getInt("Skills.Fishing.IceFishing.UnlockLevel", 50); }
|
||||
|
||||
public int getMasterAnglerUnlockLevel() {return config.getInt("Skills.Fishing.MasterAngler.UnlockLevel", 125); }*/
|
||||
public double getMasterAnglerBoatModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0); }
|
||||
public double getMasterAnglerBiomeModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0); }
|
||||
public double getMasterAnglerBoatModifier() {
|
||||
return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0);
|
||||
}
|
||||
|
||||
public double getMasterAnglerBiomeModifier() {
|
||||
return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0);
|
||||
}
|
||||
|
||||
/* HERBALISM */
|
||||
public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200); }
|
||||
public int getFarmerDietRankChange() {
|
||||
return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200);
|
||||
}
|
||||
|
||||
public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200); }
|
||||
public int getGreenThumbStageChange() {
|
||||
return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200);
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
public int getBlastMiningRankLevel(int rank) { return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank); }
|
||||
public double getBlastDamageDecrease(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank); }
|
||||
public double getOreBonus(int rank) { return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank); }
|
||||
public double getDebrisReduction(int rank) { return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank); }
|
||||
public int getDropMultiplier(int rank) { return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank); }
|
||||
public double getBlastRadiusModifier(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank); }
|
||||
public int getBlastMiningRankLevel(int rank) {
|
||||
return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getBlastDamageDecrease(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getOreBonus(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getDebrisReduction(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank);
|
||||
}
|
||||
|
||||
public int getDropMultiplier(int rank) {
|
||||
return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getBlastRadiusModifier(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank);
|
||||
}
|
||||
|
||||
/* REPAIR */
|
||||
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
|
||||
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100); }
|
||||
public double getRepairMasteryMaxBonus() {
|
||||
return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D);
|
||||
}
|
||||
|
||||
public int getRepairMasteryMaxLevel() {
|
||||
return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100);
|
||||
}
|
||||
|
||||
/* Arcane Forging */
|
||||
//public int getArcaneForgingRankLevel(int rank) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank); }
|
||||
|
||||
public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true); }
|
||||
public double getArcaneForgingKeepEnchantsChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank); }
|
||||
public boolean getArcaneForgingEnchantLossEnabled() {
|
||||
return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true);
|
||||
}
|
||||
|
||||
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true); }
|
||||
public double getArcaneForgingDowngradeChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank); }
|
||||
public double getArcaneForgingKeepEnchantsChance(int rank) {
|
||||
return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank);
|
||||
}
|
||||
|
||||
public boolean getArcaneForgingDowngradeEnabled() {
|
||||
return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true);
|
||||
}
|
||||
|
||||
public double getArcaneForgingDowngradeChance(int rank) {
|
||||
return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank);
|
||||
}
|
||||
|
||||
/* SALVAGE */
|
||||
//public double getSalvageMaxPercentage() { return config.getDouble("Skills.Salvage.MaxPercentage", 100.0D); }
|
||||
//public int getSalvageMaxPercentageLevel() { return config.getInt("Skills.Salvage.MaxPercentageLevel", 1000); }
|
||||
|
||||
public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); }
|
||||
public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); }
|
||||
public boolean getArcaneSalvageEnchantDowngradeEnabled() {
|
||||
return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true);
|
||||
}
|
||||
|
||||
public boolean getArcaneSalvageEnchantLossEnabled() {
|
||||
return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true);
|
||||
}
|
||||
|
||||
//public int getArcaneSalvageRankLevel(int rank) { return config.getInt("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + rank); }
|
||||
public double getArcaneSalvageExtractFullEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank); }
|
||||
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank); }
|
||||
public double getArcaneSalvageExtractFullEnchantsChance(int rank) {
|
||||
return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) {
|
||||
return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank);
|
||||
}
|
||||
|
||||
/* SMELTING */
|
||||
public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 100); }
|
||||
public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D); }
|
||||
public int getBurnModifierMaxLevel() {
|
||||
return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 100);
|
||||
}
|
||||
|
||||
public double getBurnTimeMultiplier() {
|
||||
return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D);
|
||||
}
|
||||
|
||||
/*public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining.UnlockLevel", 250); }*/
|
||||
public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D); }
|
||||
public double getFluxMiningChance() {
|
||||
return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D);
|
||||
}
|
||||
|
||||
public int getSmeltingRankLevel(int rank) { return config.getInt("Skills.Smelting.Rank_Levels.Rank_" + rank); }
|
||||
public int getSmeltingRankLevel(int rank) {
|
||||
return config.getInt("Skills.Smelting.Rank_Levels.Rank_" + rank);
|
||||
}
|
||||
|
||||
public int getSmeltingVanillaXPBoostMultiplier(int rank) { return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank); }
|
||||
public int getSmeltingVanillaXPBoostMultiplier(int rank) {
|
||||
return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank);
|
||||
}
|
||||
|
||||
/* SWORDS */
|
||||
public double getRuptureDamagePlayer() { return config.getDouble("Skills.Swords.Rupture.DamagePlayer", 1.0); }
|
||||
public double getRuptureDamageMobs() { return config.getDouble("Skills.Swords.Rupture.DamageMobs", 2.0); }
|
||||
public double getRuptureDamagePlayer() {
|
||||
return config.getDouble("Skills.Swords.Rupture.DamagePlayer", 1.0);
|
||||
}
|
||||
|
||||
public int getRuptureMaxTicks() { return config.getInt("Skills.Swords.Rupture.MaxTicks", 8); }
|
||||
public int getRuptureBaseTicks() { return config.getInt("Skills.Swords.Rupture.BaseTicks", 2); }
|
||||
public double getRuptureDamageMobs() {
|
||||
return config.getDouble("Skills.Swords.Rupture.DamageMobs", 2.0);
|
||||
}
|
||||
|
||||
public double getCounterModifier() { return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D); }
|
||||
public int getRuptureMaxTicks() {
|
||||
return config.getInt("Skills.Swords.Rupture.MaxTicks", 8);
|
||||
}
|
||||
|
||||
public double getSerratedStrikesModifier() { return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D); }
|
||||
public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes.RuptureTicks", 5); }
|
||||
public int getRuptureBaseTicks() {
|
||||
return config.getInt("Skills.Swords.Rupture.BaseTicks", 2);
|
||||
}
|
||||
|
||||
public double getCounterModifier() {
|
||||
return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getSerratedStrikesModifier() {
|
||||
return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D);
|
||||
}
|
||||
|
||||
public int getSerratedStrikesTicks() {
|
||||
return config.getInt("Skills.Swords.SerratedStrikes.RuptureTicks", 5);
|
||||
}
|
||||
|
||||
/* TAMING */
|
||||
//public int getGoreRuptureTicks() { return config.getInt("Skills.Taming.Gore.RuptureTicks", 2); }
|
||||
public double getGoreModifier() { return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D); }
|
||||
public double getGoreModifier() {
|
||||
return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D);
|
||||
}
|
||||
|
||||
/*public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood.UnlockLevel", 50); }*/
|
||||
public double getFastFoodChance() { return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D); }
|
||||
public double getPummelChance() { return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D); }
|
||||
public double getFastFoodChance() {
|
||||
return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D);
|
||||
}
|
||||
|
||||
public double getPummelChance() {
|
||||
return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D);
|
||||
}
|
||||
|
||||
//public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware.UnlockLevel", 100); }
|
||||
|
||||
/*public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur.UnlockLevel", 250); }*/
|
||||
public double getThickFurModifier() { return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D); }
|
||||
public double getThickFurModifier() {
|
||||
return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D);
|
||||
}
|
||||
|
||||
/*public int getHolyHoundUnlock() {return config.getInt("Skills.Taming.HolyHound.UnlockLevel", 375); }*/
|
||||
|
||||
/*public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof.UnlockLevel", 500); }*/
|
||||
public double getShockProofModifier() { return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D); }
|
||||
public double getShockProofModifier() {
|
||||
return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D);
|
||||
}
|
||||
|
||||
/*public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws.UnlockLevel", 750); }*/
|
||||
public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); }
|
||||
public double getSharpenedClawsBonus() {
|
||||
return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D);
|
||||
}
|
||||
|
||||
public double getMinHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D); }
|
||||
public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
|
||||
public double getMinHorseJumpStrength() {
|
||||
return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D);
|
||||
}
|
||||
|
||||
public double getMaxHorseJumpStrength() {
|
||||
return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D);
|
||||
}
|
||||
|
||||
/* UNARMED */
|
||||
|
||||
public boolean getDisarmProtected() { return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false); }
|
||||
public boolean getDisarmProtected() {
|
||||
return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false);
|
||||
}
|
||||
|
||||
/* WOODCUTTING */
|
||||
/*public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower.UnlockLevel", 100); }*/
|
||||
|
||||
/* KRAKEN STUFF */
|
||||
public boolean getKrakenEnabled() { return config.getBoolean("Kraken.Enabled", true); }
|
||||
public int getKrakenTriesBeforeRelease() { return config.getInt("Kraken.Tries_Before_Release", 50); }
|
||||
public double getKrakenHealth() { return config.getDouble("Kraken.Health", 50.0D); }
|
||||
public String getKrakenName() { return config.getString("Kraken.Name", "The Kraken"); }
|
||||
public int getKrakenAttackInterval() { return config.getInt("Kraken.Attack_Interval_Seconds", 1); }
|
||||
public double getKrakenAttackDamage() { return config.getDouble("Kraken.Attack_Damage", 1.0D); }
|
||||
public boolean getKrakenGlobalEffectsEnabled() { return config.getBoolean("Kraken.Global_Effects", false); }
|
||||
public boolean getKrakenEscapeAllowed() { return config.getBoolean("Kraken.Allow_Escaping", false); }
|
||||
public String getServerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Server", ""); }
|
||||
public String getPlayerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Player", ""); }
|
||||
public String getPlayerDefeatMessage() { return config.getString("Kraken.Defeated_Message.Killed", ""); }
|
||||
public String getPlayerEscapeMessage() { return config.getString("Kraken.Defeated_Message.Escape", ""); }
|
||||
public boolean getKrakenEnabled() {
|
||||
return config.getBoolean("Kraken.Enabled", true);
|
||||
}
|
||||
|
||||
public int getKrakenTriesBeforeRelease() {
|
||||
return config.getInt("Kraken.Tries_Before_Release", 50);
|
||||
}
|
||||
|
||||
public double getKrakenHealth() {
|
||||
return config.getDouble("Kraken.Health", 50.0D);
|
||||
}
|
||||
|
||||
public String getKrakenName() {
|
||||
return config.getString("Kraken.Name", "The Kraken");
|
||||
}
|
||||
|
||||
public int getKrakenAttackInterval() {
|
||||
return config.getInt("Kraken.Attack_Interval_Seconds", 1);
|
||||
}
|
||||
|
||||
public double getKrakenAttackDamage() {
|
||||
return config.getDouble("Kraken.Attack_Damage", 1.0D);
|
||||
}
|
||||
|
||||
public boolean getKrakenGlobalEffectsEnabled() {
|
||||
return config.getBoolean("Kraken.Global_Effects", false);
|
||||
}
|
||||
|
||||
public boolean getKrakenEscapeAllowed() {
|
||||
return config.getBoolean("Kraken.Allow_Escaping", false);
|
||||
}
|
||||
|
||||
public String getServerUnleashMessage() {
|
||||
return config.getString("Kraken.Unleashed_Message.Server", "");
|
||||
}
|
||||
|
||||
public String getPlayerUnleashMessage() {
|
||||
return config.getString("Kraken.Unleashed_Message.Player", "");
|
||||
}
|
||||
|
||||
public String getPlayerDefeatMessage() {
|
||||
return config.getString("Kraken.Defeated_Message.Killed", "");
|
||||
}
|
||||
|
||||
public String getPlayerEscapeMessage() {
|
||||
return config.getString("Kraken.Defeated_Message.Escape", "");
|
||||
}
|
||||
}
|
||||
|
@ -73,16 +73,15 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.contains("#")) {
|
||||
temp += line + "\n";
|
||||
}
|
||||
else if (line.contains(":")) {
|
||||
} else if (line.contains(":")) {
|
||||
line = line.substring(0, line.indexOf(":") + 1);
|
||||
if (!temp.isEmpty()) {
|
||||
if(comments.containsKey(line)) {
|
||||
if (comments.containsKey(line)) {
|
||||
int index = 0;
|
||||
while(comments.containsKey(line + index)) {
|
||||
while (comments.containsKey(line + index)) {
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
line = line + index;
|
||||
}
|
||||
|
||||
@ -98,7 +97,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
String actualkey = key.substring(0, key.indexOf(":") + 1);
|
||||
|
||||
int index = 0;
|
||||
if(indexed.containsKey(actualkey)) {
|
||||
if (indexed.containsKey(actualkey)) {
|
||||
index = indexed.get(actualkey);
|
||||
}
|
||||
boolean isAtTop = !output.contains("\n" + actualkey);
|
||||
@ -109,8 +108,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
indexed.put(actualkey, index + comments.get(key).length() + actualkey.length() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -126,8 +124,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
writer.write(output);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -246,104 +246,279 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public boolean getIsMetricsEnabled() { return config.getBoolean("Metrics.bstats", true); }
|
||||
public boolean getIsMetricsEnabled() {
|
||||
return config.getBoolean("Metrics.bstats", true);
|
||||
}
|
||||
|
||||
//Retro mode will default the value to true if the config file doesn't contain the entry (server is from a previous mcMMO install)
|
||||
public boolean getIsRetroMode() { return config.getBoolean("General.RetroMode.Enabled", true); }
|
||||
public boolean getIsRetroMode() {
|
||||
return config.getBoolean("General.RetroMode.Enabled", true);
|
||||
}
|
||||
|
||||
public String getLocale() { return config.getString("General.Locale", "en_us"); }
|
||||
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
|
||||
public boolean getShowProfileLoadedMessage() { return config.getBoolean("General.Show_Profile_Loaded", true); }
|
||||
public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
|
||||
public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); }
|
||||
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
|
||||
public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); }
|
||||
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
|
||||
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
|
||||
public String getLocale() {
|
||||
return config.getString("General.Locale", "en_us");
|
||||
}
|
||||
|
||||
public String getPartyChatPrefix() { return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])"); }
|
||||
public boolean getPartyChatColorLeaderName() { return config.getBoolean("Commands.partychat.Gold_Leader_Name", true); }
|
||||
public boolean getPartyDisplayNames() { return config.getBoolean("Commands.partychat.Use_Display_Names", true); }
|
||||
public String getPartyChatPrefixAlly() { return config.getString("Commands.partychat.Chat_Prefix_Format_Ally", "[[GREEN]](A)[[RESET]]"); }
|
||||
public boolean getMOTDEnabled() {
|
||||
return config.getBoolean("General.MOTD_Enabled", true);
|
||||
}
|
||||
|
||||
public String getAdminChatPrefix() { return config.getString("Commands.adminchat.Chat_Prefix_Format", "[[AQUA]][[[WHITE]]{0}[[AQUA]]]"); }
|
||||
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.adminchat.Use_Display_Names", true); }
|
||||
public boolean getShowProfileLoadedMessage() {
|
||||
return config.getBoolean("General.Show_Profile_Loaded", true);
|
||||
}
|
||||
|
||||
public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
|
||||
public long getDatabasePlayerCooldown() { return config.getLong("Commands.Database.Player_Cooldown", 1750); }
|
||||
public boolean getDonateMessageEnabled() {
|
||||
return config.getBoolean("Commands.mcmmo.Donate_Message", true);
|
||||
}
|
||||
|
||||
public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); }
|
||||
public boolean getRefreshChunksEnabled() { return config.getBoolean("General.Refresh_Chunks", false); }
|
||||
public int getSaveInterval() {
|
||||
return config.getInt("General.Save_Interval", 10);
|
||||
}
|
||||
|
||||
public boolean getMobHealthbarEnabled() { return config.getBoolean("Mob_Healthbar.Enabled", true); }
|
||||
public boolean getStatsTrackingEnabled() {
|
||||
return config.getBoolean("General.Stats_Tracking", true);
|
||||
}
|
||||
|
||||
public boolean getUpdateCheckEnabled() {
|
||||
return config.getBoolean("General.Update_Check", true);
|
||||
}
|
||||
|
||||
public boolean getPreferBeta() {
|
||||
return config.getBoolean("General.Prefer_Beta", false);
|
||||
}
|
||||
|
||||
public boolean getVerboseLoggingEnabled() {
|
||||
return config.getBoolean("General.Verbose_Logging", false);
|
||||
}
|
||||
|
||||
public String getPartyChatPrefix() {
|
||||
return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])");
|
||||
}
|
||||
|
||||
public boolean getPartyChatColorLeaderName() {
|
||||
return config.getBoolean("Commands.partychat.Gold_Leader_Name", true);
|
||||
}
|
||||
|
||||
public boolean getPartyDisplayNames() {
|
||||
return config.getBoolean("Commands.partychat.Use_Display_Names", true);
|
||||
}
|
||||
|
||||
public String getPartyChatPrefixAlly() {
|
||||
return config.getString("Commands.partychat.Chat_Prefix_Format_Ally", "[[GREEN]](A)[[RESET]]");
|
||||
}
|
||||
|
||||
public String getAdminChatPrefix() {
|
||||
return config.getString("Commands.adminchat.Chat_Prefix_Format", "[[AQUA]][[[WHITE]]{0}[[AQUA]]]");
|
||||
}
|
||||
|
||||
public boolean getAdminDisplayNames() {
|
||||
return config.getBoolean("Commands.adminchat.Use_Display_Names", true);
|
||||
}
|
||||
|
||||
public boolean getMatchOfflinePlayers() {
|
||||
return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false);
|
||||
}
|
||||
|
||||
public long getDatabasePlayerCooldown() {
|
||||
return config.getLong("Commands.Database.Player_Cooldown", 1750);
|
||||
}
|
||||
|
||||
public boolean getLevelUpSoundsEnabled() {
|
||||
return config.getBoolean("General.LevelUp_Sounds", true);
|
||||
}
|
||||
|
||||
public boolean getRefreshChunksEnabled() {
|
||||
return config.getBoolean("General.Refresh_Chunks", false);
|
||||
}
|
||||
|
||||
public boolean getMobHealthbarEnabled() {
|
||||
return config.getBoolean("Mob_Healthbar.Enabled", true);
|
||||
}
|
||||
|
||||
/* Mob Healthbar */
|
||||
public MobHealthbarType getMobHealthbarDefault() {
|
||||
try {
|
||||
return MobHealthbarType.valueOf(config.getString("Mob_Healthbar.Display_Type", "HEARTS").toUpperCase().trim());
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return MobHealthbarType.HEARTS;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMobHealthbarTime() { return config.getInt("Mob_Healthbar.Display_Time", 3); }
|
||||
public int getMobHealthbarTime() {
|
||||
return config.getInt("Mob_Healthbar.Display_Time", 3);
|
||||
}
|
||||
|
||||
/* Scoreboards */
|
||||
public boolean getScoreboardsEnabled() { return config.getBoolean("Scoreboard.UseScoreboards", true); }
|
||||
public boolean getPowerLevelTagsEnabled() { return config.getBoolean("Scoreboard.Power_Level_Tags", false); }
|
||||
public boolean getAllowKeepBoard() { return config.getBoolean("Scoreboard.Allow_Keep", true); }
|
||||
public int getTipsAmount() { return config.getInt("Scoreboard.Tips_Amount", 5); }
|
||||
public boolean getShowStatsAfterLogin() { return config.getBoolean("Scoreboard.Show_Stats_After_Login", false); }
|
||||
public boolean getScoreboardRainbows() { return config.getBoolean("Scoreboard.Rainbows", false); }
|
||||
public boolean getShowAbilityNames() { return config.getBoolean("Scoreboard.Ability_Names", true); }
|
||||
public boolean getScoreboardsEnabled() {
|
||||
return config.getBoolean("Scoreboard.UseScoreboards", true);
|
||||
}
|
||||
|
||||
public boolean getRankUseChat() { return config.getBoolean("Scoreboard.Types.Rank.Print", false); }
|
||||
public boolean getRankUseBoard() { return config.getBoolean("Scoreboard.Types.Rank.Board", true); }
|
||||
public int getRankScoreboardTime() { return config.getInt("Scoreboard.Types.Rank.Display_Time", 10); }
|
||||
public boolean getPowerLevelTagsEnabled() {
|
||||
return config.getBoolean("Scoreboard.Power_Level_Tags", false);
|
||||
}
|
||||
|
||||
public boolean getTopUseChat() { return config.getBoolean("Scoreboard.Types.Top.Print", true); }
|
||||
public boolean getTopUseBoard() { return config.getBoolean("Scoreboard.Types.Top.Board", true); }
|
||||
public int getTopScoreboardTime() { return config.getInt("Scoreboard.Types.Top.Display_Time", 15); }
|
||||
public boolean getAllowKeepBoard() {
|
||||
return config.getBoolean("Scoreboard.Allow_Keep", true);
|
||||
}
|
||||
|
||||
public boolean getStatsUseChat() { return config.getBoolean("Scoreboard.Types.Stats.Print", true); }
|
||||
public boolean getStatsUseBoard() { return config.getBoolean("Scoreboard.Types.Stats.Board", true); }
|
||||
public int getStatsScoreboardTime() { return config.getInt("Scoreboard.Types.Stats.Display_Time", 10); }
|
||||
public int getTipsAmount() {
|
||||
return config.getInt("Scoreboard.Tips_Amount", 5);
|
||||
}
|
||||
|
||||
public boolean getInspectUseChat() { return config.getBoolean("Scoreboard.Types.Inspect.Print", true); }
|
||||
public boolean getInspectUseBoard() { return config.getBoolean("Scoreboard.Types.Inspect.Board", true); }
|
||||
public int getInspectScoreboardTime() { return config.getInt("Scoreboard.Types.Inspect.Display_Time", 25); }
|
||||
public boolean getShowStatsAfterLogin() {
|
||||
return config.getBoolean("Scoreboard.Show_Stats_After_Login", false);
|
||||
}
|
||||
|
||||
public boolean getCooldownUseChat() { return config.getBoolean("Scoreboard.Types.Cooldown.Print", false); }
|
||||
public boolean getCooldownUseBoard() { return config.getBoolean("Scoreboard.Types.Cooldown.Board", true); }
|
||||
public int getCooldownScoreboardTime() { return config.getInt("Scoreboard.Types.Cooldown.Display_Time", 41); }
|
||||
public boolean getScoreboardRainbows() {
|
||||
return config.getBoolean("Scoreboard.Rainbows", false);
|
||||
}
|
||||
|
||||
public boolean getSkillUseBoard() { return config.getBoolean("Scoreboard.Types.Skill.Board", true); }
|
||||
public int getSkillScoreboardTime() { return config.getInt("Scoreboard.Types.Skill.Display_Time", 30); }
|
||||
public boolean getSkillLevelUpBoard() { return config.getBoolean("Scoreboard.Types.Skill.LevelUp_Board", true); }
|
||||
public int getSkillLevelUpTime() { return config.getInt("Scoreboard.Types.Skill.LevelUp_Time", 5); }
|
||||
public boolean getShowAbilityNames() {
|
||||
return config.getBoolean("Scoreboard.Ability_Names", true);
|
||||
}
|
||||
|
||||
public boolean getRankUseChat() {
|
||||
return config.getBoolean("Scoreboard.Types.Rank.Print", false);
|
||||
}
|
||||
|
||||
public boolean getRankUseBoard() {
|
||||
return config.getBoolean("Scoreboard.Types.Rank.Board", true);
|
||||
}
|
||||
|
||||
public int getRankScoreboardTime() {
|
||||
return config.getInt("Scoreboard.Types.Rank.Display_Time", 10);
|
||||
}
|
||||
|
||||
public boolean getTopUseChat() {
|
||||
return config.getBoolean("Scoreboard.Types.Top.Print", true);
|
||||
}
|
||||
|
||||
public boolean getTopUseBoard() {
|
||||
return config.getBoolean("Scoreboard.Types.Top.Board", true);
|
||||
}
|
||||
|
||||
public int getTopScoreboardTime() {
|
||||
return config.getInt("Scoreboard.Types.Top.Display_Time", 15);
|
||||
}
|
||||
|
||||
public boolean getStatsUseChat() {
|
||||
return config.getBoolean("Scoreboard.Types.Stats.Print", true);
|
||||
}
|
||||
|
||||
public boolean getStatsUseBoard() {
|
||||
return config.getBoolean("Scoreboard.Types.Stats.Board", true);
|
||||
}
|
||||
|
||||
public int getStatsScoreboardTime() {
|
||||
return config.getInt("Scoreboard.Types.Stats.Display_Time", 10);
|
||||
}
|
||||
|
||||
public boolean getInspectUseChat() {
|
||||
return config.getBoolean("Scoreboard.Types.Inspect.Print", true);
|
||||
}
|
||||
|
||||
public boolean getInspectUseBoard() {
|
||||
return config.getBoolean("Scoreboard.Types.Inspect.Board", true);
|
||||
}
|
||||
|
||||
public int getInspectScoreboardTime() {
|
||||
return config.getInt("Scoreboard.Types.Inspect.Display_Time", 25);
|
||||
}
|
||||
|
||||
public boolean getCooldownUseChat() {
|
||||
return config.getBoolean("Scoreboard.Types.Cooldown.Print", false);
|
||||
}
|
||||
|
||||
public boolean getCooldownUseBoard() {
|
||||
return config.getBoolean("Scoreboard.Types.Cooldown.Board", true);
|
||||
}
|
||||
|
||||
public int getCooldownScoreboardTime() {
|
||||
return config.getInt("Scoreboard.Types.Cooldown.Display_Time", 41);
|
||||
}
|
||||
|
||||
public boolean getSkillUseBoard() {
|
||||
return config.getBoolean("Scoreboard.Types.Skill.Board", true);
|
||||
}
|
||||
|
||||
public int getSkillScoreboardTime() {
|
||||
return config.getInt("Scoreboard.Types.Skill.Display_Time", 30);
|
||||
}
|
||||
|
||||
public boolean getSkillLevelUpBoard() {
|
||||
return config.getBoolean("Scoreboard.Types.Skill.LevelUp_Board", true);
|
||||
}
|
||||
|
||||
public int getSkillLevelUpTime() {
|
||||
return config.getInt("Scoreboard.Types.Skill.LevelUp_Time", 5);
|
||||
}
|
||||
|
||||
/* Database Purging */
|
||||
public int getPurgeInterval() { return config.getInt("Database_Purging.Purge_Interval", -1); }
|
||||
public int getOldUsersCutoff() { return config.getInt("Database_Purging.Old_User_Cutoff", 6); }
|
||||
public int getPurgeInterval() {
|
||||
return config.getInt("Database_Purging.Purge_Interval", -1);
|
||||
}
|
||||
|
||||
public int getOldUsersCutoff() {
|
||||
return config.getInt("Database_Purging.Old_User_Cutoff", 6);
|
||||
}
|
||||
|
||||
/* Backups */
|
||||
public boolean getBackupsEnabled() { return config.getBoolean("Backups.Enabled", true); }
|
||||
public boolean getKeepLast24Hours() { return config.getBoolean("Backups.Keep.Last_24_Hours", true); }
|
||||
public boolean getKeepDailyLastWeek() { return config.getBoolean("Backups.Keep.Daily_Last_Week", true); }
|
||||
public boolean getKeepWeeklyPastMonth() { return config.getBoolean("Backups.Keep.Weekly_Past_Months", true); }
|
||||
public boolean getBackupsEnabled() {
|
||||
return config.getBoolean("Backups.Enabled", true);
|
||||
}
|
||||
|
||||
public boolean getKeepLast24Hours() {
|
||||
return config.getBoolean("Backups.Keep.Last_24_Hours", true);
|
||||
}
|
||||
|
||||
public boolean getKeepDailyLastWeek() {
|
||||
return config.getBoolean("Backups.Keep.Daily_Last_Week", true);
|
||||
}
|
||||
|
||||
public boolean getKeepWeeklyPastMonth() {
|
||||
return config.getBoolean("Backups.Keep.Weekly_Past_Months", true);
|
||||
}
|
||||
|
||||
/* mySQL */
|
||||
public boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); }
|
||||
public String getMySQLTablePrefix() { return config.getString("MySQL.Database.TablePrefix", "mcmmo_"); }
|
||||
public String getMySQLDatabaseName() { return getStringIncludingInts("MySQL.Database.Name"); }
|
||||
public String getMySQLUserName() { return getStringIncludingInts("MySQL.Database.User_Name"); }
|
||||
public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
|
||||
public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
|
||||
public String getMySQLUserPassword() { return getStringIncludingInts("MySQL.Database.User_Password"); }
|
||||
public int getMySQLMaxConnections(SQLDatabaseManager.PoolIdentifier identifier) { return config.getInt("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()), 30); }
|
||||
public int getMySQLMaxPoolSize(SQLDatabaseManager.PoolIdentifier identifier) { return config.getInt("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()), 10); }
|
||||
public boolean getMySQLSSL() { return config.getBoolean("MySQL.Server.SSL", true); }
|
||||
public boolean getUseMySQL() {
|
||||
return config.getBoolean("MySQL.Enabled", false);
|
||||
}
|
||||
|
||||
public String getMySQLTablePrefix() {
|
||||
return config.getString("MySQL.Database.TablePrefix", "mcmmo_");
|
||||
}
|
||||
|
||||
public String getMySQLDatabaseName() {
|
||||
return getStringIncludingInts("MySQL.Database.Name");
|
||||
}
|
||||
|
||||
public String getMySQLUserName() {
|
||||
return getStringIncludingInts("MySQL.Database.User_Name");
|
||||
}
|
||||
|
||||
public int getMySQLServerPort() {
|
||||
return config.getInt("MySQL.Server.Port", 3306);
|
||||
}
|
||||
|
||||
public String getMySQLServerName() {
|
||||
return config.getString("MySQL.Server.Address", "localhost");
|
||||
}
|
||||
|
||||
public String getMySQLUserPassword() {
|
||||
return getStringIncludingInts("MySQL.Database.User_Password");
|
||||
}
|
||||
|
||||
public int getMySQLMaxConnections(SQLDatabaseManager.PoolIdentifier identifier) {
|
||||
return config.getInt("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()), 30);
|
||||
}
|
||||
|
||||
public int getMySQLMaxPoolSize(SQLDatabaseManager.PoolIdentifier identifier) {
|
||||
return config.getInt("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()), 10);
|
||||
}
|
||||
|
||||
public boolean getMySQLSSL() {
|
||||
return config.getBoolean("MySQL.Server.SSL", true);
|
||||
}
|
||||
|
||||
private String getStringIncludingInts(String key) {
|
||||
String str = config.getString(key);
|
||||
@ -359,111 +534,282 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Hardcore Mode */
|
||||
public boolean getHardcoreStatLossEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false); }
|
||||
public void setHardcoreStatLossEnabled(PrimarySkillType primarySkillType, boolean enabled) { config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled); }
|
||||
public boolean getHardcoreStatLossEnabled(PrimarySkillType primarySkillType) {
|
||||
return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false);
|
||||
}
|
||||
|
||||
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D); }
|
||||
public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value); }
|
||||
public void setHardcoreStatLossEnabled(PrimarySkillType primarySkillType, boolean enabled) {
|
||||
config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled);
|
||||
}
|
||||
|
||||
public int getHardcoreDeathStatPenaltyLevelThreshold() { return config.getInt("Hardcore.Death_Stat_Loss.Level_Threshold", 0); }
|
||||
public double getHardcoreDeathStatPenaltyPercentage() {
|
||||
return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D);
|
||||
}
|
||||
|
||||
public boolean getHardcoreVampirismEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false); }
|
||||
public void setHardcoreVampirismEnabled(PrimarySkillType primarySkillType, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled); }
|
||||
public void setHardcoreDeathStatPenaltyPercentage(double value) {
|
||||
config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value);
|
||||
}
|
||||
|
||||
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D); }
|
||||
public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); }
|
||||
public int getHardcoreDeathStatPenaltyLevelThreshold() {
|
||||
return config.getInt("Hardcore.Death_Stat_Loss.Level_Threshold", 0);
|
||||
}
|
||||
|
||||
public int getHardcoreVampirismLevelThreshold() { return config.getInt("Hardcore.Vampirism.Level_Threshold", 0); }
|
||||
public boolean getHardcoreVampirismEnabled(PrimarySkillType primarySkillType) {
|
||||
return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false);
|
||||
}
|
||||
|
||||
public void setHardcoreVampirismEnabled(PrimarySkillType primarySkillType, boolean enabled) {
|
||||
config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled);
|
||||
}
|
||||
|
||||
public double getHardcoreVampirismStatLeechPercentage() {
|
||||
return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D);
|
||||
}
|
||||
|
||||
public void setHardcoreVampirismStatLeechPercentage(double value) {
|
||||
config.set("Hardcore.Vampirism.Leech_Percentage", value);
|
||||
}
|
||||
|
||||
public int getHardcoreVampirismLevelThreshold() {
|
||||
return config.getInt("Hardcore.Vampirism.Level_Threshold", 0);
|
||||
}
|
||||
|
||||
/* SMP Mods */
|
||||
public boolean getToolModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
|
||||
public boolean getArmorModsEnabled() { return config.getBoolean("Mods.Armor_Mods_Enabled", false); }
|
||||
public boolean getBlockModsEnabled() { return config.getBoolean("Mods.Block_Mods_Enabled", false); }
|
||||
public boolean getEntityModsEnabled() { return config.getBoolean("Mods.Entity_Mods_Enabled", false); }
|
||||
public boolean getToolModsEnabled() {
|
||||
return config.getBoolean("Mods.Tool_Mods_Enabled", false);
|
||||
}
|
||||
|
||||
public boolean getArmorModsEnabled() {
|
||||
return config.getBoolean("Mods.Armor_Mods_Enabled", false);
|
||||
}
|
||||
|
||||
public boolean getBlockModsEnabled() {
|
||||
return config.getBoolean("Mods.Block_Mods_Enabled", false);
|
||||
}
|
||||
|
||||
public boolean getEntityModsEnabled() {
|
||||
return config.getBoolean("Mods.Entity_Mods_Enabled", false);
|
||||
}
|
||||
|
||||
/* Items */
|
||||
public int getChimaeraUseCost() { return config.getInt("Items.Chimaera_Wing.Use_Cost", 1); }
|
||||
public int getChimaeraRecipeCost() { return config.getInt("Items.Chimaera_Wing.Recipe_Cost", 5); }
|
||||
public Material getChimaeraItem() { return Material.matchMaterial(config.getString("Items.Chimaera_Wing.Item_Name", "Feather")); }
|
||||
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
|
||||
public boolean getChimaeraPreventUseUnderground() { return config.getBoolean("Items.Chimaera_Wing.Prevent_Use_Underground", true); }
|
||||
public boolean getChimaeraUseBedSpawn() { return config.getBoolean("Items.Chimaera_Wing.Use_Bed_Spawn", true); }
|
||||
public int getChimaeraCooldown() { return config.getInt("Items.Chimaera_Wing.Cooldown", 240); }
|
||||
public int getChimaeraWarmup() { return config.getInt("Items.Chimaera_Wing.Warmup", 5); }
|
||||
public int getChimaeraRecentlyHurtCooldown() { return config.getInt("Items.Chimaera_Wing.RecentlyHurt_Cooldown", 60); }
|
||||
public boolean getChimaeraSoundEnabled() { return config.getBoolean("Items.Chimaera_Wing.Sound_Enabled", true); }
|
||||
public int getChimaeraUseCost() {
|
||||
return config.getInt("Items.Chimaera_Wing.Use_Cost", 1);
|
||||
}
|
||||
|
||||
public boolean getFluxPickaxeSoundEnabled() { return config.getBoolean("Items.Flux_Pickaxe.Sound_Enabled", true); }
|
||||
public int getChimaeraRecipeCost() {
|
||||
return config.getInt("Items.Chimaera_Wing.Recipe_Cost", 5);
|
||||
}
|
||||
|
||||
public Material getChimaeraItem() {
|
||||
return Material.matchMaterial(config.getString("Items.Chimaera_Wing.Item_Name", "Feather"));
|
||||
}
|
||||
|
||||
public boolean getChimaeraEnabled() {
|
||||
return config.getBoolean("Items.Chimaera_Wing.Enabled", true);
|
||||
}
|
||||
|
||||
public boolean getChimaeraPreventUseUnderground() {
|
||||
return config.getBoolean("Items.Chimaera_Wing.Prevent_Use_Underground", true);
|
||||
}
|
||||
|
||||
public boolean getChimaeraUseBedSpawn() {
|
||||
return config.getBoolean("Items.Chimaera_Wing.Use_Bed_Spawn", true);
|
||||
}
|
||||
|
||||
public int getChimaeraCooldown() {
|
||||
return config.getInt("Items.Chimaera_Wing.Cooldown", 240);
|
||||
}
|
||||
|
||||
public int getChimaeraWarmup() {
|
||||
return config.getInt("Items.Chimaera_Wing.Warmup", 5);
|
||||
}
|
||||
|
||||
public int getChimaeraRecentlyHurtCooldown() {
|
||||
return config.getInt("Items.Chimaera_Wing.RecentlyHurt_Cooldown", 60);
|
||||
}
|
||||
|
||||
public boolean getChimaeraSoundEnabled() {
|
||||
return config.getBoolean("Items.Chimaera_Wing.Sound_Enabled", true);
|
||||
}
|
||||
|
||||
public boolean getFluxPickaxeSoundEnabled() {
|
||||
return config.getBoolean("Items.Flux_Pickaxe.Sound_Enabled", true);
|
||||
}
|
||||
|
||||
/* Particles */
|
||||
public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); }
|
||||
public boolean getAbilityDeactivationEffectEnabled() { return config.getBoolean("Particles.Ability_Deactivation", true); }
|
||||
public boolean getBleedEffectEnabled() { return config.getBoolean("Particles.Bleed", true); }
|
||||
public boolean getDodgeEffectEnabled() { return config.getBoolean("Particles.Dodge", true); }
|
||||
public boolean getFluxEffectEnabled() { return config.getBoolean("Particles.Flux", true); }
|
||||
public boolean getGreaterImpactEffectEnabled() { return config.getBoolean("Particles.Greater_Impact", true); }
|
||||
public boolean getCallOfTheWildEffectEnabled() { return config.getBoolean("Particles.Call_of_the_Wild", true); }
|
||||
public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp_Enabled", true); }
|
||||
public int getLevelUpEffectsTier() { return config.getInt("Particles.LevelUp_Tier", 100); }
|
||||
public boolean getLargeFireworks() { return config.getBoolean("Particles.LargeFireworks", true); }
|
||||
public boolean getAbilityActivationEffectEnabled() {
|
||||
return config.getBoolean("Particles.Ability_Activation", true);
|
||||
}
|
||||
|
||||
public boolean getAbilityDeactivationEffectEnabled() {
|
||||
return config.getBoolean("Particles.Ability_Deactivation", true);
|
||||
}
|
||||
|
||||
public boolean getBleedEffectEnabled() {
|
||||
return config.getBoolean("Particles.Bleed", true);
|
||||
}
|
||||
|
||||
public boolean getDodgeEffectEnabled() {
|
||||
return config.getBoolean("Particles.Dodge", true);
|
||||
}
|
||||
|
||||
public boolean getFluxEffectEnabled() {
|
||||
return config.getBoolean("Particles.Flux", true);
|
||||
}
|
||||
|
||||
public boolean getGreaterImpactEffectEnabled() {
|
||||
return config.getBoolean("Particles.Greater_Impact", true);
|
||||
}
|
||||
|
||||
public boolean getCallOfTheWildEffectEnabled() {
|
||||
return config.getBoolean("Particles.Call_of_the_Wild", true);
|
||||
}
|
||||
|
||||
public boolean getLevelUpEffectsEnabled() {
|
||||
return config.getBoolean("Particles.LevelUp_Enabled", true);
|
||||
}
|
||||
|
||||
public int getLevelUpEffectsTier() {
|
||||
return config.getInt("Particles.LevelUp_Tier", 100);
|
||||
}
|
||||
|
||||
public boolean getLargeFireworks() {
|
||||
return config.getBoolean("Particles.LargeFireworks", true);
|
||||
}
|
||||
|
||||
/* PARTY SETTINGS */
|
||||
public boolean getPartyFriendlyFire() { return config.getBoolean("Party.FriendlyFire", false);}
|
||||
public int getPartyMaxSize() {return config.getInt("Party.MaxSize", -1); }
|
||||
public int getAutoPartyKickInterval() { return config.getInt("Party.AutoKick_Interval", 12); }
|
||||
public int getAutoPartyKickTime() { return config.getInt("Party.Old_Party_Member_Cutoff", 7); }
|
||||
public boolean getPartyFriendlyFire() {
|
||||
return config.getBoolean("Party.FriendlyFire", false);
|
||||
}
|
||||
|
||||
public double getPartyShareBonusBase() { return config.getDouble("Party.Sharing.ExpShare_bonus_base", 1.1D); }
|
||||
public double getPartyShareBonusIncrease() { return config.getDouble("Party.Sharing.ExpShare_bonus_increase", 0.05D); }
|
||||
public double getPartyShareBonusCap() { return config.getDouble("Party.Sharing.ExpShare_bonus_cap", 1.5D); }
|
||||
public double getPartyShareRange() { return config.getDouble("Party.Sharing.Range", 75.0D); }
|
||||
public int getPartyMaxSize() {
|
||||
return config.getInt("Party.MaxSize", -1);
|
||||
}
|
||||
|
||||
public int getAutoPartyKickInterval() {
|
||||
return config.getInt("Party.AutoKick_Interval", 12);
|
||||
}
|
||||
|
||||
public int getAutoPartyKickTime() {
|
||||
return config.getInt("Party.Old_Party_Member_Cutoff", 7);
|
||||
}
|
||||
|
||||
public double getPartyShareBonusBase() {
|
||||
return config.getDouble("Party.Sharing.ExpShare_bonus_base", 1.1D);
|
||||
}
|
||||
|
||||
public double getPartyShareBonusIncrease() {
|
||||
return config.getDouble("Party.Sharing.ExpShare_bonus_increase", 0.05D);
|
||||
}
|
||||
|
||||
public double getPartyShareBonusCap() {
|
||||
return config.getDouble("Party.Sharing.ExpShare_bonus_cap", 1.5D);
|
||||
}
|
||||
|
||||
public double getPartyShareRange() {
|
||||
return config.getDouble("Party.Sharing.Range", 75.0D);
|
||||
}
|
||||
|
||||
public int getPartyLevelCap() {
|
||||
int cap = config.getInt("Party.Leveling.Level_Cap", 10);
|
||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
||||
}
|
||||
|
||||
public int getPartyXpCurveMultiplier() { return config.getInt("Party.Leveling.Xp_Curve_Modifier", 3); }
|
||||
public boolean getPartyXpNearMembersNeeded() { return config.getBoolean("Party.Leveling.Near_Members_Needed", false); }
|
||||
public boolean getPartyInformAllMembers() { return config.getBoolean("Party.Leveling.Inform_All_Party_Members_On_LevelUp", false); }
|
||||
public int getPartyXpCurveMultiplier() {
|
||||
return config.getInt("Party.Leveling.Xp_Curve_Modifier", 3);
|
||||
}
|
||||
|
||||
public int getPartyFeatureUnlockLevel(PartyFeature partyFeature) { return config.getInt("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel", 0); }
|
||||
public boolean getPartyXpNearMembersNeeded() {
|
||||
return config.getBoolean("Party.Leveling.Near_Members_Needed", false);
|
||||
}
|
||||
|
||||
public boolean getPartyInformAllMembers() {
|
||||
return config.getBoolean("Party.Leveling.Inform_All_Party_Members_On_LevelUp", false);
|
||||
}
|
||||
|
||||
public int getPartyFeatureUnlockLevel(PartyFeature partyFeature) {
|
||||
return config.getInt("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel", 0);
|
||||
}
|
||||
|
||||
/* Party Teleport Settings */
|
||||
public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 120); }
|
||||
public int getPTPCommandWarmup() { return config.getInt("Commands.ptp.Warmup", 5); }
|
||||
public int getPTPCommandRecentlyHurtCooldown() { return config.getInt("Commands.ptp.RecentlyHurt_Cooldown", 60); }
|
||||
public int getPTPCommandTimeout() { return config.getInt("Commands.ptp.Request_Timeout", 300); }
|
||||
public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Accept_Required", true); }
|
||||
public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); }
|
||||
public int getPTPCommandCooldown() {
|
||||
return config.getInt("Commands.ptp.Cooldown", 120);
|
||||
}
|
||||
|
||||
public int getPTPCommandWarmup() {
|
||||
return config.getInt("Commands.ptp.Warmup", 5);
|
||||
}
|
||||
|
||||
public int getPTPCommandRecentlyHurtCooldown() {
|
||||
return config.getInt("Commands.ptp.RecentlyHurt_Cooldown", 60);
|
||||
}
|
||||
|
||||
public int getPTPCommandTimeout() {
|
||||
return config.getInt("Commands.ptp.Request_Timeout", 300);
|
||||
}
|
||||
|
||||
public boolean getPTPCommandConfirmRequired() {
|
||||
return config.getBoolean("Commands.ptp.Accept_Required", true);
|
||||
}
|
||||
|
||||
public boolean getPTPCommandWorldPermissions() {
|
||||
return config.getBoolean("Commands.ptp.World_Based_Permissions", false);
|
||||
}
|
||||
|
||||
/* Inspect command distance */
|
||||
public double getInspectDistance() { return config.getDouble("Commands.inspect.Max_Distance", 30.0D); }
|
||||
public double getInspectDistance() {
|
||||
return config.getDouble("Commands.inspect.Max_Distance", 30.0D);
|
||||
}
|
||||
|
||||
/*
|
||||
* ABILITY SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public boolean getUrlLinksEnabled() { return config.getBoolean("Commands.Skills.URL_Links"); }
|
||||
public boolean getAbilityMessagesEnabled() { return config.getBoolean("Abilities.Messages", true); }
|
||||
public boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); }
|
||||
public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); }
|
||||
public boolean getAbilitiesGateEnabled() { return config.getBoolean("Abilities.Activation.Level_Gate_Abilities"); }
|
||||
public boolean getUrlLinksEnabled() {
|
||||
return config.getBoolean("Commands.Skills.URL_Links");
|
||||
}
|
||||
|
||||
public int getCooldown(SuperAbilityType ability) { return config.getInt("Abilities.Cooldowns." + ability.toString()); }
|
||||
public int getMaxLength(SuperAbilityType ability) { return config.getInt("Abilities.Max_Seconds." + ability.toString()); }
|
||||
public boolean getAbilityMessagesEnabled() {
|
||||
return config.getBoolean("Abilities.Messages", true);
|
||||
}
|
||||
|
||||
public boolean getAbilitiesEnabled() {
|
||||
return config.getBoolean("Abilities.Enabled", true);
|
||||
}
|
||||
|
||||
public boolean getAbilitiesOnlyActivateWhenSneaking() {
|
||||
return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false);
|
||||
}
|
||||
|
||||
public boolean getAbilitiesGateEnabled() {
|
||||
return config.getBoolean("Abilities.Activation.Level_Gate_Abilities");
|
||||
}
|
||||
|
||||
public int getCooldown(SuperAbilityType ability) {
|
||||
return config.getInt("Abilities.Cooldowns." + ability.toString());
|
||||
}
|
||||
|
||||
public int getMaxLength(SuperAbilityType ability) {
|
||||
return config.getInt("Abilities.Max_Seconds." + ability.toString());
|
||||
}
|
||||
|
||||
/* Durability Settings */
|
||||
public int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 1); }
|
||||
public int getAbilityToolDamage() {
|
||||
return config.getInt("Abilities.Tools.Durability_Loss", 1);
|
||||
}
|
||||
|
||||
/* Thresholds */
|
||||
public int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); }
|
||||
public int getTreeFellerThreshold() {
|
||||
return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500);
|
||||
}
|
||||
|
||||
/*
|
||||
* SKILL SETTINGS
|
||||
*/
|
||||
public boolean getDoubleDropsEnabled(PrimarySkillType skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
|
||||
public boolean getDoubleDropsEnabled(PrimarySkillType skill, Material material) {
|
||||
return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_"));
|
||||
}
|
||||
|
||||
public boolean getDoubleDropsDisabled(PrimarySkillType skill) {
|
||||
String skillName = StringUtils.getCapitalized(skill.toString());
|
||||
@ -484,70 +830,177 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Axes */
|
||||
public int getAxesGate() { return config.getInt("Skills.Axes.Ability_Activation_Level_Gate", 10); }
|
||||
public int getAxesGate() {
|
||||
return config.getInt("Skills.Axes.Ability_Activation_Level_Gate", 10);
|
||||
}
|
||||
|
||||
/* Acrobatics */
|
||||
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
|
||||
public int getXPAfterTeleportCooldown() { return config.getInt("Skills.Acrobatics.XP_After_Teleport_Cooldown", 5); }
|
||||
public boolean getDodgeLightningDisabled() {
|
||||
return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false);
|
||||
}
|
||||
|
||||
public int getXPAfterTeleportCooldown() {
|
||||
return config.getInt("Skills.Acrobatics.XP_After_Teleport_Cooldown", 5);
|
||||
}
|
||||
|
||||
/* Alchemy */
|
||||
public boolean getEnabledForHoppers() { return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true); }
|
||||
public boolean getPreventHopperTransferIngredients() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Ingredients", false); }
|
||||
public boolean getPreventHopperTransferBottles() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Bottles", false); }
|
||||
public boolean getEnabledForHoppers() {
|
||||
return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true);
|
||||
}
|
||||
|
||||
public boolean getPreventHopperTransferIngredients() {
|
||||
return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Ingredients", false);
|
||||
}
|
||||
|
||||
public boolean getPreventHopperTransferBottles() {
|
||||
return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Bottles", false);
|
||||
}
|
||||
|
||||
/* Fishing */
|
||||
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
|
||||
public boolean getFishingOverrideTreasures() { return config.getBoolean("Skills.Fishing.Override_Vanilla_Treasures", true); }
|
||||
public boolean getFishingExtraFish() { return config.getBoolean("Skills.Fishing.Extra_Fish", true); }
|
||||
public double getFishingLureModifier() { return config.getDouble("Skills.Fishing.Lure_Modifier", 4.0D); }
|
||||
public boolean getFishingDropsEnabled() {
|
||||
return config.getBoolean("Skills.Fishing.Drops_Enabled", true);
|
||||
}
|
||||
|
||||
public boolean getFishingOverrideTreasures() {
|
||||
return config.getBoolean("Skills.Fishing.Override_Vanilla_Treasures", true);
|
||||
}
|
||||
|
||||
public boolean getFishingExtraFish() {
|
||||
return config.getBoolean("Skills.Fishing.Extra_Fish", true);
|
||||
}
|
||||
|
||||
public double getFishingLureModifier() {
|
||||
return config.getDouble("Skills.Fishing.Lure_Modifier", 4.0D);
|
||||
}
|
||||
|
||||
/* Mining */
|
||||
public Material getDetonatorItem() { return Material.matchMaterial(config.getString("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL")); }
|
||||
public int getMiningGate() { return config.getInt("Skills.Mining.Ability_Activation_Level_Gate", 10); }
|
||||
public Material getDetonatorItem() {
|
||||
return Material.matchMaterial(config.getString("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL"));
|
||||
}
|
||||
|
||||
public int getMiningGate() {
|
||||
return config.getInt("Skills.Mining.Ability_Activation_Level_Gate", 10);
|
||||
}
|
||||
|
||||
/* Excavation */
|
||||
public int getExcavationGate() { return config.getInt("Skills.Excavation.Ability_Activation_Level_Gate", 10); }
|
||||
public int getExcavationGate() {
|
||||
return config.getInt("Skills.Excavation.Ability_Activation_Level_Gate", 10);
|
||||
}
|
||||
|
||||
/* Repair */
|
||||
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
|
||||
public boolean getRepairAnvilPlaceSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Placed_Sounds", true); }
|
||||
public boolean getRepairAnvilUseSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Use_Sounds", true); }
|
||||
public Material getRepairAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK")); }
|
||||
public boolean getRepairConfirmRequired() { return config.getBoolean("Skills.Repair.Confirm_Required", true); }
|
||||
public boolean getRepairAnvilMessagesEnabled() {
|
||||
return config.getBoolean("Skills.Repair.Anvil_Messages", true);
|
||||
}
|
||||
|
||||
public boolean getRepairAnvilPlaceSoundsEnabled() {
|
||||
return config.getBoolean("Skills.Repair.Anvil_Placed_Sounds", true);
|
||||
}
|
||||
|
||||
public boolean getRepairAnvilUseSoundsEnabled() {
|
||||
return config.getBoolean("Skills.Repair.Anvil_Use_Sounds", true);
|
||||
}
|
||||
|
||||
public Material getRepairAnvilMaterial() {
|
||||
return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK"));
|
||||
}
|
||||
|
||||
public boolean getRepairConfirmRequired() {
|
||||
return config.getBoolean("Skills.Repair.Confirm_Required", true);
|
||||
}
|
||||
|
||||
/* Salvage */
|
||||
public boolean getSalvageAnvilMessagesEnabled() { return config.getBoolean("Skills.Salvage.Anvil_Messages", true); }
|
||||
public boolean getSalvageAnvilPlaceSoundsEnabled() { return config.getBoolean("Skills.Salvage.Anvil_Placed_Sounds", true); }
|
||||
public boolean getSalvageAnvilUseSoundsEnabled() { return config.getBoolean("Skills.Salvage.Anvil_Use_Sounds", true); }
|
||||
public Material getSalvageAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Salvage.Anvil_Material", "GOLD_BLOCK")); }
|
||||
public boolean getSalvageConfirmRequired() { return config.getBoolean("Skills.Salvage.Confirm_Required", true); }
|
||||
public boolean getSalvageAnvilMessagesEnabled() {
|
||||
return config.getBoolean("Skills.Salvage.Anvil_Messages", true);
|
||||
}
|
||||
|
||||
public boolean getSalvageAnvilPlaceSoundsEnabled() {
|
||||
return config.getBoolean("Skills.Salvage.Anvil_Placed_Sounds", true);
|
||||
}
|
||||
|
||||
public boolean getSalvageAnvilUseSoundsEnabled() {
|
||||
return config.getBoolean("Skills.Salvage.Anvil_Use_Sounds", true);
|
||||
}
|
||||
|
||||
public Material getSalvageAnvilMaterial() {
|
||||
return Material.matchMaterial(config.getString("Skills.Salvage.Anvil_Material", "GOLD_BLOCK"));
|
||||
}
|
||||
|
||||
public boolean getSalvageConfirmRequired() {
|
||||
return config.getBoolean("Skills.Salvage.Confirm_Required", true);
|
||||
}
|
||||
|
||||
/* Unarmed */
|
||||
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
|
||||
public boolean getUnarmedItemPickupDisabled() { return config.getBoolean("Skills.Unarmed.Item_Pickup_Disabled_Full_Inventory", true); }
|
||||
public boolean getUnarmedItemsAsUnarmed() { return config.getBoolean("Skills.Unarmed.Items_As_Unarmed", false); }
|
||||
public int getUnarmedGate() { return config.getInt("Skills.Unarmed.Ability_Activation_Level_Gate", 10); }
|
||||
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() {
|
||||
return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true);
|
||||
}
|
||||
|
||||
public boolean getUnarmedItemPickupDisabled() {
|
||||
return config.getBoolean("Skills.Unarmed.Item_Pickup_Disabled_Full_Inventory", true);
|
||||
}
|
||||
|
||||
public boolean getUnarmedItemsAsUnarmed() {
|
||||
return config.getBoolean("Skills.Unarmed.Items_As_Unarmed", false);
|
||||
}
|
||||
|
||||
public int getUnarmedGate() {
|
||||
return config.getInt("Skills.Unarmed.Ability_Activation_Level_Gate", 10);
|
||||
}
|
||||
|
||||
/* Swords */
|
||||
public int getSwordsGate() { return config.getInt("Skills.Swords.Ability_Activation_Level_Gate", 10); }
|
||||
public int getSwordsGate() {
|
||||
return config.getInt("Skills.Swords.Ability_Activation_Level_Gate", 10);
|
||||
}
|
||||
|
||||
/* Taming */
|
||||
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
|
||||
public int getTamingCOTWCost(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Amount"); }
|
||||
public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Amount"); }
|
||||
public int getTamingCOTWLength(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ ".Summon_Length"); }
|
||||
public int getTamingCOTWMaxAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ ".Summon_Max_Amount"); }
|
||||
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); }
|
||||
public Material getTamingCOTWMaterial(EntityType type) {
|
||||
return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material"));
|
||||
}
|
||||
|
||||
public int getTamingCOTWCost(EntityType type) {
|
||||
return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Amount");
|
||||
}
|
||||
|
||||
public int getTamingCOTWAmount(EntityType type) {
|
||||
return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Amount");
|
||||
}
|
||||
|
||||
public int getTamingCOTWLength(EntityType type) {
|
||||
return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Length");
|
||||
}
|
||||
|
||||
public int getTamingCOTWMaxAmount(EntityType type) {
|
||||
return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Max_Amount");
|
||||
}
|
||||
|
||||
public double getTamingCOTWRange() {
|
||||
return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D);
|
||||
}
|
||||
|
||||
/* Woodcutting */
|
||||
public boolean getWoodcuttingDoubleDropsEnabled(BlockData material) { return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getFriendlyConfigBlockDataString(material)); }
|
||||
public boolean getTreeFellerSoundsEnabled() { return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true); }
|
||||
public int getWoodcuttingGate() { return config.getInt("Skills.Woodcutting.Ability_Activation_Level_Gate", 10); }
|
||||
public boolean getWoodcuttingDoubleDropsEnabled(BlockData material) {
|
||||
return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getFriendlyConfigBlockDataString(material));
|
||||
}
|
||||
|
||||
public boolean getTreeFellerSoundsEnabled() {
|
||||
return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true);
|
||||
}
|
||||
|
||||
public int getWoodcuttingGate() {
|
||||
return config.getInt("Skills.Woodcutting.Ability_Activation_Level_Gate", 10);
|
||||
}
|
||||
|
||||
/* AFK Leveling */
|
||||
public boolean getAcrobaticsPreventAFK() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }
|
||||
public int getAcrobaticsAFKMaxTries() { return config.getInt("Skills.Acrobatics.Max_Tries_At_Same_Location", 3); }
|
||||
public boolean getHerbalismPreventAFK() { return config.getBoolean("Skills.Herbalism.Prevent_AFK_Leveling", true); }
|
||||
public boolean getAcrobaticsPreventAFK() {
|
||||
return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true);
|
||||
}
|
||||
|
||||
public int getAcrobaticsAFKMaxTries() {
|
||||
return config.getInt("Skills.Acrobatics.Max_Tries_At_Same_Location", 3);
|
||||
}
|
||||
|
||||
public boolean getHerbalismPreventAFK() {
|
||||
return config.getBoolean("Skills.Herbalism.Prevent_AFK_Leveling", true);
|
||||
}
|
||||
|
||||
/* Level Caps */
|
||||
public int getPowerLevelCap() {
|
||||
@ -565,11 +1018,18 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
return config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Ability_Activation_Level_Gate");
|
||||
}*/
|
||||
|
||||
public boolean getTruncateSkills() { return config.getBoolean("General.TruncateSkills", false); }
|
||||
public boolean getTruncateSkills() {
|
||||
return config.getBoolean("General.TruncateSkills", false);
|
||||
}
|
||||
|
||||
/* PVP & PVE Settings */
|
||||
public boolean getPVPEnabled(PrimarySkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
|
||||
public boolean getPVEEnabled(PrimarySkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
|
||||
|
||||
public boolean getPVPEnabled(PrimarySkillType skill) {
|
||||
return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true);
|
||||
}
|
||||
|
||||
public boolean getPVEEnabled(PrimarySkillType skill) {
|
||||
return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true);
|
||||
}
|
||||
|
||||
//public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ import java.util.List;
|
||||
public abstract class ConfigLoader {
|
||||
protected static final mcMMO plugin = mcMMO.p;
|
||||
protected String fileName;
|
||||
private File configFile;
|
||||
protected FileConfiguration config;
|
||||
private File configFile;
|
||||
|
||||
public ConfigLoader(String relativePath, String fileName) {
|
||||
this.fileName = fileName;
|
||||
@ -31,12 +31,10 @@ public abstract class ConfigLoader {
|
||||
|
||||
try {
|
||||
plugin.saveResource(fileName, false); // Normal files
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
plugin.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
plugin.debug("Loading mcMMO " + fileName + " File...");
|
||||
}
|
||||
|
||||
@ -60,8 +58,7 @@ public abstract class ConfigLoader {
|
||||
protected void validate() {
|
||||
if (validateKeys()) {
|
||||
plugin.debug("No errors found in " + fileName + "!");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
plugin.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||
plugin.getServer().getPluginManager().disablePlugin(plugin);
|
||||
plugin.noErrorsInConfigFiles = false;
|
||||
|
@ -7,25 +7,23 @@ import com.gmail.nossr50.util.StringUtils;
|
||||
public class CoreSkillsConfig extends AutoUpdateConfigLoader {
|
||||
private static CoreSkillsConfig instance;
|
||||
|
||||
public CoreSkillsConfig()
|
||||
{
|
||||
public CoreSkillsConfig() {
|
||||
super("coreskills.yml");
|
||||
validate();
|
||||
}
|
||||
|
||||
public static CoreSkillsConfig getInstance() {
|
||||
if (instance == null)
|
||||
return new CoreSkillsConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
public static CoreSkillsConfig getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
return new CoreSkillsConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
|
||||
@ -39,21 +37,21 @@ public class CoreSkillsConfig extends AutoUpdateConfigLoader {
|
||||
/**
|
||||
* Whether or not a skill is enabled
|
||||
* Defaults true
|
||||
*
|
||||
* @param abstractSubSkill SubSkill definition to check
|
||||
* @return true if subskill is enabled
|
||||
*/
|
||||
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
return config.getBoolean(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString())+"."+ abstractSubSkill.getConfigKeyName()+".Enabled", true);
|
||||
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill) {
|
||||
return config.getBoolean(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString()) + "." + abstractSubSkill.getConfigKeyName() + ".Enabled", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not this primary skill is enabled
|
||||
*
|
||||
* @param primarySkillType target primary skill
|
||||
* @return true if enabled
|
||||
*/
|
||||
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType)
|
||||
{
|
||||
return config.getBoolean(StringUtils.getCapitalized(primarySkillType.toString())+".Enabled", true);
|
||||
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) {
|
||||
return config.getBoolean(StringUtils.getCapitalized(primarySkillType.toString()) + ".Enabled", true);
|
||||
}
|
||||
}
|
||||
|
@ -9,26 +9,24 @@ import java.util.List;
|
||||
public class RankConfig extends AutoUpdateConfigLoader {
|
||||
private static RankConfig instance;
|
||||
|
||||
public RankConfig()
|
||||
{
|
||||
public RankConfig() {
|
||||
super("skillranks.yml");
|
||||
validate();
|
||||
this.instance = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
public static RankConfig getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
public static RankConfig getInstance() {
|
||||
if (instance == null)
|
||||
return new RankConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
List<String> reason = new ArrayList<String>();
|
||||
@ -43,12 +41,12 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
*
|
||||
* @param subSkillType target subskill
|
||||
* @param rank the rank we are checking
|
||||
* @param rank the rank we are checking
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank)
|
||||
{
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank) {
|
||||
String key = subSkillType.getRankConfigAddress();
|
||||
|
||||
return findRankByRootAddress(rank, key);
|
||||
@ -56,20 +54,21 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
*
|
||||
* @param abstractSubSkill target subskill
|
||||
* @param rank the rank we are checking
|
||||
* @param rank the rank we are checking
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public int getSubSkillUnlockLevel(AbstractSubSkill abstractSubSkill, int rank)
|
||||
{
|
||||
String key = abstractSubSkill.getPrimaryKeyName()+"."+abstractSubSkill.getConfigKeyName();
|
||||
public int getSubSkillUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
String key = abstractSubSkill.getPrimaryKeyName() + "." + abstractSubSkill.getConfigKeyName();
|
||||
|
||||
return findRankByRootAddress(rank, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
* @param key root address of the subskill in the rankskills.yml file
|
||||
*
|
||||
* @param key root address of the subskill in the rankskills.yml file
|
||||
* @param rank the rank we are checking
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
@ -87,32 +86,27 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
/**
|
||||
* Checks for valid keys for subskill ranks
|
||||
*/
|
||||
private void checkKeys(List<String> reasons)
|
||||
{
|
||||
private void checkKeys(List<String> reasons) {
|
||||
//For now we will only check ranks of stuff I've overhauled
|
||||
for(SubSkillType subSkillType : SubSkillType.values())
|
||||
{
|
||||
for (SubSkillType subSkillType : SubSkillType.values()) {
|
||||
//Keeping track of the rank requirements and making sure there are no logical errors
|
||||
int curRank = 0;
|
||||
int prevRank = 0;
|
||||
|
||||
for(int x = 0; x < subSkillType.getNumRanks(); x++)
|
||||
{
|
||||
if(curRank > 0)
|
||||
for (int x = 0; x < subSkillType.getNumRanks(); x++) {
|
||||
if (curRank > 0)
|
||||
prevRank = curRank;
|
||||
|
||||
curRank = getSubSkillUnlockLevel(subSkillType, x);
|
||||
|
||||
//Do we really care if its below 0? Probably not
|
||||
if(curRank < 0)
|
||||
{
|
||||
reasons.add(subSkillType.getAdvConfigAddress() + ".Rank_Levels.Rank_"+curRank+".LevelReq should be above or equal to 0!");
|
||||
if (curRank < 0) {
|
||||
reasons.add(subSkillType.getAdvConfigAddress() + ".Rank_Levels.Rank_" + curRank + ".LevelReq should be above or equal to 0!");
|
||||
}
|
||||
|
||||
if(prevRank > curRank)
|
||||
{
|
||||
if (prevRank > curRank) {
|
||||
//We're going to allow this but we're going to warn them
|
||||
plugin.getLogger().info("You have the ranks for the subskill "+ subSkillType.toString()+" set up poorly, sequential ranks should have ascending requirements");
|
||||
plugin.getLogger().info("You have the ranks for the subskill " + subSkillType.toString() + " set up poorly, sequential ranks should have ascending requirements");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,42 +5,36 @@ import com.gmail.nossr50.util.sounds.SoundType;
|
||||
public class SoundConfig extends AutoUpdateConfigLoader {
|
||||
private static SoundConfig instance;
|
||||
|
||||
public SoundConfig()
|
||||
{
|
||||
public SoundConfig() {
|
||||
super("sounds.yml");
|
||||
validate();
|
||||
this.instance = this;
|
||||
}
|
||||
|
||||
public static SoundConfig getInstance() {
|
||||
if (instance == null)
|
||||
return new SoundConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
public static SoundConfig getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
return new SoundConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
for(SoundType soundType : SoundType.values())
|
||||
{
|
||||
if(config.getDouble("Sounds."+soundType.toString()+".Volume") < 0)
|
||||
{
|
||||
plugin.getLogger().info("[mcMMO] Sound volume cannot be below 0 for "+soundType.toString());
|
||||
for (SoundType soundType : SoundType.values()) {
|
||||
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
|
||||
plugin.getLogger().info("[mcMMO] Sound volume cannot be below 0 for " + soundType.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
//Sounds with custom pitching don't use pitch values
|
||||
if(!soundType.usesCustomPitch())
|
||||
{
|
||||
if(config.getDouble("Sounds."+soundType.toString()+".Pitch") < 0)
|
||||
{
|
||||
plugin.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for "+soundType.toString());
|
||||
if (!soundType.usesCustomPitch()) {
|
||||
if (config.getDouble("Sounds." + soundType.toString() + ".Pitch") < 0) {
|
||||
plugin.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for " + soundType.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -48,23 +42,22 @@ public class SoundConfig extends AutoUpdateConfigLoader {
|
||||
return true;
|
||||
}
|
||||
|
||||
public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
|
||||
public float getMasterVolume() {
|
||||
return (float) config.getDouble("Sounds.MasterVolume", 1.0);
|
||||
}
|
||||
|
||||
public float getVolume(SoundType soundType)
|
||||
{
|
||||
String key = "Sounds."+soundType.toString()+".Volume";
|
||||
public float getVolume(SoundType soundType) {
|
||||
String key = "Sounds." + soundType.toString() + ".Volume";
|
||||
return (float) config.getDouble(key);
|
||||
}
|
||||
|
||||
public float getPitch(SoundType soundType)
|
||||
{
|
||||
String key = "Sounds."+soundType.toString()+".Pitch";
|
||||
public float getPitch(SoundType soundType) {
|
||||
String key = "Sounds." + soundType.toString() + ".Pitch";
|
||||
return (float) config.getDouble(key);
|
||||
}
|
||||
|
||||
public boolean getIsEnabled(SoundType soundType)
|
||||
{
|
||||
String key = "Sounds."+soundType.toString()+".Enabled";
|
||||
public boolean getIsEnabled(SoundType soundType) {
|
||||
String key = "Sounds." + soundType.toString() + ".Enabled";
|
||||
return config.getBoolean(key, true);
|
||||
}
|
||||
}
|
||||
|
@ -11,24 +11,31 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class WorldBlacklist {
|
||||
private static ArrayList<String> blacklist;
|
||||
private final String blackListFileName = "world_blacklist.txt";
|
||||
private mcMMO plugin;
|
||||
|
||||
private final String blackListFileName = "world_blacklist.txt";
|
||||
|
||||
public WorldBlacklist(mcMMO plugin)
|
||||
{
|
||||
public WorldBlacklist(mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
blacklist = new ArrayList<>();
|
||||
init();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
public static boolean isWorldBlacklisted(World world) {
|
||||
|
||||
for (String s : blacklist) {
|
||||
if (world.getName().equalsIgnoreCase(s))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
//Make the blacklist file if it doesn't exist
|
||||
File blackListFile = new File(plugin.getDataFolder() + File.separator + blackListFileName);
|
||||
|
||||
try {
|
||||
if(!blackListFile.exists())
|
||||
if (!blackListFile.exists())
|
||||
blackListFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -46,12 +53,11 @@ public class WorldBlacklist {
|
||||
|
||||
String currentLine;
|
||||
|
||||
while((currentLine = bufferedReader.readLine()) != null)
|
||||
{
|
||||
if(currentLine.length() == 0)
|
||||
while ((currentLine = bufferedReader.readLine()) != null) {
|
||||
if (currentLine.length() == 0)
|
||||
continue;
|
||||
|
||||
if(!blacklist.contains(currentLine))
|
||||
if (!blacklist.contains(currentLine))
|
||||
blacklist.add(currentLine);
|
||||
}
|
||||
|
||||
@ -60,23 +66,10 @@ public class WorldBlacklist {
|
||||
fileReader.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e)
|
||||
{
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
plugin.getLogger().info(blacklist.size()+" entries in mcMMO World Blacklist");
|
||||
}
|
||||
|
||||
public static boolean isWorldBlacklisted(World world)
|
||||
{
|
||||
|
||||
for(String s : blacklist)
|
||||
{
|
||||
if(world.getName().equalsIgnoreCase(s))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
|
||||
}
|
||||
}
|
||||
|
@ -94,8 +94,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
if (potion != null) {
|
||||
potionMap.put(potionName, potion);
|
||||
pass++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
@ -108,18 +107,17 @@ public class PotionConfig extends ConfigLoader {
|
||||
* Returns null if input cannot be parsed.
|
||||
*
|
||||
* @param potion_section ConfigurationSection to be parsed.
|
||||
*
|
||||
* @return Parsed AlchemyPotion.
|
||||
*/
|
||||
private AlchemyPotion loadPotion(ConfigurationSection potion_section) {
|
||||
try {
|
||||
|
||||
|
||||
|
||||
String name = potion_section.getString("Name");
|
||||
if (name != null) {
|
||||
name = ChatColor.translateAlternateColorCodes('&', name);
|
||||
}
|
||||
|
||||
|
||||
PotionData data;
|
||||
if (!potion_section.contains("PotionData")) { // Backwards config compatability
|
||||
short dataValue = Short.parseShort(potion_section.getName());
|
||||
@ -129,7 +127,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
ConfigurationSection potionData = potion_section.getConfigurationSection("PotionData");
|
||||
data = new PotionData(PotionType.valueOf(potionData.getString("PotionType", "WATER")), potionData.getBoolean("Extended", false), potionData.getBoolean("Upgraded", false));
|
||||
}
|
||||
|
||||
|
||||
Material material = Material.POTION;
|
||||
String mat = potion_section.getString("Material", null);
|
||||
if (mat != null) {
|
||||
@ -154,18 +152,16 @@ public class PotionConfig extends ConfigLoader {
|
||||
|
||||
if (type != null) {
|
||||
effects.add(new PotionEffect(type, duration, amplifier));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mcMMO.p.getLogger().warning("Failed to parse effect for potion " + name + ": " + effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Color color = null;
|
||||
if (potion_section.contains("Color")) {
|
||||
color = Color.fromRGB(potion_section.getInt("Color"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
color = this.generateColor(effects);
|
||||
}
|
||||
|
||||
@ -175,16 +171,14 @@ public class PotionConfig extends ConfigLoader {
|
||||
ItemStack ingredient = loadIngredient(child);
|
||||
if (ingredient != null) {
|
||||
children.put(ingredient, potion_section.getConfigurationSection("Children").getString(child));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mcMMO.p.getLogger().warning("Failed to parse child for potion " + name + ": " + child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new AlchemyPotion(material, data, name, lore, effects, color, children);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.getLogger().warning("Failed to load Alchemy potion: " + potion_section.getName());
|
||||
return null;
|
||||
}
|
||||
@ -196,7 +190,6 @@ public class PotionConfig extends ConfigLoader {
|
||||
* Returns null if input cannot be parsed.
|
||||
*
|
||||
* @param ingredient String representing an ingredient.
|
||||
*
|
||||
* @return Parsed ingredient.
|
||||
*/
|
||||
private ItemStack loadIngredient(String ingredient) {
|
||||
@ -242,7 +235,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
public AlchemyPotion getPotion(String name) {
|
||||
return potionMap.get(name);
|
||||
}
|
||||
|
||||
|
||||
public AlchemyPotion getPotion(ItemStack item) {
|
||||
for (AlchemyPotion potion : potionMap.values()) {
|
||||
if (potion.isSimilar(item)) {
|
||||
@ -251,7 +244,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Color generateColor(List<PotionEffect> effects) {
|
||||
if (effects != null && !effects.isEmpty()) {
|
||||
List<Color> colors = new ArrayList<Color>();
|
||||
@ -269,7 +262,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Color calculateAverageColor(List<Color> colors) {
|
||||
int red = 0;
|
||||
int green = 0;
|
||||
@ -279,8 +272,8 @@ public class PotionConfig extends ConfigLoader {
|
||||
green += color.getGreen();
|
||||
blue += color.getBlue();
|
||||
}
|
||||
Color color = Color.fromRGB(red/colors.size(), green/colors.size(), blue/colors.size());
|
||||
Color color = Color.fromRGB(red / colors.size(), green / colors.size(), blue / colors.size());
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -55,31 +55,23 @@ public class RepairConfig extends ConfigLoader {
|
||||
|
||||
if (ItemUtils.isWoodTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(repairItem)) {
|
||||
} else if (ItemUtils.isStoneTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.STONE;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(repairItem)) {
|
||||
} else if (ItemUtils.isStringTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.STRING;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(repairItem)) {
|
||||
} else if (ItemUtils.isLeatherArmor(repairItem)) {
|
||||
repairMaterialType = MaterialType.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
||||
} else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.IRON;
|
||||
}
|
||||
else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
||||
} else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.GOLD;
|
||||
}
|
||||
else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
|
||||
} else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.DIAMOND;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid MaterialType of " + repairMaterialTypeString);
|
||||
}
|
||||
}
|
||||
@ -112,16 +104,13 @@ public class RepairConfig extends ConfigLoader {
|
||||
|
||||
if (ItemUtils.isMinecraftTool(repairItem)) {
|
||||
repairItemType = ItemType.TOOL;
|
||||
}
|
||||
else if (ItemUtils.isArmor(repairItem)) {
|
||||
} else if (ItemUtils.isArmor(repairItem)) {
|
||||
repairItemType = ItemType.ARMOR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
repairItemType = ItemType.valueOf(repairItemTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid ItemType of " + repairItemTypeString);
|
||||
}
|
||||
}
|
||||
|
@ -50,31 +50,23 @@ public class SalvageConfig extends ConfigLoader {
|
||||
|
||||
if (ItemUtils.isWoodTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(salvageItem)) {
|
||||
} else if (ItemUtils.isStoneTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.STONE;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(salvageItem)) {
|
||||
} else if (ItemUtils.isStringTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.STRING;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
||||
} else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
||||
} else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.IRON;
|
||||
}
|
||||
else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(salvageItem)) {
|
||||
} else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.GOLD;
|
||||
}
|
||||
else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) {
|
||||
} else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.DIAMOND;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase());
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid MaterialType of " + salvageMaterialTypeString);
|
||||
}
|
||||
}
|
||||
@ -99,16 +91,13 @@ public class SalvageConfig extends ConfigLoader {
|
||||
|
||||
if (ItemUtils.isMinecraftTool(salvageItem)) {
|
||||
salvageItemType = ItemType.TOOL;
|
||||
}
|
||||
else if (ItemUtils.isArmor(salvageItem)) {
|
||||
} else if (ItemUtils.isArmor(salvageItem)) {
|
||||
salvageItemType = ItemType.ARMOR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
salvageItemType = ItemType.valueOf(salvageItemTypeString.replace(" ", "_").toUpperCase());
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid ItemType of " + salvageItemTypeString);
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,10 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
|
||||
|
||||
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
|
||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
|
||||
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
|
||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
|
||||
|
||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
||||
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
|
||||
|
||||
private TreasureConfig() {
|
||||
|
@ -13,7 +13,8 @@ import java.util.Collection;
|
||||
|
||||
public final class UserManager {
|
||||
|
||||
private UserManager() {}
|
||||
private UserManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Track a new user.
|
||||
@ -50,12 +51,9 @@ public final class UserManager {
|
||||
mcMMO.p.debug("Saving mcMMOPlayers... (" + onlinePlayers.size() + ")");
|
||||
|
||||
for (Player player : onlinePlayers) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
getPlayer(player).getProfile().save();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.getLogger().warning("Could not save mcMMO player data for player: " + player.getName());
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Loads a specific chunklet
|
||||
*
|
||||
* @param cx Chunklet X coordinate that needs to be loaded
|
||||
* @param cy Chunklet Y coordinate that needs to be loaded
|
||||
* @param cz Chunklet Z coordinate that needs to be loaded
|
||||
* @param cx Chunklet X coordinate that needs to be loaded
|
||||
* @param cy Chunklet Y coordinate that needs to be loaded
|
||||
* @param cz Chunklet Z coordinate that needs to be loaded
|
||||
* @param world World that the chunklet needs to be loaded in
|
||||
*/
|
||||
public void loadChunklet(int cx, int cy, int cz, World world);
|
||||
@ -17,9 +17,9 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Unload a specific chunklet
|
||||
*
|
||||
* @param cx Chunklet X coordinate that needs to be unloaded
|
||||
* @param cy Chunklet Y coordinate that needs to be unloaded
|
||||
* @param cz Chunklet Z coordinate that needs to be unloaded
|
||||
* @param cx Chunklet X coordinate that needs to be unloaded
|
||||
* @param cy Chunklet Y coordinate that needs to be unloaded
|
||||
* @param cz Chunklet Z coordinate that needs to be unloaded
|
||||
* @param world World that the chunklet needs to be unloaded from
|
||||
*/
|
||||
public void unloadChunklet(int cx, int cy, int cz, World world);
|
||||
@ -27,8 +27,8 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Load a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be loaded
|
||||
* @param cz Chunk Z coordinate that is to be loaded
|
||||
* @param cx Chunk X coordinate that is to be loaded
|
||||
* @param cz Chunk Z coordinate that is to be loaded
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void loadChunk(int cx, int cz, World world);
|
||||
@ -36,8 +36,8 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Unload a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be unloaded
|
||||
* @param cz Chunk Z coordinate that is to be unloaded
|
||||
* @param cx Chunk X coordinate that is to be unloaded
|
||||
* @param cz Chunk Z coordinate that is to be unloaded
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void unloadChunk(int cx, int cz, World world);
|
||||
@ -45,8 +45,8 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Informs the ChunkletManager a chunk is loaded
|
||||
*
|
||||
* @param cx Chunk X coordinate that is loaded
|
||||
* @param cz Chunk Z coordinate that is loaded
|
||||
* @param cx Chunk X coordinate that is loaded
|
||||
* @param cz Chunk Z coordinate that is loaded
|
||||
* @param world World that the chunk was loaded in
|
||||
*/
|
||||
public void chunkLoaded(int cx, int cz, World world);
|
||||
@ -54,8 +54,8 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Informs the ChunkletManager a chunk is unloaded
|
||||
*
|
||||
* @param cx Chunk X coordinate that is unloaded
|
||||
* @param cz Chunk Z coordinate that is unloaded
|
||||
* @param cx Chunk X coordinate that is unloaded
|
||||
* @param cz Chunk Z coordinate that is unloaded
|
||||
* @param world World that the chunk was unloaded in
|
||||
*/
|
||||
public void chunkUnloaded(int cx, int cz, World world);
|
||||
@ -94,9 +94,9 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Check to see if a given location is set to true
|
||||
*
|
||||
* @param x X coordinate to check
|
||||
* @param y Y coordinate to check
|
||||
* @param z Z coordinate to check
|
||||
* @param x X coordinate to check
|
||||
* @param y Y coordinate to check
|
||||
* @param z Z coordinate to check
|
||||
* @param world World to check in
|
||||
* @return true if the given location is set to true, false if otherwise
|
||||
*/
|
||||
@ -113,9 +113,9 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Set a given location to true, should create stores as necessary if the location does not exist
|
||||
*
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param world World to set in
|
||||
*/
|
||||
public void setTrue(int x, int y, int z, World world);
|
||||
@ -130,9 +130,9 @@ public interface ChunkletManager {
|
||||
/**
|
||||
* Set a given location to false, should not create stores if one does not exist for the given location
|
||||
*
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param world World to set in
|
||||
*/
|
||||
public void setFalse(int x, int y, int z, World world);
|
||||
|
@ -295,7 +295,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cStore ChunkletStore to save
|
||||
* @param cStore ChunkletStore to save
|
||||
* @param location Where on the disk to put it
|
||||
*/
|
||||
private void serializeChunkletStore(ChunkletStore cStore, File location) {
|
||||
@ -309,17 +309,14 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
fileOut = new FileOutputStream(location);
|
||||
objOut = new ObjectOutputStream(fileOut);
|
||||
objOut.writeObject(cStore);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (objOut != null) {
|
||||
try {
|
||||
objOut.flush();
|
||||
objOut.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -327,8 +324,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
if (fileOut != null) {
|
||||
try {
|
||||
fileOut.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -348,35 +344,29 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
fileIn = new FileInputStream(location);
|
||||
objIn = new ObjectInputStream(fileIn);
|
||||
storeIn = (ChunkletStore) objIn.readObject();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
if (ex instanceof EOFException) {
|
||||
// EOF should only happen on Chunklets that somehow have been corrupted.
|
||||
//mcMMO.p.getLogger().severe("Chunklet data at " + location.toString() + " could not be read due to an EOFException, data in this area will be lost.");
|
||||
return ChunkletStoreFactory.getChunkletStore();
|
||||
}
|
||||
else if (ex instanceof StreamCorruptedException) {
|
||||
} else if (ex instanceof StreamCorruptedException) {
|
||||
// StreamCorrupted happens when the Chunklet is no good.
|
||||
//mcMMO.p.getLogger().severe("Chunklet data at " + location.toString() + " is corrupted, data in this area will be lost.");
|
||||
return ChunkletStoreFactory.getChunkletStore();
|
||||
}
|
||||
else if (ex instanceof UTFDataFormatException) {
|
||||
} else if (ex instanceof UTFDataFormatException) {
|
||||
// UTF happens when the Chunklet cannot be read or is corrupted
|
||||
//mcMMO.p.getLogger().severe("Chunklet data at " + location.toString() + " could not be read due to an UTFDataFormatException, data in this area will be lost.");
|
||||
return ChunkletStoreFactory.getChunkletStore();
|
||||
}
|
||||
|
||||
ex.printStackTrace();
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
} catch (ClassNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (objIn != null) {
|
||||
try {
|
||||
objIn.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -384,8 +374,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
if (fileIn != null) {
|
||||
try {
|
||||
fileIn.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.block.Block;
|
||||
|
||||
/**
|
||||
* A ChunkletManager implementation that does nothing and returns false for all checks.
|
||||
*
|
||||
* <p>
|
||||
* Useful for turning off Chunklets without actually doing much work
|
||||
*/
|
||||
public class NullChunkletManager implements ChunkletManager {
|
||||
|
@ -3,7 +3,9 @@ package com.gmail.nossr50.core.data.blockmeta;
|
||||
public class PrimitiveChunkletStore implements ChunkletStore {
|
||||
private static final long serialVersionUID = -3453078050608607478L;
|
||||
|
||||
/** X, Z, Y */
|
||||
/**
|
||||
* X, Z, Y
|
||||
*/
|
||||
public boolean[][][] store = new boolean[16][16][64];
|
||||
|
||||
@Override
|
||||
|
@ -8,9 +8,42 @@ import java.io.ObjectOutput;
|
||||
public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
private static final long serialVersionUID = 8603603827094383873L;
|
||||
|
||||
/** X, Z, Y */
|
||||
/**
|
||||
* X, Z, Y
|
||||
*/
|
||||
public boolean[][][] store = new boolean[16][16][64];
|
||||
|
||||
/*
|
||||
* The address byte: A single byte which contains x and z values which correspond to the x and z Chunklet-coordinates
|
||||
*
|
||||
* In Chunklet-coordinates, the only valid values are 0-15, so we can fit both into a single byte.
|
||||
*
|
||||
* The top 4 bits of the address byte are for the x value
|
||||
* The bottom 4 bits of the address byte are for the z value
|
||||
*
|
||||
* Examples:
|
||||
* An address byte with a value 00000001 would be split like so:
|
||||
* - x = 0000 = 0
|
||||
* - z = 0001 = 1
|
||||
* => Chunklet coordinates (0, 1)
|
||||
*
|
||||
* 01011111
|
||||
* - x = 0101 = 5
|
||||
* - z = 1111 = 15
|
||||
* => Chunklet coordinates (5, 15)
|
||||
*/
|
||||
protected static byte makeAddressByte(int x, int z) {
|
||||
return (byte) ((x << 4) + z);
|
||||
}
|
||||
|
||||
protected static int addressByteX(byte address) {
|
||||
return (address & 0xF0) >>> 4;
|
||||
}
|
||||
|
||||
protected static int addressByteZ(byte address) {
|
||||
return address & 0x0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrue(int x, int y, int z) {
|
||||
return store[x][z][y];
|
||||
@ -146,35 +179,4 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
|
||||
return column;
|
||||
}
|
||||
|
||||
/*
|
||||
* The address byte: A single byte which contains x and z values which correspond to the x and z Chunklet-coordinates
|
||||
*
|
||||
* In Chunklet-coordinates, the only valid values are 0-15, so we can fit both into a single byte.
|
||||
*
|
||||
* The top 4 bits of the address byte are for the x value
|
||||
* The bottom 4 bits of the address byte are for the z value
|
||||
*
|
||||
* Examples:
|
||||
* An address byte with a value 00000001 would be split like so:
|
||||
* - x = 0000 = 0
|
||||
* - z = 0001 = 1
|
||||
* => Chunklet coordinates (0, 1)
|
||||
*
|
||||
* 01011111
|
||||
* - x = 0101 = 5
|
||||
* - z = 1111 = 15
|
||||
* => Chunklet coordinates (5, 15)
|
||||
*/
|
||||
protected static byte makeAddressByte(int x, int z) {
|
||||
return (byte) ((x << 4) + z);
|
||||
}
|
||||
|
||||
protected static int addressByteX(byte address) {
|
||||
return (address & 0xF0) >>> 4;
|
||||
}
|
||||
|
||||
protected static int addressByteZ(byte address) {
|
||||
return address & 0x0F;
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Loads a specific chunklet
|
||||
*
|
||||
* @param cx Chunklet X coordinate that needs to be loaded
|
||||
* @param cy Chunklet Y coordinate that needs to be loaded
|
||||
* @param cz Chunklet Z coordinate that needs to be loaded
|
||||
* @param cx Chunklet X coordinate that needs to be loaded
|
||||
* @param cy Chunklet Y coordinate that needs to be loaded
|
||||
* @param cz Chunklet Z coordinate that needs to be loaded
|
||||
* @param world World that the chunklet needs to be loaded in
|
||||
*/
|
||||
public void loadChunklet(int cx, int cy, int cz, World world);
|
||||
@ -29,9 +29,9 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Unload a specific chunklet
|
||||
*
|
||||
* @param cx Chunklet X coordinate that needs to be unloaded
|
||||
* @param cy Chunklet Y coordinate that needs to be unloaded
|
||||
* @param cz Chunklet Z coordinate that needs to be unloaded
|
||||
* @param cx Chunklet X coordinate that needs to be unloaded
|
||||
* @param cy Chunklet Y coordinate that needs to be unloaded
|
||||
* @param cz Chunklet Z coordinate that needs to be unloaded
|
||||
* @param world World that the chunklet needs to be unloaded from
|
||||
*/
|
||||
public void unloadChunklet(int cx, int cy, int cz, World world);
|
||||
@ -39,8 +39,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Load a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be loaded
|
||||
* @param cz Chunk Z coordinate that is to be loaded
|
||||
* @param cx Chunk X coordinate that is to be loaded
|
||||
* @param cz Chunk Z coordinate that is to be loaded
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void loadChunk(int cx, int cz, World world, Entity[] entities);
|
||||
@ -48,8 +48,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Unload a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be unloaded
|
||||
* @param cz Chunk Z coordinate that is to be unloaded
|
||||
* @param cx Chunk X coordinate that is to be unloaded
|
||||
* @param cz Chunk Z coordinate that is to be unloaded
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void unloadChunk(int cx, int cz, World world);
|
||||
@ -57,8 +57,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Saves a given Chunk's Chunklet data
|
||||
*
|
||||
* @param cx Chunk X coordinate that is to be saved
|
||||
* @param cz Chunk Z coordinate that is to be saved
|
||||
* @param cx Chunk X coordinate that is to be saved
|
||||
* @param cz Chunk Z coordinate that is to be saved
|
||||
* @param world World that the Chunk is in
|
||||
*/
|
||||
public void saveChunk(int cx, int cz, World world);
|
||||
@ -68,8 +68,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Informs the ChunkletManager a chunk is loaded
|
||||
*
|
||||
* @param cx Chunk X coordinate that is loaded
|
||||
* @param cz Chunk Z coordinate that is loaded
|
||||
* @param cx Chunk X coordinate that is loaded
|
||||
* @param cz Chunk Z coordinate that is loaded
|
||||
* @param world World that the chunk was loaded in
|
||||
*/
|
||||
public void chunkLoaded(int cx, int cz, World world);
|
||||
@ -77,8 +77,8 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Informs the ChunkletManager a chunk is unloaded
|
||||
*
|
||||
* @param cx Chunk X coordinate that is unloaded
|
||||
* @param cz Chunk Z coordinate that is unloaded
|
||||
* @param cx Chunk X coordinate that is unloaded
|
||||
* @param cz Chunk Z coordinate that is unloaded
|
||||
* @param world World that the chunk was unloaded in
|
||||
*/
|
||||
public void chunkUnloaded(int cx, int cz, World world);
|
||||
@ -117,9 +117,9 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Check to see if a given location is set to true
|
||||
*
|
||||
* @param x X coordinate to check
|
||||
* @param y Y coordinate to check
|
||||
* @param z Z coordinate to check
|
||||
* @param x X coordinate to check
|
||||
* @param y Y coordinate to check
|
||||
* @param z Z coordinate to check
|
||||
* @param world World to check in
|
||||
* @return true if the given location is set to true, false if otherwise
|
||||
*/
|
||||
@ -144,9 +144,9 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Set a given location to true, should create stores as necessary if the location does not exist
|
||||
*
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param world World to set in
|
||||
*/
|
||||
public void setTrue(int x, int y, int z, World world);
|
||||
@ -168,9 +168,9 @@ public interface ChunkManager {
|
||||
/**
|
||||
* Set a given location to false, should not create stores if one does not exist for the given location
|
||||
*
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param x X coordinate to set
|
||||
* @param y Y coordinate to set
|
||||
* @param z Z coordinate to set
|
||||
* @param world World to set in
|
||||
*/
|
||||
public void setFalse(int x, int y, int z, World world);
|
||||
|
@ -11,9 +11,9 @@ import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class HashChunkManager implements ChunkManager {
|
||||
private HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>>();
|
||||
public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>();
|
||||
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>();
|
||||
private HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>>();
|
||||
private HashMap<UUID, Boolean> oldData = new HashMap<UUID, Boolean>();
|
||||
|
||||
@Override
|
||||
@ -46,19 +46,16 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
throw new RuntimeException("Wrong class type read for chunk meta data for " + x + ", " + z);
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Assume the format changed
|
||||
return null;
|
||||
//throw new RuntimeException("Unable to process chunk meta data for " + x + ", " + z, e);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Assume the format changed
|
||||
//System.out.println("[SpoutPlugin] is Unable to find serialized class for " + x + ", " + z + ", " + e.getMessage());
|
||||
return null;
|
||||
//throw new RuntimeException("Unable to find serialized class for " + x + ", " + z, e);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
objectStream.close();
|
||||
}
|
||||
}
|
||||
@ -75,8 +72,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
objectStream.flush();
|
||||
objectStream.close();
|
||||
data.setDirty(false);
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Unable to write chunk meta data for " + x + ", " + z, e);
|
||||
}
|
||||
}
|
||||
@ -139,8 +135,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
if (!oldData.containsKey(key)) {
|
||||
oldData.put(key, (new File(world.getWorldFolder(), "mcmmo_data")).exists());
|
||||
}
|
||||
else if (oldData.get(key)) {
|
||||
} else if (oldData.get(key)) {
|
||||
if (convertChunk(new File(world.getWorldFolder(), "mcmmo_data"), cx, cz, world, true)) {
|
||||
return;
|
||||
}
|
||||
@ -150,8 +145,9 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
try {
|
||||
chunkStore = readChunkStore(world, cx, cz);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Exception e) { e.printStackTrace(); }
|
||||
|
||||
if (chunkStore == null) {
|
||||
return;
|
||||
@ -200,7 +196,8 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void chunkLoaded(int cx, int cz, World world) {}
|
||||
public synchronized void chunkLoaded(int cx, int cz, World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void chunkUnloaded(int cx, int cz, World world) {
|
||||
@ -226,8 +223,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
if (worldName.equals(info[0])) {
|
||||
try {
|
||||
saveChunk(Integer.parseInt(info[1]), Integer.parseInt(info[2]), world);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -249,8 +245,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
if (worldName.equals(info[0])) {
|
||||
try {
|
||||
unloadChunk(Integer.parseInt(info[1]), Integer.parseInt(info[2]), world);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -258,7 +253,8 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void loadWorld(World world) {}
|
||||
public synchronized void loadWorld(World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void saveAll() {
|
||||
@ -414,7 +410,8 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void cleanUp() {}
|
||||
public synchronized void cleanUp() {
|
||||
}
|
||||
|
||||
public synchronized void convertChunk(File dataDir, int cx, int cz, World world) {
|
||||
convertChunk(dataDir, cx, cz, world, false);
|
||||
|
@ -25,21 +25,21 @@ import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
public class McMMOSimpleRegionFile {
|
||||
private RandomAccessFile file;
|
||||
@SuppressWarnings("unused")
|
||||
private static long TIMEOUT_TIME = 300000; // 5 min
|
||||
private final int[] dataStart = new int[1024];
|
||||
private final int[] dataActualLength = new int[1024];
|
||||
private final int[] dataLength = new int[1024];
|
||||
private final ArrayList<Boolean> inuse = new ArrayList<Boolean>();
|
||||
private int segmentSize;
|
||||
private int segmentMask;
|
||||
private final int rx;
|
||||
private final int rz;
|
||||
private final int defaultSegmentSize;
|
||||
private final File parent;
|
||||
private RandomAccessFile file;
|
||||
private int segmentSize;
|
||||
private int segmentMask;
|
||||
@SuppressWarnings("unused")
|
||||
private long lastAccessTime = System.currentTimeMillis();
|
||||
@SuppressWarnings("unused")
|
||||
private static long TIMEOUT_TIME = 300000; // 5 min
|
||||
|
||||
public McMMOSimpleRegionFile(File f, int rx, int rz) {
|
||||
this(f, rx, rz, 10);
|
||||
@ -91,8 +91,7 @@ public class McMMOSimpleRegionFile {
|
||||
}
|
||||
|
||||
extendFile();
|
||||
}
|
||||
catch (IOException fnfe) {
|
||||
} catch (IOException fnfe) {
|
||||
throw new RuntimeException(fnfe);
|
||||
}
|
||||
}
|
||||
@ -139,8 +138,7 @@ public class McMMOSimpleRegionFile {
|
||||
}
|
||||
|
||||
extendFile();
|
||||
}
|
||||
catch (IOException fnfe) {
|
||||
} catch (IOException fnfe) {
|
||||
throw new RuntimeException(fnfe);
|
||||
}
|
||||
}
|
||||
@ -197,8 +195,7 @@ public class McMMOSimpleRegionFile {
|
||||
}
|
||||
|
||||
file = null;
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
} catch (IOException ioe) {
|
||||
throw new RuntimeException("Unable to close file", ioe);
|
||||
}
|
||||
}
|
||||
@ -261,8 +258,7 @@ public class McMMOSimpleRegionFile {
|
||||
if (inuse.get(end)) {
|
||||
end++;
|
||||
start = end;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
end++;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,8 @@ import java.io.IOException;
|
||||
public class NullChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public void closeAll() {}
|
||||
public void closeAll() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkStore readChunkStore(World world, int x, int z) throws IOException {
|
||||
@ -18,25 +19,32 @@ public class NullChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeChunkStore(World world, int x, int z, ChunkStore data) {}
|
||||
public void writeChunkStore(World world, int x, int z, ChunkStore data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChunkStore(World world, int x, int z) {}
|
||||
public void closeChunkStore(World world, int x, int z) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadChunklet(int cx, int cy, int cz, World world) {}
|
||||
public void loadChunklet(int cx, int cy, int cz, World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadChunklet(int cx, int cy, int cz, World world) {}
|
||||
public void unloadChunklet(int cx, int cy, int cz, World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadChunk(int cx, int cz, World world, Entity[] entities) {}
|
||||
public void loadChunk(int cx, int cz, World world, Entity[] entities) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadChunk(int cx, int cz, World world) {}
|
||||
public void unloadChunk(int cx, int cz, World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChunk(int cx, int cz, World world) {}
|
||||
public void saveChunk(int cx, int cz, World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChunkLoaded(int cx, int cz, World world) {
|
||||
@ -44,25 +52,32 @@ public class NullChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chunkLoaded(int cx, int cz, World world) {}
|
||||
public void chunkLoaded(int cx, int cz, World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chunkUnloaded(int cx, int cz, World world) {}
|
||||
public void chunkUnloaded(int cx, int cz, World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWorld(World world) {}
|
||||
public void saveWorld(World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadWorld(World world) {}
|
||||
public void unloadWorld(World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWorld(World world) {}
|
||||
public void loadWorld(World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAll() {}
|
||||
public void saveAll() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadAll() {}
|
||||
public void unloadAll() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrue(int x, int y, int z, World world) {
|
||||
@ -80,23 +95,30 @@ public class NullChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrue(int x, int y, int z, World world) {}
|
||||
public void setTrue(int x, int y, int z, World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrue(Block block) {}
|
||||
public void setTrue(Block block) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrue(BlockState blockState) {}
|
||||
public void setTrue(BlockState blockState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFalse(int x, int y, int z, World world) {}
|
||||
public void setFalse(int x, int y, int z, World world) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFalse(Block block) {}
|
||||
public void setFalse(Block block) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFalse(BlockState blockState) {}
|
||||
public void setFalse(BlockState blockState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanUp() {}
|
||||
public void cleanUp() {
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,13 @@ import java.util.UUID;
|
||||
|
||||
public class PrimitiveChunkStore implements ChunkStore {
|
||||
private static final long serialVersionUID = -1L;
|
||||
transient private boolean dirty = false;
|
||||
/** X, Z, Y */
|
||||
public boolean[][][] store;
|
||||
private static final int CURRENT_VERSION = 7;
|
||||
private static final int MAGIC_NUMBER = 0xEA5EDEBB;
|
||||
/**
|
||||
* X, Z, Y
|
||||
*/
|
||||
public boolean[][][] store;
|
||||
transient private boolean dirty = false;
|
||||
private int cx;
|
||||
private int cz;
|
||||
private UUID worldUid;
|
||||
@ -137,8 +139,9 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
for (int y = 0; y < store[0][0].length; y++) {
|
||||
try {
|
||||
store[x][z][y] = temp[x][y][z];
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ import org.bukkit.scheduler.BukkitScheduler;
|
||||
import java.io.File;
|
||||
|
||||
public class BlockStoreConversionMain implements Runnable {
|
||||
private int taskID, i;
|
||||
private org.bukkit.World world;
|
||||
BukkitScheduler scheduler;
|
||||
File dataDir;
|
||||
File[] xDirs;
|
||||
BlockStoreConversionXDirectory[] converters;
|
||||
private int taskID, i;
|
||||
private org.bukkit.World world;
|
||||
|
||||
public BlockStoreConversionMain(org.bukkit.World world) {
|
||||
this.taskID = -1;
|
||||
|
@ -7,12 +7,12 @@ import org.bukkit.scheduler.BukkitScheduler;
|
||||
import java.io.File;
|
||||
|
||||
public class BlockStoreConversionXDirectory implements Runnable {
|
||||
private int taskID, i;
|
||||
private org.bukkit.World world;
|
||||
BukkitScheduler scheduler;
|
||||
File dataDir;
|
||||
File[] zDirs;
|
||||
BlockStoreConversionZDirectory[] converters;
|
||||
private int taskID, i;
|
||||
private org.bukkit.World world;
|
||||
|
||||
public BlockStoreConversionXDirectory() {
|
||||
this.taskID = -1;
|
||||
|
@ -72,8 +72,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
try {
|
||||
this.cx = Integer.parseInt(this.cxs);
|
||||
this.cz = Integer.parseInt(this.czs);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
this.dataDir.delete();
|
||||
stop();
|
||||
return;
|
||||
@ -87,8 +86,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
|
||||
if (this.tempChunklet instanceof PrimitiveChunkletStore) {
|
||||
this.primitiveChunklet = (PrimitiveChunkletStore) this.tempChunklet;
|
||||
}
|
||||
else if (this.tempChunklet instanceof PrimitiveExChunkletStore) {
|
||||
} else if (this.tempChunklet instanceof PrimitiveExChunkletStore) {
|
||||
this.primitiveExChunklet = (PrimitiveExChunkletStore) this.tempChunklet;
|
||||
}
|
||||
|
||||
@ -115,8 +113,9 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
}
|
||||
|
||||
this.newManager.setTrue(this.cxPos, this.y2, this.czPos, this.world);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -136,8 +135,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
|
||||
if (this.primitiveExChunklet != null) {
|
||||
this.oldArray = this.primitiveExChunklet.store[x][z];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -145,8 +143,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
|
||||
if (this.oldArray.length < 64) {
|
||||
return;
|
||||
}
|
||||
else if (this.newArray.length < ((this.y * 64) + 64)) {
|
||||
} else if (this.newArray.length < ((this.y * 64) + 64)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -43,13 +43,13 @@ public interface DatabaseManager {
|
||||
public boolean saveUser(PlayerProfile profile);
|
||||
|
||||
/**
|
||||
* Retrieve leaderboard info.
|
||||
*
|
||||
* @param skill The skill to retrieve info on
|
||||
* @param pageNumber Which page in the leaderboards to retrieve
|
||||
* @param statsPerPage The number of stats per page
|
||||
* @return the requested leaderboard information
|
||||
*/
|
||||
* Retrieve leaderboard info.
|
||||
*
|
||||
* @param skill The skill to retrieve info on
|
||||
* @param pageNumber Which page in the leaderboards to retrieve
|
||||
* @param statsPerPage The number of stats per page
|
||||
* @return the requested leaderboard information
|
||||
*/
|
||||
public List<PlayerStat> readLeaderboard(PrimarySkillType skill, int pageNumber, int statsPerPage);
|
||||
|
||||
/**
|
||||
@ -67,20 +67,19 @@ public interface DatabaseManager {
|
||||
* Add a new user to the database.
|
||||
*
|
||||
* @param playerName The name of the player to be added to the database
|
||||
* @param uuid The uuid of the player to be added to the database
|
||||
* @param uuid The uuid of the player to be added to the database
|
||||
*/
|
||||
public void newUser(String playerName, UUID uuid);
|
||||
|
||||
/**
|
||||
* Load a player from the database.
|
||||
*
|
||||
* @deprecated replaced by {@link #loadPlayerProfile(String playerName, UUID uuid, boolean createNew)}
|
||||
*
|
||||
* @param playerName The name of the player to load from the database
|
||||
* @param createNew Whether to create a new record if the player is not
|
||||
* found
|
||||
* @param createNew Whether to create a new record if the player is not
|
||||
* found
|
||||
* @return The player's data, or an unloaded PlayerProfile if not found
|
||||
* and createNew is false
|
||||
* and createNew is false
|
||||
* @deprecated replaced by {@link #loadPlayerProfile(String playerName, UUID uuid, boolean createNew)}
|
||||
*/
|
||||
@Deprecated
|
||||
public PlayerProfile loadPlayerProfile(String playerName, boolean createNew);
|
||||
@ -97,11 +96,11 @@ public interface DatabaseManager {
|
||||
* Load a player from the database. Attempt to use uuid, fall back on playername
|
||||
*
|
||||
* @param playerName The name of the player to load from the database
|
||||
* @param uuid The uuid of the player to load from the database
|
||||
* @param createNew Whether to create a new record if the player is not
|
||||
* found
|
||||
* @param uuid The uuid of the player to load from the database
|
||||
* @param createNew Whether to create a new record if the player is not
|
||||
* found
|
||||
* @return The player's data, or an unloaded PlayerProfile if not found
|
||||
* and createNew is false
|
||||
* and createNew is false
|
||||
*/
|
||||
public PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean createNew);
|
||||
|
||||
|
@ -11,12 +11,10 @@ public class DatabaseManagerFactory {
|
||||
if (customManager != null) {
|
||||
try {
|
||||
return createDefaultCustomDatabaseManager();
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.debug("Could not create custom database manager");
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
mcMMO.p.debug("Failed to create custom database manager");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -26,6 +24,10 @@ public class DatabaseManagerFactory {
|
||||
return Config.getInstance().getUseMySQL() ? new SQLDatabaseManager() : new FlatfileDatabaseManager();
|
||||
}
|
||||
|
||||
public static Class<? extends DatabaseManager> getCustomDatabaseManagerClass() {
|
||||
return customManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the custom DatabaseManager class for mcMMO to use. This should be
|
||||
* called prior to mcMMO enabling.
|
||||
@ -38,7 +40,6 @@ public class DatabaseManagerFactory {
|
||||
* versions.
|
||||
*
|
||||
* @param clazz the DatabaseManager class to use
|
||||
*
|
||||
* @throws IllegalArgumentException if the provided class does not have
|
||||
* an empty constructor
|
||||
*/
|
||||
@ -46,16 +47,11 @@ public class DatabaseManagerFactory {
|
||||
try {
|
||||
clazz.getConstructor();
|
||||
customManager = clazz;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
throw new IllegalArgumentException("Provided database manager class must have an empty constructor", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Class<? extends DatabaseManager> getCustomDatabaseManagerClass() {
|
||||
return customManager;
|
||||
}
|
||||
|
||||
public static DatabaseManager createDatabaseManager(DatabaseType type) {
|
||||
switch (type) {
|
||||
case DatabaseType.FLATFILE:
|
||||
@ -67,8 +63,7 @@ public class DatabaseManagerFactory {
|
||||
case DatabaseType.CUSTOM:
|
||||
try {
|
||||
return createDefaultCustomDatabaseManager();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -20,14 +20,52 @@ import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
private static final Object fileWritingLock = new Object();
|
||||
public static int USERNAME = 0;
|
||||
public static int SKILLS_MINING = 1;
|
||||
public static int EXP_MINING = 4;
|
||||
public static int SKILLS_WOODCUTTING = 5;
|
||||
public static int EXP_WOODCUTTING = 6;
|
||||
public static int SKILLS_REPAIR = 7;
|
||||
public static int SKILLS_UNARMED = 8;
|
||||
public static int SKILLS_HERBALISM = 9;
|
||||
public static int SKILLS_EXCAVATION = 10;
|
||||
public static int SKILLS_ARCHERY = 11;
|
||||
public static int SKILLS_SWORDS = 12;
|
||||
public static int SKILLS_AXES = 13;
|
||||
public static int SKILLS_ACROBATICS = 14;
|
||||
public static int EXP_REPAIR = 15;
|
||||
public static int EXP_UNARMED = 16;
|
||||
public static int EXP_HERBALISM = 17;
|
||||
public static int EXP_EXCAVATION = 18;
|
||||
public static int EXP_ARCHERY = 19;
|
||||
public static int EXP_SWORDS = 20;
|
||||
public static int EXP_AXES = 21;
|
||||
public static int EXP_ACROBATICS = 22;
|
||||
public static int SKILLS_TAMING = 24;
|
||||
public static int EXP_TAMING = 25;
|
||||
public static int COOLDOWN_BERSERK = 26;
|
||||
public static int COOLDOWN_GIGA_DRILL_BREAKER = 27;
|
||||
public static int COOLDOWN_TREE_FELLER = 28;
|
||||
public static int COOLDOWN_GREEN_TERRA = 29;
|
||||
public static int COOLDOWN_SERRATED_STRIKES = 30;
|
||||
public static int COOLDOWN_SKULL_SPLITTER = 31;
|
||||
public static int COOLDOWN_SUPER_BREAKER = 32;
|
||||
public static int SKILLS_FISHING = 34;
|
||||
public static int EXP_FISHING = 35;
|
||||
public static int COOLDOWN_BLAST_MINING = 36;
|
||||
public static int LAST_LOGIN = 37;
|
||||
public static int HEALTHBAR = 38;
|
||||
public static int SKILLS_ALCHEMY = 39;
|
||||
public static int EXP_ALCHEMY = 40;
|
||||
public static int UUID_INDEX = 41;
|
||||
public static int SCOREBOARD_TIPS = 42;
|
||||
public static int COOLDOWN_CHIMAERA_WING = 43;
|
||||
private final HashMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new HashMap<PrimarySkillType, List<PlayerStat>>();
|
||||
private final List<PlayerStat> powerLevels = new ArrayList<PlayerStat>();
|
||||
private long lastUpdate = 0;
|
||||
|
||||
private final long UPDATE_WAIT_TIME = 600000L; // 10 minutes
|
||||
private final File usersFile;
|
||||
private static final Object fileWritingLock = new Object();
|
||||
|
||||
private long lastUpdate = 0;
|
||||
protected FlatfileDatabaseManager() {
|
||||
usersFile = new File(mcMMO.getUsersFilePath());
|
||||
checkStructure();
|
||||
@ -69,8 +107,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
// If they're still around, rewrite them to the file.
|
||||
if (!powerless) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
purgedUsers++;
|
||||
}
|
||||
}
|
||||
@ -78,24 +115,20 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
// Write the new file
|
||||
out = new FileWriter(usersFilePath);
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -129,8 +162,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
boolean rewrite = false;
|
||||
try {
|
||||
lastPlayed = Long.parseLong(character[37]) * Misc.TIME_CONVERSION_FACTOR;
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (lastPlayed == 0) {
|
||||
@ -141,15 +173,13 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
if (currentTime - lastPlayed > PURGE_TIME) {
|
||||
removedPlayers++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (rewrite) {
|
||||
// Rewrite their data with a valid time
|
||||
character[37] = Long.toString(lastPlayed);
|
||||
String newLine = org.apache.commons.lang.StringUtils.join(character, ":");
|
||||
writer.append(newLine).append("\r\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
}
|
||||
@ -158,24 +188,20 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
// Write the new file
|
||||
out = new FileWriter(usersFilePath);
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -211,24 +237,20 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
out = new FileWriter(usersFilePath); // Write out the new file
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -262,8 +284,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
String[] character = line.split(":");
|
||||
if (!(uuid != null && character[UUID_INDEX].equalsIgnoreCase(uuid.toString())) && !character[USERNAME].equalsIgnoreCase(playerName)) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Otherwise write the new player information
|
||||
writeUserToLine(profile, playerName, uuid, writer);
|
||||
wroteUser = true;
|
||||
@ -273,8 +294,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
/*
|
||||
* If we couldn't find the user in the DB we need to add him
|
||||
*/
|
||||
if(!wroteUser)
|
||||
{
|
||||
if (!wroteUser) {
|
||||
writeUserToLine(profile, playerName, uuid, writer);
|
||||
}
|
||||
|
||||
@ -282,25 +302,21 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
out = new FileWriter(usersFilePath);
|
||||
out.write(writer.toString());
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -435,16 +451,13 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
// Add more in the same format as the line above
|
||||
|
||||
out.newLine();
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -506,18 +519,15 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
newUser(playerName, uuid);
|
||||
return new PlayerProfile(playerName, uuid, true);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
// I have no idea why it's necessary to inline tryClose() here, but it removes
|
||||
// a resource leak warning, and I'm trusting the compiler on this one.
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -549,23 +559,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
try {
|
||||
destination.saveUser(loadFromLine(character));
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
convertedUsers++;
|
||||
Misc.printProgress(convertedUsers, progressInterval, startMillis);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -606,25 +612,21 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
out = new FileWriter(usersFilePath); // Write out the new file
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
mcMMO.p.getLogger().info(i + " entries written while saving UUID for " + userName);
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -665,25 +667,21 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
out = new FileWriter(usersFilePath); // Write out the new file
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
mcMMO.p.getLogger().info(i + " entries written while saving UUID batch");
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -708,16 +706,13 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
String[] character = line.split(":");
|
||||
users.add(character[USERNAME]);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -785,16 +780,13 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
putStat(powerLevels, playerName, powerLevel);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " during user " + playerName + " (Are you sure you formatted it correctly?) " + e.toString());
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -1005,11 +997,9 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
corrupted = true;
|
||||
if (i == 37) {
|
||||
character[i] = String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
else if (i == 38) {
|
||||
} else if (i == 38) {
|
||||
character[i] = Config.getInstance().getMobHealthbarDefault().toString();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
character[i] = "0";
|
||||
}
|
||||
}
|
||||
@ -1056,24 +1046,20 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
// Write the new file
|
||||
out = new FileWriter(usersFilePath);
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@ -1095,8 +1081,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
try {
|
||||
mcMMO.p.debug("Creating mcmmo.users file...");
|
||||
new File(mcMMO.getUsersFilePath()).createNewFile();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -1124,16 +1109,9 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
return statValue;
|
||||
}
|
||||
|
||||
private class SkillComparator implements Comparator<PlayerStat> {
|
||||
@Override
|
||||
public int compare(PlayerStat o1, PlayerStat o2) {
|
||||
return (o2.statVal - o1.statVal);
|
||||
}
|
||||
}
|
||||
|
||||
private PlayerProfile loadFromLine(String[] character) {
|
||||
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
||||
Map<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP
|
||||
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
||||
Map<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP
|
||||
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown
|
||||
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class);
|
||||
MobHealthbarType mobHealthbarType;
|
||||
@ -1170,30 +1148,26 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
try {
|
||||
mobHealthbarType = MobHealthbarType.valueOf(character[HEALTHBAR]);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
||||
}
|
||||
|
||||
UUID uuid;
|
||||
try {
|
||||
uuid = UUID.fromString(character[UUID_INDEX]);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
uuid = null;
|
||||
}
|
||||
|
||||
try {
|
||||
scoreboardTipsShown = Integer.valueOf(character[SCOREBOARD_TIPS]);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
scoreboardTipsShown = 0;
|
||||
}
|
||||
|
||||
try {
|
||||
uniquePlayerDataMap.put(UniqueDataType.CHIMAERA_WING_DATS, Integer.valueOf(character[COOLDOWN_CHIMAERA_WING]));
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
uniquePlayerDataMap.put(UniqueDataType.CHIMAERA_WING_DATS, 0);
|
||||
}
|
||||
|
||||
@ -1225,7 +1199,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() { }
|
||||
public void onDisable() {
|
||||
}
|
||||
|
||||
private int getSkillIndex(PrimarySkillType skill) {
|
||||
switch (skill) {
|
||||
@ -1257,50 +1232,9 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
return SKILLS_WOODCUTTING;
|
||||
default:
|
||||
throw new RuntimeException("Primary Skills only");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static int USERNAME = 0;
|
||||
public static int SKILLS_MINING = 1;
|
||||
public static int EXP_MINING = 4;
|
||||
public static int SKILLS_WOODCUTTING = 5;
|
||||
public static int EXP_WOODCUTTING = 6;
|
||||
public static int SKILLS_REPAIR = 7;
|
||||
public static int SKILLS_UNARMED = 8;
|
||||
public static int SKILLS_HERBALISM = 9;
|
||||
public static int SKILLS_EXCAVATION = 10;
|
||||
public static int SKILLS_ARCHERY = 11;
|
||||
public static int SKILLS_SWORDS = 12;
|
||||
public static int SKILLS_AXES = 13;
|
||||
public static int SKILLS_ACROBATICS = 14;
|
||||
public static int EXP_REPAIR = 15;
|
||||
public static int EXP_UNARMED = 16;
|
||||
public static int EXP_HERBALISM = 17;
|
||||
public static int EXP_EXCAVATION = 18;
|
||||
public static int EXP_ARCHERY = 19;
|
||||
public static int EXP_SWORDS = 20;
|
||||
public static int EXP_AXES = 21;
|
||||
public static int EXP_ACROBATICS = 22;
|
||||
public static int SKILLS_TAMING = 24;
|
||||
public static int EXP_TAMING = 25;
|
||||
public static int COOLDOWN_BERSERK = 26;
|
||||
public static int COOLDOWN_GIGA_DRILL_BREAKER = 27;
|
||||
public static int COOLDOWN_TREE_FELLER = 28;
|
||||
public static int COOLDOWN_GREEN_TERRA = 29;
|
||||
public static int COOLDOWN_SERRATED_STRIKES = 30;
|
||||
public static int COOLDOWN_SKULL_SPLITTER = 31;
|
||||
public static int COOLDOWN_SUPER_BREAKER = 32;
|
||||
public static int SKILLS_FISHING = 34;
|
||||
public static int EXP_FISHING = 35;
|
||||
public static int COOLDOWN_BLAST_MINING = 36;
|
||||
public static int LAST_LOGIN = 37;
|
||||
public static int HEALTHBAR = 38;
|
||||
public static int SKILLS_ALCHEMY = 39;
|
||||
public static int EXP_ALCHEMY = 40;
|
||||
public static int UUID_INDEX = 41;
|
||||
public static int SCOREBOARD_TIPS = 42;
|
||||
public static int COOLDOWN_CHIMAERA_WING = 43;
|
||||
|
||||
public void resetMobHealthSettings() {
|
||||
BufferedReader in = null;
|
||||
@ -1319,9 +1253,9 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
continue;
|
||||
}
|
||||
String[] character = line.split(":");
|
||||
|
||||
|
||||
character[HEALTHBAR] = Config.getInstance().getMobHealthbarDefault().toString();
|
||||
|
||||
|
||||
line = new StringBuilder(org.apache.commons.lang.StringUtils.join(character, ":")).append(":").toString();
|
||||
|
||||
writer.append(line).append("\r\n");
|
||||
@ -1330,28 +1264,31 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
// Write the new file
|
||||
out = new FileWriter(usersFilePath);
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SkillComparator implements Comparator<PlayerStat> {
|
||||
@Override
|
||||
public int compare(PlayerStat o1, PlayerStat o2) {
|
||||
return (o2.statVal - o1.statVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,8 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public final class SQLDatabaseManager implements DatabaseManager {
|
||||
private static final String ALL_QUERY_VERSION = "total";
|
||||
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
|
||||
private final Map<UUID, Integer> cachedUserIDs = new HashMap<UUID, Integer>();
|
||||
|
||||
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
private DataSource miscPool;
|
||||
private DataSource loadPool;
|
||||
private DataSource savePool;
|
||||
@ -37,20 +35,19 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
String connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName()
|
||||
+ ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName();
|
||||
|
||||
if(Config.getInstance().getMySQLSSL())
|
||||
if (Config.getInstance().getMySQLSSL())
|
||||
connectionString +=
|
||||
"?verifyServerCertificate=false"+
|
||||
"&useSSL=true"+
|
||||
"&requireSSL=true";
|
||||
"?verifyServerCertificate=false" +
|
||||
"&useSSL=true" +
|
||||
"&requireSSL=true";
|
||||
else
|
||||
connectionString+=
|
||||
connectionString +=
|
||||
"?useSSL=false";
|
||||
|
||||
try {
|
||||
// Force driver to load if not yet loaded
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
//throw e; // aborts onEnable() Riking if you want to do this, fully implement it.
|
||||
@ -128,11 +125,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "huds` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "huds`.`user_id` = `s`.`user_id`)");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "cooldowns` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "cooldowns`.`user_id` = `s`.`user_id`)");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "users` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "users`.`id` = `s`.`user_id`)");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
massUpdateLock.unlock();
|
||||
@ -159,11 +154,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
"JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) " +
|
||||
"JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) " +
|
||||
"WHERE ((UNIX_TIMESTAMP() - lastlogin) > " + PURGE_TIME + ")");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
massUpdateLock.unlock();
|
||||
@ -190,11 +183,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
statement.setString(1, playerName);
|
||||
|
||||
success = statement.executeUpdate() != 0;
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
}
|
||||
@ -320,11 +311,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
mcMMO.p.getLogger().severe("Failed to update hud settings for " + profile.getPlayerName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
}
|
||||
@ -356,11 +345,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
stats.add(new PlayerStat(column.get(1), Integer.valueOf(column.get(0))));
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
@ -452,11 +439,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
resultSet.close();
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
@ -471,11 +456,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
try {
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
newUser(connection, playerName, uuid);
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(connection);
|
||||
}
|
||||
}
|
||||
@ -507,11 +490,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
writeMissingRows(connection, resultSet.getInt(1));
|
||||
return resultSet.getInt(1);
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
}
|
||||
@ -599,17 +580,14 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
return profile;
|
||||
}
|
||||
catch (SQLException e) {
|
||||
} catch (SQLException e) {
|
||||
printErrors(e);
|
||||
}
|
||||
}
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
@ -655,19 +633,16 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
resultSet.next();
|
||||
destination.saveUser(loadFromResult(playerName, resultSet));
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
} catch (SQLException e) {
|
||||
printErrors(e);
|
||||
// Ignore
|
||||
}
|
||||
convertedUsers++;
|
||||
Misc.printProgress(convertedUsers, progressInterval, startMillis);
|
||||
}
|
||||
}
|
||||
catch (SQLException e) {
|
||||
} catch (SQLException e) {
|
||||
printErrors(e);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
@ -688,12 +663,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
statement.setString(2, userName);
|
||||
statement.execute();
|
||||
return true;
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
}
|
||||
@ -728,12 +701,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
}
|
||||
@ -753,11 +724,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
while (resultSet.next()) {
|
||||
users.add(resultSet.getString("user"));
|
||||
}
|
||||
}
|
||||
catch (SQLException e) {
|
||||
} catch (SQLException e) {
|
||||
printErrors(e);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
@ -787,13 +756,13 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
if (!resultSet.next()) {
|
||||
createStatement = connection.createStatement();
|
||||
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "users` ("
|
||||
+ "`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
|
||||
+ "`user` varchar(40) NOT NULL,"
|
||||
+ "`uuid` varchar(36) NULL DEFAULT NULL,"
|
||||
+ "`lastlogin` int(32) unsigned NOT NULL,"
|
||||
+ "PRIMARY KEY (`id`),"
|
||||
+ "INDEX(`user`(20) ASC),"
|
||||
+ "UNIQUE KEY `uuid` (`uuid`)) DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
|
||||
+ "`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
|
||||
+ "`user` varchar(40) NOT NULL,"
|
||||
+ "`uuid` varchar(36) NULL DEFAULT NULL,"
|
||||
+ "`lastlogin` int(32) unsigned NOT NULL,"
|
||||
+ "PRIMARY KEY (`id`),"
|
||||
+ "INDEX(`user`(20) ASC),"
|
||||
+ "UNIQUE KEY `uuid` (`uuid`)) DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
|
||||
tryClose(createStatement);
|
||||
}
|
||||
tryClose(resultSet);
|
||||
@ -845,20 +814,20 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
createStatement = connection.createStatement();
|
||||
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`fishing` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT "+startingLevel+","
|
||||
+ "`total` int(10) unsigned NOT NULL DEFAULT "+totalLevel+","
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`fishing` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT " + startingLevel + ","
|
||||
+ "`total` int(10) unsigned NOT NULL DEFAULT " + totalLevel + ","
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
tryClose(createStatement);
|
||||
@ -912,11 +881,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
createStatement.executeUpdate("DELETE FROM `" + tablePrefix + "huds` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "huds`.`user_id` = `u`.`id`)");
|
||||
createStatement.executeUpdate("DELETE FROM `" + tablePrefix + "cooldowns` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "cooldowns`.`user_id` = `u`.`id`)");
|
||||
createStatement.executeUpdate("DELETE FROM `" + tablePrefix + "skills` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "skills`.`user_id` = `u`.`id`)");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
tryClose(createStatement);
|
||||
@ -1014,11 +981,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
mcMMO.getUpgradeManager().setUpgradeCompleted(upgrade);
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(statement);
|
||||
}
|
||||
}
|
||||
@ -1048,11 +1013,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
statement.setInt(3, 0);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(statement);
|
||||
}
|
||||
}
|
||||
@ -1117,22 +1080,19 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
try {
|
||||
mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 1));
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
||||
}
|
||||
|
||||
try {
|
||||
scoreboardTipsShown = result.getInt(OFFSET_OTHER + 2);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
scoreboardTipsShown = 0;
|
||||
}
|
||||
|
||||
try {
|
||||
uuid = UUID.fromString(result.getString(OFFSET_OTHER + 3));
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
uuid = null;
|
||||
}
|
||||
|
||||
@ -1163,7 +1123,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
resultSet.close();
|
||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables to drop name uniqueness...");
|
||||
statement.execute("ALTER TABLE `" + tablePrefix + "users` "
|
||||
statement.execute("ALTER TABLE `" + tablePrefix + "users` "
|
||||
+ "DROP INDEX `user`,"
|
||||
+ "ADD INDEX `user` (`user`(20) ASC)");
|
||||
} catch (SQLException ex) {
|
||||
@ -1176,8 +1136,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
private void checkUpgradeAddAlchemy(final Statement statement) throws SQLException {
|
||||
try {
|
||||
statement.executeQuery("SELECT `alchemy` FROM `" + tablePrefix + "skills` LIMIT 1");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Alchemy...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD `alchemy` int(10) NOT NULL DEFAULT '0'");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "experience` ADD `alchemy` int(10) NOT NULL DEFAULT '0'");
|
||||
@ -1187,8 +1146,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
private void checkUpgradeAddBlastMiningCooldown(final Statement statement) throws SQLException {
|
||||
try {
|
||||
statement.executeQuery("SELECT `blast_mining` FROM `" + tablePrefix + "cooldowns` LIMIT 1");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Blast Mining...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0'");
|
||||
}
|
||||
@ -1197,8 +1155,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
private void checkUpgradeAddUniqueChimaeraWing(final Statement statement) throws SQLException {
|
||||
try {
|
||||
statement.executeQuery("SELECT `chimaera_wing` FROM `" + tablePrefix + "cooldowns` LIMIT 1");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Chimaera Wing...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "cooldowns` ADD `chimaera_wing` int(32) NOT NULL DEFAULT '0'");
|
||||
}
|
||||
@ -1207,8 +1164,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
private void checkUpgradeAddFishing(final Statement statement) throws SQLException {
|
||||
try {
|
||||
statement.executeQuery("SELECT `fishing` FROM `" + tablePrefix + "skills` LIMIT 1");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Fishing...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0'");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0'");
|
||||
@ -1218,8 +1174,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
private void checkUpgradeAddMobHealthbars(final Statement statement) throws SQLException {
|
||||
try {
|
||||
statement.executeQuery("SELECT `mobhealthbar` FROM `" + tablePrefix + "huds` LIMIT 1");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for mob healthbars...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "'");
|
||||
}
|
||||
@ -1228,8 +1183,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
private void checkUpgradeAddScoreboardTips(final Statement statement) throws SQLException {
|
||||
try {
|
||||
statement.executeQuery("SELECT `scoreboardtips` FROM `" + tablePrefix + "huds` LIMIT 1");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for scoreboard tips...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "huds` ADD `scoreboardtips` int(10) NOT NULL DEFAULT '0' ;");
|
||||
}
|
||||
@ -1250,17 +1204,14 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
try {
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_" + skill_name + "` (`" + skill_name + "`) USING BTREE");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
}
|
||||
}
|
||||
@ -1286,17 +1237,202 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD `uuid` varchar(36) NULL DEFAULT NULL");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD UNIQUE INDEX `uuid` (`uuid`) USING BTREE");
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
}
|
||||
|
||||
new GetUUIDUpdatesRequired().runTaskLaterAsynchronously(mcMMO.p, 100); // wait until after first purge
|
||||
}
|
||||
|
||||
private void checkUpgradeDropPartyNames(final Statement statement) {
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
resultSet = statement.executeQuery("SELECT * FROM `" + tablePrefix + "users` LIMIT 1");
|
||||
|
||||
ResultSetMetaData rsmeta = resultSet.getMetaData();
|
||||
boolean column_exists = false;
|
||||
|
||||
for (int i = 1; i <= rsmeta.getColumnCount(); i++) {
|
||||
if (rsmeta.getColumnName(i).equalsIgnoreCase("party")) {
|
||||
column_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (column_exists) {
|
||||
mcMMO.p.getLogger().info("Removing party name from users table...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` DROP COLUMN `party`");
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpgradeSkillTotal(final Connection connection) throws SQLException {
|
||||
ResultSet resultSet = null;
|
||||
Statement statement = null;
|
||||
|
||||
try {
|
||||
connection.setAutoCommit(false);
|
||||
statement = connection.createStatement();
|
||||
resultSet = statement.executeQuery("SELECT * FROM `" + tablePrefix + "skills` LIMIT 1");
|
||||
|
||||
ResultSetMetaData rsmeta = resultSet.getMetaData();
|
||||
boolean column_exists = false;
|
||||
|
||||
for (int i = 1; i <= rsmeta.getColumnCount(); i++) {
|
||||
if (rsmeta.getColumnName(i).equalsIgnoreCase("total")) {
|
||||
column_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!column_exists) {
|
||||
mcMMO.p.getLogger().info("Adding skill total column to skills table...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD COLUMN `total` int NOT NULL DEFAULT '0'");
|
||||
statement.executeUpdate("UPDATE `" + tablePrefix + "skills` SET `total` = (taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy)");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_total` (`total`) USING BTREE");
|
||||
connection.commit();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
} finally {
|
||||
connection.setAutoCommit(true);
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpgradeDropSpout(final Statement statement) {
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
resultSet = statement.executeQuery("SELECT * FROM `" + tablePrefix + "huds` LIMIT 1");
|
||||
|
||||
ResultSetMetaData rsmeta = resultSet.getMetaData();
|
||||
boolean column_exists = false;
|
||||
|
||||
for (int i = 1; i <= rsmeta.getColumnCount(); i++) {
|
||||
if (rsmeta.getColumnName(i).equalsIgnoreCase("hudtype")) {
|
||||
column_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (column_exists) {
|
||||
mcMMO.p.getLogger().info("Removing Spout HUD type from huds table...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "huds` DROP COLUMN `hudtype`");
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
}
|
||||
}
|
||||
|
||||
private int getUserID(final Connection connection, final String playerName, final UUID uuid) {
|
||||
if (uuid == null)
|
||||
return getUserIDByName(connection, playerName);
|
||||
|
||||
if (cachedUserIDs.containsKey(uuid))
|
||||
return cachedUserIDs.get(uuid);
|
||||
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
statement = connection.prepareStatement("SELECT id, user FROM " + tablePrefix + "users WHERE uuid = ? OR (uuid IS NULL AND user = ?)");
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, playerName);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
int id = resultSet.getInt("id");
|
||||
|
||||
cachedUserIDs.put(uuid, id);
|
||||
|
||||
return id;
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int getUserIDByName(final Connection connection, final String playerName) {
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
statement = connection.prepareStatement("SELECT id, user FROM " + tablePrefix + "users WHERE user = ?");
|
||||
statement.setString(1, playerName);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
int id = resultSet.getInt("id");
|
||||
|
||||
return id;
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
} finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void tryClose(AutoCloseable closeable) {
|
||||
if (closeable != null) {
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
mcMMO.p.debug("Releasing connection pool resource...");
|
||||
miscPool.close();
|
||||
loadPool.close();
|
||||
savePool.close();
|
||||
}
|
||||
|
||||
public void resetMobHealthSettings() {
|
||||
PreparedStatement statement = null;
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "huds SET mobhealthbar = ?");
|
||||
statement.setString(1, Config.getInstance().getMobHealthbarDefault().toString());
|
||||
statement.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
} finally {
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
}
|
||||
}
|
||||
|
||||
public enum PoolIdentifier {
|
||||
MISC,
|
||||
LOAD,
|
||||
SAVE
|
||||
}
|
||||
|
||||
private class GetUUIDUpdatesRequired extends BukkitRunnable {
|
||||
public void run() {
|
||||
massUpdateLock.lock();
|
||||
@ -1329,204 +1465,4 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpgradeDropPartyNames(final Statement statement) {
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
resultSet = statement.executeQuery("SELECT * FROM `" + tablePrefix + "users` LIMIT 1");
|
||||
|
||||
ResultSetMetaData rsmeta = resultSet.getMetaData();
|
||||
boolean column_exists = false;
|
||||
|
||||
for (int i = 1; i <= rsmeta.getColumnCount(); i++) {
|
||||
if (rsmeta.getColumnName(i).equalsIgnoreCase("party")) {
|
||||
column_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (column_exists) {
|
||||
mcMMO.p.getLogger().info("Removing party name from users table...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` DROP COLUMN `party`");
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
tryClose(resultSet);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpgradeSkillTotal(final Connection connection) throws SQLException {
|
||||
ResultSet resultSet = null;
|
||||
Statement statement = null;
|
||||
|
||||
try {
|
||||
connection.setAutoCommit(false);
|
||||
statement = connection.createStatement();
|
||||
resultSet = statement.executeQuery("SELECT * FROM `" + tablePrefix + "skills` LIMIT 1");
|
||||
|
||||
ResultSetMetaData rsmeta = resultSet.getMetaData();
|
||||
boolean column_exists = false;
|
||||
|
||||
for (int i = 1; i <= rsmeta.getColumnCount(); i++) {
|
||||
if (rsmeta.getColumnName(i).equalsIgnoreCase("total")) {
|
||||
column_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!column_exists) {
|
||||
mcMMO.p.getLogger().info("Adding skill total column to skills table...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD COLUMN `total` int NOT NULL DEFAULT '0'");
|
||||
statement.executeUpdate("UPDATE `" + tablePrefix + "skills` SET `total` = (taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy)");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_total` (`total`) USING BTREE");
|
||||
connection.commit();
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
connection.setAutoCommit(true);
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpgradeDropSpout(final Statement statement) {
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
resultSet = statement.executeQuery("SELECT * FROM `" + tablePrefix + "huds` LIMIT 1");
|
||||
|
||||
ResultSetMetaData rsmeta = resultSet.getMetaData();
|
||||
boolean column_exists = false;
|
||||
|
||||
for (int i = 1; i <= rsmeta.getColumnCount(); i++) {
|
||||
if (rsmeta.getColumnName(i).equalsIgnoreCase("hudtype")) {
|
||||
column_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (column_exists) {
|
||||
mcMMO.p.getLogger().info("Removing Spout HUD type from huds table...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "huds` DROP COLUMN `hudtype`");
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
tryClose(resultSet);
|
||||
}
|
||||
}
|
||||
|
||||
private int getUserID(final Connection connection, final String playerName, final UUID uuid) {
|
||||
if (uuid == null)
|
||||
return getUserIDByName(connection, playerName);
|
||||
|
||||
if (cachedUserIDs.containsKey(uuid))
|
||||
return cachedUserIDs.get(uuid);
|
||||
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
statement = connection.prepareStatement("SELECT id, user FROM " + tablePrefix + "users WHERE uuid = ? OR (uuid IS NULL AND user = ?)");
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, playerName);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
int id = resultSet.getInt("id");
|
||||
|
||||
cachedUserIDs.put(uuid, id);
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int getUserIDByName(final Connection connection, final String playerName) {
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
statement = connection.prepareStatement("SELECT id, user FROM " + tablePrefix + "users WHERE user = ?");
|
||||
statement.setString(1, playerName);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
int id = resultSet.getInt("id");
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void tryClose(AutoCloseable closeable) {
|
||||
if (closeable != null) {
|
||||
try {
|
||||
closeable.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
mcMMO.p.debug("Releasing connection pool resource...");
|
||||
miscPool.close();
|
||||
loadPool.close();
|
||||
savePool.close();
|
||||
}
|
||||
|
||||
public enum PoolIdentifier {
|
||||
MISC,
|
||||
LOAD,
|
||||
SAVE
|
||||
}
|
||||
|
||||
public void resetMobHealthSettings() {
|
||||
PreparedStatement statement = null;
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "huds SET mobhealthbar = ?");
|
||||
statement.setString(1, Config.getInstance().getMobHealthbarDefault().toString());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,11 @@ package com.gmail.nossr50.core.datatypes;
|
||||
import com.gmail.nossr50.core.mcmmo.Location;
|
||||
|
||||
public class LimitedSizeList {
|
||||
public Location[] limitedSizeOrderedList;
|
||||
private final int size;
|
||||
public Location[] limitedSizeOrderedList;
|
||||
|
||||
|
||||
public LimitedSizeList(int size)
|
||||
{
|
||||
public LimitedSizeList(int size) {
|
||||
this.size = size;
|
||||
limitedSizeOrderedList = new Location[size];
|
||||
}
|
||||
@ -16,16 +15,15 @@ public class LimitedSizeList {
|
||||
/**
|
||||
* Adds objects to our limited size ordered list
|
||||
* New objects are added to the front
|
||||
*
|
||||
* @param newItem
|
||||
*/
|
||||
public void add(Location newItem)
|
||||
{
|
||||
public void add(Location newItem) {
|
||||
Location[] newList = new Location[size];
|
||||
|
||||
for(int i = 0; i < size-1; i++)
|
||||
{
|
||||
if(i != 0)
|
||||
newList[i] = limitedSizeOrderedList[i-1];
|
||||
for (int i = 0; i < size - 1; i++) {
|
||||
if (i != 0)
|
||||
newList[i] = limitedSizeOrderedList[i - 1];
|
||||
else
|
||||
newList[i] = newItem;
|
||||
}
|
||||
@ -35,17 +33,16 @@ public class LimitedSizeList {
|
||||
|
||||
/**
|
||||
* Returns true if the object is anywhere in our list
|
||||
*
|
||||
* @param targetLoc the object to check for
|
||||
* @return true if the object is in our list
|
||||
*/
|
||||
public boolean contains(Location targetLoc)
|
||||
{
|
||||
for(Location iter : limitedSizeOrderedList)
|
||||
{
|
||||
if(iter == null)
|
||||
public boolean contains(Location targetLoc) {
|
||||
for (Location iter : limitedSizeOrderedList) {
|
||||
if (iter == null)
|
||||
continue;
|
||||
|
||||
if(iter.getX() == targetLoc.getX()
|
||||
if (iter.getX() == targetLoc.getX()
|
||||
&& iter.getY() == targetLoc.getY()
|
||||
&& iter.getZ() == targetLoc.getZ())
|
||||
return true;
|
||||
|
@ -10,7 +10,7 @@ public enum ChatMode {
|
||||
private String disabledMessage;
|
||||
|
||||
private ChatMode(String enabledMessage, String disabledMessage) {
|
||||
this.enabledMessage = enabledMessage;
|
||||
this.enabledMessage = enabledMessage;
|
||||
this.disabledMessage = disabledMessage;
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,7 @@ public enum DatabaseType {
|
||||
|
||||
if (typeName.equalsIgnoreCase("file")) {
|
||||
return FLATFILE;
|
||||
}
|
||||
else if (typeName.equalsIgnoreCase("mysql")) {
|
||||
} else if (typeName.equalsIgnoreCase("mysql")) {
|
||||
return SQL;
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,7 @@ public enum FormulaType {
|
||||
public static FormulaType getFormulaType(String string) {
|
||||
try {
|
||||
return valueOf(string);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,10 @@ public class SkillXpGain implements Delayed {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private static long getDuration() {
|
||||
return TimeUnit.MINUTES.toMillis(ExperienceConfig.getInstance().getDiminishedReturnsTimeInterval());
|
||||
}
|
||||
|
||||
public PrimarySkillType getSkill() {
|
||||
return type;
|
||||
}
|
||||
@ -25,15 +29,10 @@ public class SkillXpGain implements Delayed {
|
||||
return xp;
|
||||
}
|
||||
|
||||
private static long getDuration() {
|
||||
return TimeUnit.MINUTES.toMillis(ExperienceConfig.getInstance().getDiminishedReturnsTimeInterval());
|
||||
}
|
||||
|
||||
public int compareTo(SkillXpGain other) {
|
||||
if (this.expiryTime < other.expiryTime) {
|
||||
return -1;
|
||||
}
|
||||
else if (this.expiryTime > other.expiryTime) {
|
||||
} else if (this.expiryTime > other.expiryTime) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -24,8 +24,7 @@ public enum NotificationType {
|
||||
|
||||
final String niceName;
|
||||
|
||||
NotificationType(String niceName)
|
||||
{
|
||||
NotificationType(String niceName) {
|
||||
this.niceName = niceName;
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
package com.gmail.nossr50.core.datatypes.json;
|
||||
|
||||
public class McMMOUrl {
|
||||
public static final String urlWebsite = "https://www.mcmmo.org";
|
||||
public static final String urlDiscord = "https://discord.gg/bJ7pFS9";
|
||||
public static final String urlPatreon = "https://www.patreon.com/com.gmail.nossr50";
|
||||
public static final String urlWiki = "https://www.mcmmo.org/wiki/";
|
||||
public static final String urlSpigot = "http://spigot.mcmmo.org";
|
||||
public static final String urlWebsite = "https://www.mcmmo.org";
|
||||
public static final String urlDiscord = "https://discord.gg/bJ7pFS9";
|
||||
public static final String urlPatreon = "https://www.patreon.com/com.gmail.nossr50";
|
||||
public static final String urlWiki = "https://www.mcmmo.org/wiki/";
|
||||
public static final String urlSpigot = "http://spigot.mcmmo.org";
|
||||
public static final String urlTranslate = "https://www.mcmmo.org/translate/";
|
||||
|
||||
public static String getUrl(McMMOWebLinks webLinks)
|
||||
{
|
||||
switch(webLinks)
|
||||
{
|
||||
public static String getUrl(McMMOWebLinks webLinks) {
|
||||
switch (webLinks) {
|
||||
case WIKI:
|
||||
return urlWiki;
|
||||
case PATREON:
|
||||
|
@ -11,28 +11,24 @@ public enum McMMOWebLinks {
|
||||
HELP_TRANSLATE,
|
||||
WIKI;
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
public String getUrl() {
|
||||
return McMMOUrl.getUrl(this);
|
||||
}
|
||||
|
||||
public String getNiceTitle()
|
||||
{
|
||||
public String getNiceTitle() {
|
||||
return StringUtils.getCapitalized(toString());
|
||||
}
|
||||
|
||||
public String getLocaleDescription()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
public String getLocaleDescription() {
|
||||
switch (this) {
|
||||
case WEBSITE:
|
||||
return LocaleLoader.getString( "JSON.URL.Website");
|
||||
return LocaleLoader.getString("JSON.URL.Website");
|
||||
case DISCORD:
|
||||
return LocaleLoader.getString( "JSON.URL.Discord");
|
||||
return LocaleLoader.getString("JSON.URL.Discord");
|
||||
case PATREON:
|
||||
return LocaleLoader.getString( "JSON.URL.Patreon");
|
||||
return LocaleLoader.getString("JSON.URL.Patreon");
|
||||
case HELP_TRANSLATE:
|
||||
return LocaleLoader.getString( "JSON.URL.Translation");
|
||||
return LocaleLoader.getString("JSON.URL.Translation");
|
||||
case SPIGOT:
|
||||
return LocaleLoader.getString("JSON.URL.Spigot");
|
||||
case WIKI:
|
||||
|
@ -8,8 +8,7 @@ import org.bukkit.metadata.FixedMetadataValue;
|
||||
*/
|
||||
public class OldName extends FixedMetadataValue {
|
||||
|
||||
public OldName(String oldName, mcMMO plugin)
|
||||
{
|
||||
public OldName(String oldName, mcMMO plugin) {
|
||||
super(plugin, oldName);
|
||||
}
|
||||
}
|
||||
|
@ -15,17 +15,13 @@ public enum ItemShareType {
|
||||
public static ItemShareType getShareType(ItemStack itemStack) {
|
||||
if (ItemUtils.isMobDrop(itemStack)) {
|
||||
return LOOT;
|
||||
}
|
||||
else if (ItemUtils.isMiningDrop(itemStack)) {
|
||||
} else if (ItemUtils.isMiningDrop(itemStack)) {
|
||||
return MINING;
|
||||
}
|
||||
else if (ItemUtils.isHerbalismDrop(itemStack)) {
|
||||
} else if (ItemUtils.isHerbalismDrop(itemStack)) {
|
||||
return HERBALISM;
|
||||
}
|
||||
else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
|
||||
} else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
|
||||
return WOODCUTTING;
|
||||
}
|
||||
else if (ItemUtils.isMiscDrop(itemStack)) {
|
||||
} else if (ItemUtils.isMiscDrop(itemStack)) {
|
||||
return MISC;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.gmail.nossr50.core.datatypes.party;
|
||||
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -31,14 +31,14 @@ public class Party {
|
||||
private int level;
|
||||
private float xp;
|
||||
|
||||
private ShareMode xpShareMode = ShareMode.NONE;
|
||||
private ShareMode xpShareMode = ShareMode.NONE;
|
||||
private ShareMode itemShareMode = ShareMode.NONE;
|
||||
|
||||
private boolean shareLootDrops = true;
|
||||
private boolean shareMiningDrops = true;
|
||||
private boolean shareHerbalismDrops = true;
|
||||
private boolean shareLootDrops = true;
|
||||
private boolean shareMiningDrops = true;
|
||||
private boolean shareHerbalismDrops = true;
|
||||
private boolean shareWoodcuttingDrops = true;
|
||||
private boolean shareMiscDrops = true;
|
||||
private boolean shareMiscDrops = true;
|
||||
|
||||
public Party(String name) {
|
||||
this.name = name;
|
||||
@ -75,13 +75,11 @@ public class Party {
|
||||
return onlineMembers;
|
||||
}
|
||||
|
||||
public List<Player> getVisibleMembers(Player player)
|
||||
{
|
||||
public List<Player> getVisibleMembers(Player player) {
|
||||
ArrayList<Player> visibleMembers = new ArrayList<>();
|
||||
|
||||
for(Player p : onlineMembers)
|
||||
{
|
||||
if(player.canSee(p))
|
||||
for (Player p : onlineMembers) {
|
||||
if (player.canSee(p))
|
||||
visibleMembers.add(p);
|
||||
}
|
||||
|
||||
@ -113,22 +111,42 @@ public class Party {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public PartyLeader getLeader() {
|
||||
return leader;
|
||||
}
|
||||
|
||||
public void setLeader(PartyLeader leader) {
|
||||
this.leader = leader;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public boolean isLocked() {
|
||||
return locked;
|
||||
}
|
||||
|
||||
public void setLocked(boolean locked) {
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
public Party getAlly() {
|
||||
return ally;
|
||||
}
|
||||
|
||||
public void setAlly(Party ally) {
|
||||
this.ally = ally;
|
||||
}
|
||||
|
||||
public List<String> getItemShareCategories() {
|
||||
List<String> shareCategories = new ArrayList<String>();
|
||||
|
||||
@ -141,26 +159,6 @@ public class Party {
|
||||
return shareCategories;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setLeader(PartyLeader leader) {
|
||||
this.leader = leader;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void setLocked(boolean locked) {
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
public void setAlly(Party ally) {
|
||||
this.ally = ally;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
@ -251,22 +249,22 @@ public class Party {
|
||||
return Config.getInstance().getPartyLevelCap() < getLevel() + 1;
|
||||
}
|
||||
|
||||
public void setXpShareMode(ShareMode xpShareMode) {
|
||||
this.xpShareMode = xpShareMode;
|
||||
}
|
||||
|
||||
public ShareMode getXpShareMode() {
|
||||
return xpShareMode;
|
||||
}
|
||||
|
||||
public void setItemShareMode(ShareMode itemShareMode) {
|
||||
this.itemShareMode = itemShareMode;
|
||||
public void setXpShareMode(ShareMode xpShareMode) {
|
||||
this.xpShareMode = xpShareMode;
|
||||
}
|
||||
|
||||
public ShareMode getItemShareMode() {
|
||||
return itemShareMode;
|
||||
}
|
||||
|
||||
public void setItemShareMode(ShareMode itemShareMode) {
|
||||
this.itemShareMode = itemShareMode;
|
||||
}
|
||||
|
||||
public boolean sharingDrops(ItemShareType shareType) {
|
||||
switch (shareType) {
|
||||
case HERBALISM:
|
||||
@ -336,11 +334,9 @@ public class Party {
|
||||
if (otherPlayer == null) {
|
||||
memberName = memberName.substring(0, 1) + ChatColor.GRAY + ChatColor.ITALIC + "" + memberName.substring(1);
|
||||
}
|
||||
}
|
||||
else if (otherPlayer != null) {
|
||||
} else if (otherPlayer != null) {
|
||||
memberList.append(ChatColor.WHITE);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
memberList.append(ChatColor.GRAY);
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,9 @@ import com.gmail.nossr50.util.Misc;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PartyTeleportRecord {
|
||||
private Player requestor;
|
||||
private Player requestor;
|
||||
private boolean enabled, confirmRequired;
|
||||
private int timeout, lastUse;
|
||||
private int timeout, lastUse;
|
||||
|
||||
public PartyTeleportRecord() {
|
||||
requestor = null;
|
||||
|
@ -10,12 +10,10 @@ public enum ShareMode {
|
||||
public static ShareMode getShareMode(String string) {
|
||||
try {
|
||||
return valueOf(string);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
if (string.equalsIgnoreCase("even")) {
|
||||
return EQUAL;
|
||||
}
|
||||
else if (CommandUtils.shouldDisableToggle(string)) {
|
||||
} else if (CommandUtils.shouldDisableToggle(string)) {
|
||||
return NONE;
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,19 @@
|
||||
package com.gmail.nossr50.core.datatypes.player;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.config.skills.AdvancedConfig;
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.core.config.skills.WorldBlacklist;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainSource;
|
||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.core.datatypes.mods.CustomTool;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.core.datatypes.mods.CustomTool;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.skills.ToolType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -43,7 +44,6 @@ import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.experience.ExperienceBarManager;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
@ -65,41 +65,32 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class McMMOPlayer {
|
||||
private Player player;
|
||||
private PlayerProfile profile;
|
||||
|
||||
private final Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<PrimarySkillType, SkillManager>();
|
||||
private final Map<SuperAbilityType, Boolean> abilityMode = new HashMap<SuperAbilityType, Boolean>();
|
||||
private final Map<SuperAbilityType, Boolean> abilityInformed = new HashMap<SuperAbilityType, Boolean>();
|
||||
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
||||
private final FixedMetadataValue playerMetadata;
|
||||
private Player player;
|
||||
private PlayerProfile profile;
|
||||
private ExperienceBarManager experienceBarManager;
|
||||
|
||||
private Party party;
|
||||
private Party invite;
|
||||
private Party allianceInvite;
|
||||
private int itemShareModifier;
|
||||
|
||||
private Party party;
|
||||
private Party invite;
|
||||
private Party allianceInvite;
|
||||
private int itemShareModifier;
|
||||
private PartyTeleportRecord ptpRecord;
|
||||
|
||||
private boolean partyChatMode;
|
||||
private boolean adminChatMode;
|
||||
private boolean displaySkillNotifications = true;
|
||||
|
||||
private boolean abilityUse = true;
|
||||
private boolean godMode;
|
||||
private boolean chatSpy = false; //Off by default
|
||||
|
||||
private final Map<SuperAbilityType, Boolean> abilityMode = new HashMap<SuperAbilityType, Boolean>();
|
||||
private final Map<SuperAbilityType, Boolean> abilityInformed = new HashMap<SuperAbilityType, Boolean>();
|
||||
|
||||
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
||||
|
||||
private int recentlyHurt;
|
||||
private int respawnATS;
|
||||
private int teleportATS;
|
||||
private long databaseATS;
|
||||
//private int chimeraWingLastUse;
|
||||
private Location teleportCommence;
|
||||
|
||||
private boolean isUsingUnarmed;
|
||||
private final FixedMetadataValue playerMetadata;
|
||||
|
||||
public McMMOPlayer(Player player, PlayerProfile profile) {
|
||||
String playerName = player.getName();
|
||||
@ -122,8 +113,7 @@ public class McMMOPlayer {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
|
||||
skillManagers.put(primarySkillType, primarySkillType.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mcMMO.p.getPluginLoader().disablePlugin(mcMMO.p);
|
||||
}
|
||||
@ -145,37 +135,33 @@ public class McMMOPlayer {
|
||||
experienceBarManager.hideExperienceBar(primarySkillType);
|
||||
}*/
|
||||
|
||||
public void processPostXpEvent(XPGainReason xpGainReason, PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource)
|
||||
{
|
||||
public void processPostXpEvent(XPGainReason xpGainReason, PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource) {
|
||||
//Updates from Party sources
|
||||
if(xpGainSource == XPGainSource.PARTY_MEMBERS && !ExperienceConfig.getInstance().isPartyExperienceBarsEnabled())
|
||||
if (xpGainSource == XPGainSource.PARTY_MEMBERS && !ExperienceConfig.getInstance().isPartyExperienceBarsEnabled())
|
||||
return;
|
||||
|
||||
//Updates from passive sources (Alchemy, Smelting, etc...)
|
||||
if(xpGainSource == XPGainSource.PASSIVE && !ExperienceConfig.getInstance().isPassiveGainsExperienceBarsEnabled())
|
||||
if (xpGainSource == XPGainSource.PASSIVE && !ExperienceConfig.getInstance().isPassiveGainsExperienceBarsEnabled())
|
||||
return;
|
||||
|
||||
updateXPBar(primarySkillType, plugin);
|
||||
}
|
||||
|
||||
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType, int skillLevel)
|
||||
{
|
||||
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType, int skillLevel) {
|
||||
RankUtils.executeSkillUnlockNotifications(plugin, this, primarySkillType, skillLevel);
|
||||
}
|
||||
|
||||
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin)
|
||||
{
|
||||
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin) {
|
||||
//Skill Unlock Notifications
|
||||
|
||||
if(primarySkillType.isChildSkill())
|
||||
if (primarySkillType.isChildSkill())
|
||||
return;
|
||||
|
||||
//XP BAR UPDATES
|
||||
experienceBarManager.updateExperienceBar(primarySkillType, plugin);
|
||||
}
|
||||
|
||||
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType)
|
||||
{
|
||||
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType) {
|
||||
double currentXP = profile.getSkillXpLevel(primarySkillType);
|
||||
double maxXP = profile.getXpToLevel(primarySkillType);
|
||||
|
||||
@ -269,7 +255,7 @@ public class McMMOPlayer {
|
||||
/**
|
||||
* Set the mode of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @param ability The ability to check
|
||||
* @param isActive True if the ability is active, false otherwise
|
||||
*/
|
||||
public void setAbilityMode(SuperAbilityType ability, boolean isActive) {
|
||||
@ -289,7 +275,7 @@ public class McMMOPlayer {
|
||||
/**
|
||||
* Set the informed state of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @param ability The ability to check
|
||||
* @param isInformed True if the ability is informed, false otherwise
|
||||
*/
|
||||
public void setAbilityInformed(SuperAbilityType ability, boolean isInformed) {
|
||||
@ -330,7 +316,7 @@ public class McMMOPlayer {
|
||||
/**
|
||||
* Set the current prep mode of a tool.
|
||||
*
|
||||
* @param tool Tool to set the mode for
|
||||
* @param tool Tool to set the mode for
|
||||
* @param isPrepared true if the tool should be prepped, false otherwise
|
||||
*/
|
||||
public void setToolPreparationMode(ToolType tool, boolean isPrepared) {
|
||||
@ -421,9 +407,13 @@ public class McMMOPlayer {
|
||||
* Party Chat Spy
|
||||
*/
|
||||
|
||||
public boolean isPartyChatSpying() { return chatSpy; }
|
||||
public boolean isPartyChatSpying() {
|
||||
return chatSpy;
|
||||
}
|
||||
|
||||
public void togglePartyChatSpying() { chatSpy = !chatSpy;}
|
||||
public void togglePartyChatSpying() {
|
||||
chatSpy = !chatSpy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skill notifications
|
||||
@ -458,7 +448,7 @@ public class McMMOPlayer {
|
||||
* Begins an experience gain. The amount will be affected by skill modifiers, global rate, perks, and may be shared with the party
|
||||
*
|
||||
* @param skill Skill being used
|
||||
* @param xp Experience amount to process
|
||||
* @param xp Experience amount to process
|
||||
*/
|
||||
public void beginXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||
Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero.");
|
||||
@ -492,7 +482,7 @@ public class McMMOPlayer {
|
||||
* Begins an experience gain. The amount will be affected by skill modifiers, global rate and perks
|
||||
*
|
||||
* @param skill Skill being used
|
||||
* @param xp Experience amount to process
|
||||
* @param xp Experience amount to process
|
||||
*/
|
||||
public void beginUnsharedXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason, xpGainSource);
|
||||
@ -510,7 +500,7 @@ public class McMMOPlayer {
|
||||
* Applies an experience gain
|
||||
*
|
||||
* @param primarySkillType Skill being used
|
||||
* @param xp Experience amount to add
|
||||
* @param xp Experience amount to add
|
||||
*/
|
||||
public void applyXpGain(PrimarySkillType primarySkillType, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||
if (!primarySkillType.getPermissions(player)) {
|
||||
@ -603,26 +593,26 @@ public class McMMOPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
public void setPartyInvite(Party invite) {
|
||||
this.invite = invite;
|
||||
}
|
||||
|
||||
public Party getPartyInvite() {
|
||||
return invite;
|
||||
}
|
||||
|
||||
public void setPartyInvite(Party invite) {
|
||||
this.invite = invite;
|
||||
}
|
||||
|
||||
public boolean hasPartyInvite() {
|
||||
return (invite != null);
|
||||
}
|
||||
|
||||
public void setParty(Party party) {
|
||||
this.party = party;
|
||||
}
|
||||
|
||||
public Party getParty() {
|
||||
return party;
|
||||
}
|
||||
|
||||
public void setParty(Party party) {
|
||||
this.party = party;
|
||||
}
|
||||
|
||||
public boolean inParty() {
|
||||
return (party != null);
|
||||
}
|
||||
@ -639,14 +629,14 @@ public class McMMOPlayer {
|
||||
return ptpRecord;
|
||||
}
|
||||
|
||||
public void setPartyAllianceInvite(Party allianceInvite) {
|
||||
this.allianceInvite = allianceInvite;
|
||||
}
|
||||
|
||||
public Party getPartyAllianceInvite() {
|
||||
return allianceInvite;
|
||||
}
|
||||
|
||||
public void setPartyAllianceInvite(Party allianceInvite) {
|
||||
this.allianceInvite = allianceInvite;
|
||||
}
|
||||
|
||||
public boolean hasPartyAllianceInvite() {
|
||||
return (allianceInvite != null);
|
||||
}
|
||||
@ -746,7 +736,7 @@ public class McMMOPlayer {
|
||||
* Modifies an experience gain using skill modifiers, global rate and perks
|
||||
*
|
||||
* @param primarySkillType Skill being used
|
||||
* @param xp Experience amount to process
|
||||
* @param xp Experience amount to process
|
||||
* @return Modified experience
|
||||
*/
|
||||
private float modifyXpGain(PrimarySkillType primarySkillType, float xp) {
|
||||
@ -769,7 +759,7 @@ public class McMMOPlayer {
|
||||
|
||||
public void checkGodMode() {
|
||||
if (godMode && !Permissions.mcgod(player)
|
||||
|| godMode && WorldBlacklist.isWorldBlacklisted(player.getWorld())) {
|
||||
|| godMode && WorldBlacklist.isWorldBlacklisted(player.getWorld())) {
|
||||
toggleGodMode();
|
||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
|
||||
}
|
||||
@ -798,8 +788,7 @@ public class McMMOPlayer {
|
||||
|
||||
//TODO: This is hacky and temporary solution until skills are move to the new system
|
||||
//Potential problems with this include skills with two super abilities (ie mining)
|
||||
if(!skill.isSuperAbilityUnlocked(getPlayer()))
|
||||
{
|
||||
if (!skill.isSuperAbilityUnlocked(getPlayer())) {
|
||||
int diff = RankUtils.getSuperAbilityUnlockRequirement(skill.getAbility()) - getSkillLevel(skill);
|
||||
|
||||
//Inform the player they are not yet skilled enough
|
||||
@ -833,8 +822,7 @@ public class McMMOPlayer {
|
||||
int ticks;
|
||||
|
||||
//Ability cap of 0 or below means no cap
|
||||
if(abilityLengthCap > 0)
|
||||
{
|
||||
if (abilityLengthCap > 0) {
|
||||
ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, getSkillLevel(skill)) / abilityLengthVar), ability.getMaxLength());
|
||||
} else {
|
||||
ticks = PerksUtils.handleActivationPerks(player, 2 + (getSkillLevel(skill) / abilityLengthVar), ability.getMaxLength());
|
||||
@ -918,7 +906,6 @@ public class McMMOPlayer {
|
||||
* Calculate the time remaining until the ability's cooldown expires.
|
||||
*
|
||||
* @param ability SuperAbilityType whose cooldown to check
|
||||
*
|
||||
* @return the number of seconds remaining before the cooldown expires
|
||||
*/
|
||||
public int calculateTimeRemaining(SuperAbilityType ability) {
|
||||
@ -999,7 +986,7 @@ public class McMMOPlayer {
|
||||
|
||||
UserManager.remove(thisPlayer);
|
||||
|
||||
if(Config.getInstance().getScoreboardsEnabled())
|
||||
if (Config.getInstance().getScoreboardsEnabled())
|
||||
ScoreboardManager.teardownPlayer(thisPlayer);
|
||||
|
||||
if (inParty()) {
|
||||
|
@ -1,17 +1,17 @@
|
||||
package com.gmail.nossr50.core.datatypes.player;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.config.skills.AdvancedConfig;
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.core.datatypes.experience.SkillXpGain;
|
||||
import com.gmail.nossr50.core.skills.MobHealthbarType;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.core.skills.MobHealthbarType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -22,20 +22,17 @@ import java.util.concurrent.DelayQueue;
|
||||
|
||||
public class PlayerProfile {
|
||||
private final String playerName;
|
||||
/* Skill Data */
|
||||
private final Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>(); // Skill & Level
|
||||
private final Map<PrimarySkillType, Float> skillsXp = new HashMap<PrimarySkillType, Float>(); // Skill & XP
|
||||
private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<SuperAbilityType, Integer>(); // Ability & Cooldown
|
||||
private final Map<UniqueDataType, Integer> uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
||||
private UUID uuid;
|
||||
private boolean loaded;
|
||||
private volatile boolean changed;
|
||||
|
||||
/* HUDs */
|
||||
private MobHealthbarType mobHealthbarType;
|
||||
private int scoreboardTipsShown;
|
||||
|
||||
/* Skill Data */
|
||||
private final Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>(); // Skill & Level
|
||||
private final Map<PrimarySkillType, Float> skillsXp = new HashMap<PrimarySkillType, Float>(); // Skill & XP
|
||||
private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<SuperAbilityType, Integer>(); // Ability & Cooldown
|
||||
private final Map<UniqueDataType, Integer> uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
||||
|
||||
// Store previous XP gains for deminished returns
|
||||
private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>();
|
||||
private HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<PrimarySkillType, Float>();
|
||||
@ -158,7 +155,9 @@ public class PlayerProfile {
|
||||
* Cooldowns
|
||||
*/
|
||||
|
||||
public int getChimaerWingDATS() { return uniquePlayerData.get(UniqueDataType.CHIMAERA_WING_DATS);}
|
||||
public int getChimaerWingDATS() {
|
||||
return uniquePlayerData.get(UniqueDataType.CHIMAERA_WING_DATS);
|
||||
}
|
||||
|
||||
protected void setChimaeraWingDATS(int DATS) {
|
||||
changed = true;
|
||||
@ -170,7 +169,9 @@ public class PlayerProfile {
|
||||
uniquePlayerData.put(uniqueDataType, newData);
|
||||
}
|
||||
|
||||
public long getUniqueData(UniqueDataType uniqueDataType) { return uniquePlayerData.get(uniqueDataType); }
|
||||
public long getUniqueData(UniqueDataType uniqueDataType) {
|
||||
return uniquePlayerData.get(uniqueDataType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current deactivation timestamp of an ability.
|
||||
@ -186,7 +187,7 @@ public class PlayerProfile {
|
||||
* Set the current deactivation timestamp of an ability.
|
||||
*
|
||||
* @param ability The {@link SuperAbilityType} to set the DATS for
|
||||
* @param DATS the DATS of the ability
|
||||
* @param DATS the DATS of the ability
|
||||
*/
|
||||
protected void setAbilityDATS(SuperAbilityType ability, long DATS) {
|
||||
changed = true;
|
||||
@ -246,7 +247,7 @@ public class PlayerProfile {
|
||||
* Remove Xp from a skill.
|
||||
*
|
||||
* @param skill Type of skill to modify
|
||||
* @param xp Amount of xp to remove
|
||||
* @param xp Amount of xp to remove
|
||||
*/
|
||||
public void removeXp(PrimarySkillType skill, int xp) {
|
||||
if (skill.isChildSkill()) {
|
||||
@ -282,7 +283,7 @@ public class PlayerProfile {
|
||||
changed = true;
|
||||
|
||||
//Don't allow levels to be negative
|
||||
if(level < 0)
|
||||
if (level < 0)
|
||||
level = 0;
|
||||
|
||||
skills.put(skill, level);
|
||||
@ -292,7 +293,7 @@ public class PlayerProfile {
|
||||
/**
|
||||
* Add levels to a skill.
|
||||
*
|
||||
* @param skill Type of skill to add levels to
|
||||
* @param skill Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
*/
|
||||
public void addLevels(PrimarySkillType skill, int levels) {
|
||||
@ -303,7 +304,7 @@ public class PlayerProfile {
|
||||
* Add Experience to a skill.
|
||||
*
|
||||
* @param skill Type of skill to add experience to
|
||||
* @param xp Number of experience to add
|
||||
* @param xp Number of experience to add
|
||||
*/
|
||||
public void addXp(PrimarySkillType skill, float xp) {
|
||||
changed = true;
|
||||
@ -315,8 +316,7 @@ public class PlayerProfile {
|
||||
for (PrimarySkillType parentSkill : parentSkills) {
|
||||
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
skillsXp.put(skill, skillsXp.get(skill) + xp);
|
||||
}
|
||||
}
|
||||
@ -342,7 +342,7 @@ public class PlayerProfile {
|
||||
* This is used for diminished XP returns
|
||||
*
|
||||
* @param primarySkillType Skill being used
|
||||
* @param xp Experience amount to add
|
||||
* @param xp Experience amount to add
|
||||
*/
|
||||
public void registerXpGain(PrimarySkillType primarySkillType, float xp) {
|
||||
gainedSkillsXp.add(new SkillXpGain(primarySkillType, xp));
|
||||
|
@ -14,7 +14,10 @@ public final class LocaleLoader {
|
||||
private static ResourceBundle bundle = null;
|
||||
private static ResourceBundle enBundle = null;
|
||||
|
||||
private LocaleLoader() {};
|
||||
private LocaleLoader() {
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public static String getString(String key) {
|
||||
return getString(key, (Object[]) null);
|
||||
@ -23,7 +26,7 @@ public final class LocaleLoader {
|
||||
/**
|
||||
* Gets the appropriate string from the Locale files.
|
||||
*
|
||||
* @param key The key to look up the string with
|
||||
* @param key The key to look up the string with
|
||||
* @param messageArguments Any arguments to be added to the string
|
||||
* @return The properly formatted locale string
|
||||
*/
|
||||
@ -34,12 +37,10 @@ public final class LocaleLoader {
|
||||
|
||||
try {
|
||||
return getString(key, bundle, messageArguments);
|
||||
}
|
||||
catch (MissingResourceException ex) {
|
||||
} catch (MissingResourceException ex) {
|
||||
try {
|
||||
return getString(key, enBundle, messageArguments);
|
||||
}
|
||||
catch (MissingResourceException ex2) {
|
||||
} catch (MissingResourceException ex2) {
|
||||
if (!key.contains("Guides")) {
|
||||
mcMMO.p.getLogger().warning("Could not find locale string: " + key);
|
||||
}
|
||||
@ -80,8 +81,7 @@ public final class LocaleLoader {
|
||||
|
||||
if (myLocale.length == 1) {
|
||||
locale = new Locale(myLocale[0]);
|
||||
}
|
||||
else if (myLocale.length >= 2) {
|
||||
} else if (myLocale.length >= 2) {
|
||||
locale = new Locale(myLocale[0], myLocale[1]);
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,7 @@ public abstract class AbstractWorld implements World {
|
||||
|
||||
private final String worldName;
|
||||
|
||||
public AbstractWorld(String worldName)
|
||||
{
|
||||
public AbstractWorld(String worldName) {
|
||||
this.worldName = worldName;
|
||||
}
|
||||
|
||||
@ -27,6 +26,7 @@ public abstract class AbstractWorld implements World {
|
||||
|
||||
/**
|
||||
* Compares this object to another to see if they are equal
|
||||
*
|
||||
* @param o the other object
|
||||
* @return true if they are equal
|
||||
*/
|
||||
@ -40,6 +40,7 @@ public abstract class AbstractWorld implements World {
|
||||
|
||||
/**
|
||||
* The hash code for the object, used for comparisons
|
||||
*
|
||||
* @return hash code for this object
|
||||
*/
|
||||
@Override
|
||||
|
@ -8,24 +8,28 @@ public interface Location {
|
||||
|
||||
/**
|
||||
* Returns the position of this location on the x-axis
|
||||
*
|
||||
* @return x-axis position
|
||||
*/
|
||||
double getX();
|
||||
|
||||
/**
|
||||
* Returns the position of this location on the y-axis
|
||||
*
|
||||
* @return y-axis position
|
||||
*/
|
||||
double getY();
|
||||
|
||||
/**
|
||||
* Returns the position of this location on the z-axis
|
||||
*
|
||||
* @return z-axis position
|
||||
*/
|
||||
double getZ();
|
||||
|
||||
/**
|
||||
* The world for this Location
|
||||
*
|
||||
* @return the world of this location
|
||||
*/
|
||||
World getWorld();
|
||||
|
@ -3,12 +3,14 @@ package com.gmail.nossr50.core.mcmmo;
|
||||
public interface Nameable extends Named {
|
||||
/**
|
||||
* Change the name for this entity
|
||||
*
|
||||
* @param newName the new name of this entity
|
||||
*/
|
||||
void setName(String newName);
|
||||
|
||||
/**
|
||||
* Returns the original name for this entity before any renaming
|
||||
*
|
||||
* @return the original name of this entity
|
||||
*/
|
||||
String getOriginalName();
|
||||
|
@ -7,6 +7,7 @@ package com.gmail.nossr50.core.mcmmo;
|
||||
public interface Named {
|
||||
/**
|
||||
* Returns the name of this entity
|
||||
*
|
||||
* @return this entity
|
||||
*/
|
||||
String getName();
|
||||
|
@ -5,31 +5,34 @@ import java.util.Collection;
|
||||
/**
|
||||
* Properties are Comparable key value pairs for a blocks state
|
||||
* In MC this exists in three forms, Integer, Booleans, and Enums
|
||||
*
|
||||
* <p>
|
||||
* This class partially mirrors MC Internals
|
||||
*
|
||||
*/
|
||||
public interface Property<T extends Comparable<T>> {
|
||||
/**
|
||||
* The name of the Property
|
||||
*
|
||||
* @return name of this property
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* A collection of allowed values for this property
|
||||
*
|
||||
* @return the allowed values for this property
|
||||
*/
|
||||
Collection<T> getAllowedValues();
|
||||
|
||||
/**
|
||||
* The class of the value for this particular property
|
||||
*
|
||||
* @return the value's class
|
||||
*/
|
||||
Class<T> getValueClass();
|
||||
|
||||
/**
|
||||
* The name for a specific value
|
||||
*
|
||||
* @param value the value to match
|
||||
* @return the name of this value
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.core.mcmmo;
|
||||
public interface World {
|
||||
/**
|
||||
* Gets the name of this World
|
||||
*
|
||||
* @return the name of this world
|
||||
*/
|
||||
String getName();
|
||||
|
@ -4,6 +4,7 @@ import com.gmail.nossr50.core.mcmmo.Property;
|
||||
|
||||
/**
|
||||
* Represents a container of properties and values for a Block
|
||||
*
|
||||
* @see Property
|
||||
* @see BlockState
|
||||
*/
|
||||
@ -12,27 +13,26 @@ public class Block {
|
||||
private final String unlocalizedName; //The name before it is localized (english)
|
||||
private BlockState blockState;
|
||||
|
||||
public Block(String unlocalizedName, BlockState blockState)
|
||||
{
|
||||
public Block(String unlocalizedName, BlockState blockState) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.blockState = blockState;
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this block in English
|
||||
*
|
||||
* @return name of this block in English
|
||||
*/
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of this block
|
||||
*
|
||||
* @return the state of this block
|
||||
*/
|
||||
public BlockState getBlockState()
|
||||
{
|
||||
public BlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.util.Collection;
|
||||
*/
|
||||
public interface BlockState {
|
||||
//This is the immutable map of all properties for this block state
|
||||
ImmutableMap<Property<?>, Comparable<? >> getImmutablePropertyMap();
|
||||
ImmutableMap<Property<?>, Comparable<?>> getImmutablePropertyMap();
|
||||
|
||||
//This will return the keyset for properties on this block state
|
||||
Collection<Property<?>> getPropertyKeyset();
|
||||
@ -20,24 +20,27 @@ public interface BlockState {
|
||||
|
||||
/**
|
||||
* Get the value for the given property key
|
||||
*
|
||||
* @param property the property key
|
||||
* @param <T> the type of property
|
||||
* @param <T> the type of property
|
||||
* @return the value, can be null
|
||||
*/
|
||||
<T extends Comparable<T>> T getPropertyValue(Property<T> property);
|
||||
|
||||
/**
|
||||
* This will attempt to find a matching property for this block state
|
||||
*
|
||||
* @param property the property we want to match
|
||||
* @param value the value we are trying to match
|
||||
* @param <T> the type of the property
|
||||
* @param <V> the type of the value
|
||||
* @param value the value we are trying to match
|
||||
* @param <T> the type of the property
|
||||
* @param <V> the type of the value
|
||||
* @return the matching property on this block state, can be null
|
||||
*/
|
||||
<T extends Comparable<T>, V extends T> BlockState findProperty(Property<T> property, V value);
|
||||
|
||||
/**
|
||||
* This returns the block that this state belongs to
|
||||
*
|
||||
* @return the parent Block
|
||||
*/
|
||||
Block getBlock();
|
||||
|
@ -12,12 +12,14 @@ import java.util.UUID;
|
||||
public interface Entity extends Location, Named {
|
||||
/**
|
||||
* The UUID for this entity
|
||||
*
|
||||
* @return this entity's UUID
|
||||
*/
|
||||
UUID getUUID();
|
||||
|
||||
/**
|
||||
* The Location for this entity
|
||||
*
|
||||
* @return this entity's location
|
||||
*/
|
||||
Location getLocation();
|
||||
|
@ -6,12 +6,14 @@ package com.gmail.nossr50.core.mcmmo.entity;
|
||||
public interface Living {
|
||||
/**
|
||||
* Whether or not this entity is still alive
|
||||
*
|
||||
* @return true if the entity is alive
|
||||
*/
|
||||
Boolean isAlive();
|
||||
|
||||
/**
|
||||
* Change the health of an entity
|
||||
*
|
||||
* @param newHealth the new health value for the entity
|
||||
*/
|
||||
void setHealth(int newHealth);
|
||||
@ -19,6 +21,7 @@ public interface Living {
|
||||
/**
|
||||
* Damage an entity
|
||||
* This damage will be reduced by any defensive modifiers such as armor
|
||||
*
|
||||
* @param damage the damage to deal to this entity
|
||||
*/
|
||||
void damage(int damage);
|
||||
@ -26,6 +29,7 @@ public interface Living {
|
||||
/**
|
||||
* Damage an entity and attribute it to a source
|
||||
* This damage will be reduced by any defensive modifiers such as armor
|
||||
*
|
||||
* @param source the source responsible for the damage
|
||||
* @param damage the damage to deal to this entity
|
||||
*/
|
||||
|
@ -10,12 +10,14 @@ public interface Player extends Living, Nameable {
|
||||
|
||||
/**
|
||||
* Players are not always online
|
||||
*
|
||||
* @return true if the player is online
|
||||
*/
|
||||
Boolean isOnline();
|
||||
|
||||
/**
|
||||
* Gets the McMMOPlayer for this Player
|
||||
*
|
||||
* @return the associated McMMOPlayer, can be null
|
||||
*/
|
||||
McMMOPlayer getMcMMOPlayer();
|
||||
|
@ -7,12 +7,14 @@ public interface Cancellable {
|
||||
|
||||
/**
|
||||
* Whether or not the event is cancelled
|
||||
*
|
||||
* @return true if cancelled
|
||||
*/
|
||||
Boolean isCancelled();
|
||||
|
||||
/**
|
||||
* Sets an events cancellation to b
|
||||
*
|
||||
* @param b
|
||||
*/
|
||||
void setCancelled(boolean b);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.core.party;
|
||||
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.core.datatypes.database.UpgradeType;
|
||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||
@ -10,16 +11,15 @@ import com.gmail.nossr50.core.datatypes.party.PartyLeader;
|
||||
import com.gmail.nossr50.core.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyAllianceChangeEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.core.util.Misc;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.core.util.sounds.SoundType;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyAllianceChangeEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -36,12 +36,13 @@ public final class PartyManager {
|
||||
private static List<Party> parties = new ArrayList<Party>();
|
||||
private static File partyFile = new File(partiesFilePath);
|
||||
|
||||
private PartyManager() {}
|
||||
private PartyManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a party with a given name already exists.
|
||||
*
|
||||
* @param player The player to notify
|
||||
* @param player The player to notify
|
||||
* @param partyName The name of the party to check
|
||||
* @return true if a party with that name exists, false otherwise
|
||||
*/
|
||||
@ -56,19 +57,19 @@ public final class PartyManager {
|
||||
|
||||
/**
|
||||
* Checks if the player can join a party, parties can have a size limit, although there is a permission to bypass this
|
||||
* @param player player who is attempting to join the party
|
||||
*
|
||||
* @param player player who is attempting to join the party
|
||||
* @param targetParty the target party
|
||||
* @return true if party is full and cannot be joined
|
||||
*/
|
||||
public static boolean isPartyFull(Player player, Party targetParty)
|
||||
{
|
||||
public static boolean isPartyFull(Player player, Party targetParty) {
|
||||
return !Permissions.partySizeBypass(player) && Config.getInstance().getPartyMaxSize() >= 1 && targetParty.getOnlineMembers().size() >= Config.getInstance().getPartyMaxSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to change parties or join a new party.
|
||||
*
|
||||
* @param mcMMOPlayer The player changing or joining parties
|
||||
* @param mcMMOPlayer The player changing or joining parties
|
||||
* @param newPartyName The name of the party being joined
|
||||
* @return true if the party was joined successfully, false otherwise
|
||||
*/
|
||||
@ -83,8 +84,8 @@ public final class PartyManager {
|
||||
}
|
||||
|
||||
removeFromParty(mcMMOPlayer);
|
||||
}
|
||||
else return handlePartyChangeEvent(player, null, newPartyName, McMMOPartyChangeEvent.EventReason.JOINED_PARTY);
|
||||
} else
|
||||
return handlePartyChangeEvent(player, null, newPartyName, McMMOPartyChangeEvent.EventReason.JOINED_PARTY);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -92,7 +93,7 @@ public final class PartyManager {
|
||||
/**
|
||||
* Check if two online players are in the same party.
|
||||
*
|
||||
* @param firstPlayer The first player
|
||||
* @param firstPlayer The first player
|
||||
* @param secondPlayer The second player
|
||||
* @return true if they are in the same party, false otherwise
|
||||
*/
|
||||
@ -280,7 +281,7 @@ public final class PartyManager {
|
||||
* Remove a player from a party.
|
||||
*
|
||||
* @param player The player to remove
|
||||
* @param party The party
|
||||
* @param party The party
|
||||
*/
|
||||
public static void removeFromParty(OfflinePlayer player, Party party) {
|
||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
||||
@ -294,8 +295,7 @@ public final class PartyManager {
|
||||
|
||||
if (members.isEmpty()) {
|
||||
parties.remove(party);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// If the leaving player was the party leader, appoint a new leader from the party members
|
||||
if (party.getLeader().getUniqueId().equals(player.getUniqueId())) {
|
||||
setPartyLeader(members.keySet().iterator().next(), party);
|
||||
@ -337,8 +337,8 @@ public final class PartyManager {
|
||||
* Create a new party
|
||||
*
|
||||
* @param mcMMOPlayer The player to add to the party
|
||||
* @param partyName The party to add the player to
|
||||
* @param password The password for this party, null if there was no password
|
||||
* @param partyName The party to add the player to
|
||||
* @param password The password for this party, null if there was no password
|
||||
*/
|
||||
public static void createParty(McMMOPlayer mcMMOPlayer, String partyName, String password) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
@ -358,8 +358,8 @@ public final class PartyManager {
|
||||
/**
|
||||
* Check if a player can join a party
|
||||
*
|
||||
* @param player The player trying to join a party
|
||||
* @param party The party
|
||||
* @param player The player trying to join a party
|
||||
* @param party The party
|
||||
* @param password The password provided by the player
|
||||
* @return true if the player can join the party
|
||||
*/
|
||||
@ -403,8 +403,7 @@ public final class PartyManager {
|
||||
/*
|
||||
* Don't let players join a full party
|
||||
*/
|
||||
if(Config.getInstance().getPartyMaxSize() > 0 && invite.getMembers().size() >= Config.getInstance().getPartyMaxSize())
|
||||
{
|
||||
if (Config.getInstance().getPartyMaxSize() > 0 && invite.getMembers().size() >= Config.getInstance().getPartyMaxSize()) {
|
||||
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull.InviteAccept", invite.getName(), String.valueOf(Config.getInstance().getPartyMaxSize()));
|
||||
return;
|
||||
}
|
||||
@ -452,7 +451,7 @@ public final class PartyManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean disbandAlliance(Player player, Party firstParty, Party secondParty){
|
||||
public static boolean disbandAlliance(Player player, Party firstParty, Party secondParty) {
|
||||
if (!handlePartyChangeAllianceEvent(player, firstParty.getName(), secondParty.getName(), McMMOPartyAllianceChangeEvent.EventReason.DISBAND_ALLIANCE)) {
|
||||
return false;
|
||||
}
|
||||
@ -478,7 +477,7 @@ public final class PartyManager {
|
||||
* Add a player to a party
|
||||
*
|
||||
* @param mcMMOPlayer The player to add to the party
|
||||
* @param party The party
|
||||
* @param party The party
|
||||
*/
|
||||
public static void addToParty(McMMOPlayer mcMMOPlayer, Party party) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
@ -505,7 +504,7 @@ public final class PartyManager {
|
||||
/**
|
||||
* Set the leader of a party.
|
||||
*
|
||||
* @param uuid The uuid of the player to set as leader
|
||||
* @param uuid The uuid of the player to set as leader
|
||||
* @param party The party
|
||||
*/
|
||||
public static void setPartyLeader(UUID uuid, Party party) {
|
||||
@ -517,11 +516,9 @@ public final class PartyManager {
|
||||
|
||||
if (memberUniqueId.equals(player.getUniqueId())) {
|
||||
member.sendMessage(LocaleLoader.getString("Party.Owner.Player"));
|
||||
}
|
||||
else if (memberUniqueId.equals(leaderUniqueId)) {
|
||||
} else if (memberUniqueId.equals(leaderUniqueId)) {
|
||||
member.sendMessage(LocaleLoader.getString("Party.Owner.NotLeader"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
member.sendMessage(LocaleLoader.getString("Party.Owner.New", player.getName()));
|
||||
}
|
||||
}
|
||||
@ -641,8 +638,7 @@ public final class PartyManager {
|
||||
|
||||
try {
|
||||
partiesFile.save(partyFile);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -717,10 +713,10 @@ public final class PartyManager {
|
||||
/**
|
||||
* Handle party change event.
|
||||
*
|
||||
* @param player The player changing parties
|
||||
* @param player The player changing parties
|
||||
* @param oldPartyName The name of the old party
|
||||
* @param newPartyName The name of the new party
|
||||
* @param reason The reason for changing parties
|
||||
* @param reason The reason for changing parties
|
||||
* @return true if the change event was successful, false otherwise
|
||||
*/
|
||||
public static boolean handlePartyChangeEvent(Player player, String oldPartyName, String newPartyName, McMMOPartyChangeEvent.EventReason reason) {
|
||||
@ -733,10 +729,10 @@ public final class PartyManager {
|
||||
/**
|
||||
* Handle party alliance change event.
|
||||
*
|
||||
* @param player The player changing party alliances
|
||||
* @param player The player changing party alliances
|
||||
* @param oldAllyName The name of the old ally
|
||||
* @param newAllyName The name of the new ally
|
||||
* @param reason The reason for changing allies
|
||||
* @param reason The reason for changing allies
|
||||
* @return true if the change event was successful, false otherwise
|
||||
*/
|
||||
public static boolean handlePartyChangeAllianceEvent(Player player, String oldAllyName, String newAllyName, McMMOPartyAllianceChangeEvent.EventReason reason) {
|
||||
@ -760,9 +756,9 @@ public final class PartyManager {
|
||||
/**
|
||||
* Notify party members when the party levels up.
|
||||
*
|
||||
* @param party The concerned party
|
||||
* @param party The concerned party
|
||||
* @param levelsGained The amount of levels gained
|
||||
* @param level The current party level
|
||||
* @param level The current party level
|
||||
*/
|
||||
public static void informPartyMembersLevelUp(Party party, int levelsGained, int level) {
|
||||
boolean levelUpSoundsEnabled = Config.getInstance().getLevelUpSoundsEnabled();
|
||||
@ -778,7 +774,7 @@ public final class PartyManager {
|
||||
/**
|
||||
* Notify party members when a player joins.
|
||||
*
|
||||
* @param party The concerned party
|
||||
* @param party The concerned party
|
||||
* @param playerName The name of the player that joined
|
||||
*/
|
||||
private static void informPartyMembersJoin(Party party, String playerName) {
|
||||
@ -790,7 +786,7 @@ public final class PartyManager {
|
||||
/**
|
||||
* Notify party members when a party member quits.
|
||||
*
|
||||
* @param party The concerned party
|
||||
* @param party The concerned party
|
||||
* @param playerName The name of the player that left
|
||||
*/
|
||||
private static void informPartyMembersQuit(Party party, String playerName) {
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.gmail.nossr50.core.party;
|
||||
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainSource;
|
||||
import com.gmail.nossr50.core.datatypes.party.ItemShareType;
|
||||
@ -10,7 +11,6 @@ import com.gmail.nossr50.core.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.Misc;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -18,13 +18,14 @@ import org.bukkit.inventory.ItemStack;
|
||||
import java.util.List;
|
||||
|
||||
public final class ShareHandler {
|
||||
private ShareHandler() {}
|
||||
private ShareHandler() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Distribute Xp amongst party members.
|
||||
*
|
||||
* @param xp Xp without party sharing
|
||||
* @param mcMMOPlayer Player initiating the Xp gain
|
||||
* @param xp Xp without party sharing
|
||||
* @param mcMMOPlayer Player initiating the Xp gain
|
||||
* @param primarySkillType Skill being used
|
||||
* @return True is the xp has been shared
|
||||
*/
|
||||
@ -57,7 +58,7 @@ public final class ShareHandler {
|
||||
/**
|
||||
* Distribute Items amongst party members.
|
||||
*
|
||||
* @param drop Item that will get shared
|
||||
* @param drop Item that will get shared
|
||||
* @param mcMMOPlayer Player who picked up the item
|
||||
* @return True if the item has been shared
|
||||
*/
|
||||
@ -146,11 +147,9 @@ public final class ShareHandler {
|
||||
public static XPGainReason getSharedXpGainReason(XPGainReason xpGainReason) {
|
||||
if (xpGainReason == XPGainReason.PVE) {
|
||||
return XPGainReason.SHARED_PVE;
|
||||
}
|
||||
else if (xpGainReason == XPGainReason.PVP) {
|
||||
} else if (xpGainReason == XPGainReason.PVP) {
|
||||
return XPGainReason.SHARED_PVP;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return xpGainReason;
|
||||
}
|
||||
}
|
||||
|
@ -8,30 +8,35 @@ public interface Platform {
|
||||
|
||||
/**
|
||||
* Gets the name of the Platform
|
||||
*
|
||||
* @return name of this platform
|
||||
*/
|
||||
String getPlatformName();
|
||||
|
||||
/**
|
||||
* Gets the version of this platform
|
||||
*
|
||||
* @return the current version of this platform
|
||||
*/
|
||||
String getPlatformVersion();
|
||||
|
||||
/**
|
||||
* Gets the target version of Minecraft for this platform
|
||||
*
|
||||
* @return this platform's target minecraft version
|
||||
*/
|
||||
String getTargetMinecraftVersion();
|
||||
|
||||
/**
|
||||
* Whether or not this platform has been loaded
|
||||
*
|
||||
* @return true if the platform is loaded
|
||||
*/
|
||||
Boolean isPlatformLoaded();
|
||||
|
||||
/**
|
||||
* Gets the PlatformSoftwareType for this platform
|
||||
*
|
||||
* @return this PlatformSoftwareType
|
||||
*/
|
||||
PlatformSoftwareType getPlatformSoftwareType();
|
||||
|
@ -2,10 +2,11 @@ package com.gmail.nossr50.core.platform;
|
||||
|
||||
/**
|
||||
* Constants for targeted versions of MC
|
||||
*
|
||||
* @see Platform#getTargetMinecraftVersion()
|
||||
*/
|
||||
public class TargetMinecraftVersion {
|
||||
public static final String MC_VERSION_1_8_8 = "1_8_8";
|
||||
public static final String MC_VERSION_1_12_2 = "1_12_2";
|
||||
public static final String MC_VERSION_1_13_2 = "1_13_2";
|
||||
public static final String MC_VERSION_1_8_8 = "1_8_8";
|
||||
public static final String MC_VERSION_1_12_2 = "1_12_2";
|
||||
public static final String MC_VERSION_1_13_2 = "1_13_2";
|
||||
}
|
||||
|
@ -8,12 +8,14 @@ import com.gmail.nossr50.core.platform.Platform;
|
||||
public interface PlatformDriver {
|
||||
/**
|
||||
* Return the platform for this Driver
|
||||
*
|
||||
* @return this platform
|
||||
*/
|
||||
Platform getPlatform();
|
||||
|
||||
/**
|
||||
* Gets the target MC Version for this driver
|
||||
*
|
||||
* @return the target MC Version for this driver
|
||||
*/
|
||||
String getTargetMinecraftVersion();
|
||||
|
@ -36,8 +36,7 @@ public class PistonTrackerTask extends BukkitRunnable {
|
||||
if (nextBlock.hasMetadata(mcMMO.blockMetadataKey)) {
|
||||
mcMMO.getPlaceStore().setTrue(nextBlock);
|
||||
nextBlock.removeMetadata(mcMMO.blockMetadataKey, mcMMO.p);
|
||||
}
|
||||
else if (mcMMO.getPlaceStore().isTrue(nextBlock)) {
|
||||
} else if (mcMMO.getPlaceStore().isTrue(nextBlock)) {
|
||||
// Block doesn't have metadatakey but isTrue - set it to false
|
||||
mcMMO.getPlaceStore().setFalse(nextBlock);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.core.runnables;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.runnables.player.PlayerProfileSaveTask;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SaveTimerTask extends BukkitRunnable {
|
||||
|
@ -51,13 +51,11 @@ public class CleanBackupsTask extends BukkitRunnable {
|
||||
if (isPast24Hours(date) && Config.getInstance().getKeepLast24Hours()) {
|
||||
// Keep all files from the last 24 hours
|
||||
continue;
|
||||
}
|
||||
else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && Config.getInstance().getKeepDailyLastWeek()) {
|
||||
} else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && Config.getInstance().getKeepDailyLastWeek()) {
|
||||
// Keep daily backups of the past week
|
||||
savedDays.add(dayOfWeek);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
List<Integer> savedWeeks = savedYearsWeeks.get(year);
|
||||
if (savedWeeks == null) {
|
||||
savedWeeks = new ArrayList<Integer>();
|
||||
@ -92,7 +90,6 @@ public class CleanBackupsTask extends BukkitRunnable {
|
||||
* Check if date is within last 24 hours
|
||||
*
|
||||
* @param date date to check
|
||||
*
|
||||
* @return true is date is within last 24 hours, false if otherwise
|
||||
*/
|
||||
private boolean isPast24Hours(Date date) {
|
||||
@ -104,7 +101,6 @@ public class CleanBackupsTask extends BukkitRunnable {
|
||||
* Check if date is within the last week
|
||||
*
|
||||
* @param date date to check
|
||||
*
|
||||
* @return true is date is within the last week, false if otherwise
|
||||
*/
|
||||
private boolean isLastWeek(Date date) {
|
||||
@ -118,8 +114,7 @@ public class CleanBackupsTask extends BukkitRunnable {
|
||||
|
||||
try {
|
||||
date = dateFormat.parse(fileName);
|
||||
}
|
||||
catch (ParseException e) {
|
||||
} catch (ParseException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.gmail.nossr50.core.runnables.commands;
|
||||
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -63,8 +63,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
|
||||
public void displayBoard() {
|
||||
if (sender.getName().equalsIgnoreCase(playerName)) {
|
||||
ScoreboardManager.showPlayerRankScoreboard((Player) sender, skills);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ScoreboardManager.showPlayerRankScoreboardOthers((Player) sender, playerName, skills);
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package com.gmail.nossr50.core.runnables.commands;
|
||||
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.core.datatypes.database.PlayerStat;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -45,25 +45,22 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
||||
if (sender instanceof Player) {
|
||||
((Player) sender).removeMetadata(mcMMO.databaseCommandKey, mcMMO.p);
|
||||
}
|
||||
if(sender instanceof Player)
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
|
||||
}
|
||||
|
||||
private void displayChat() {
|
||||
|
||||
if (skill == null) {
|
||||
if(sender instanceof Player) {
|
||||
if (sender instanceof Player) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(sender instanceof Player) {
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName()));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName())));
|
||||
}
|
||||
}
|
||||
@ -74,13 +71,12 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
||||
// Format:
|
||||
// 01. Playername - skill value
|
||||
// 12. Playername - skill value
|
||||
if(sender instanceof Player) {
|
||||
if (sender instanceof Player) {
|
||||
sender.sendMessage(String.format("%2d. %s%s - %s%s", place, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(String.format("%2d. %s - %s", place, stat.name, stat.statVal));
|
||||
}
|
||||
|
||||
|
||||
place++;
|
||||
}
|
||||
}
|
||||
@ -88,8 +84,7 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
||||
private void displayBoard() {
|
||||
if (skill == null) {
|
||||
ScoreboardManager.showTopPowerScoreboard((Player) sender, page, userStats);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ScoreboardManager.showTopScoreboard((Player) sender, skill, page, userStats);
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package com.gmail.nossr50.core.runnables.database;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.data.database.DatabaseManager;
|
||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@ -42,8 +42,7 @@ public class FormulaConversionTask extends BukkitRunnable {
|
||||
editValues(profile);
|
||||
// Since this is a temporary profile, we save it here.
|
||||
profile.scheduleAsyncSave();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
editValues(profile);
|
||||
}
|
||||
|
@ -15,12 +15,11 @@ import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
||||
private mcMMO plugin;
|
||||
private static final int MAX_LOOKUP = Math.max(HiddenConfig.getInstance().getUUIDConvertAmount(), 100);
|
||||
private static final int RATE_LIMIT = HiddenConfig.getInstance().getMojangRateLimit();
|
||||
private static final long LIMIT_PERIOD = HiddenConfig.getInstance().getMojangLimitPeriod();
|
||||
private static final int BATCH_SIZE = MAX_LOOKUP * 3;
|
||||
|
||||
private mcMMO plugin;
|
||||
private List<String> userNames;
|
||||
private int size;
|
||||
private int checkedUsers;
|
||||
@ -57,16 +56,14 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
||||
if (size > MAX_LOOKUP) {
|
||||
userNamesSection = userNames.subList(size - MAX_LOOKUP, size);
|
||||
size -= MAX_LOOKUP;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
userNamesSection = userNames.subList(0, size);
|
||||
size = 0;
|
||||
}
|
||||
|
||||
try {
|
||||
fetchedUUIDs.putAll(new UUIDFetcher(userNamesSection).call());
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
// Handle 429
|
||||
if (e.getMessage().contains("429")) {
|
||||
size += userNamesSection.size();
|
||||
|
@ -8,6 +8,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public class UserPurgeTask extends BukkitRunnable {
|
||||
private ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
lock.lock();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.gmail.nossr50.core.runnables.player;
|
||||
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ClearRegisteredXPGainTask extends BukkitRunnable {
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.gmail.nossr50.core.runnables.player;
|
||||
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.runnables.commands.McScoreboardKeepTask;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -31,8 +31,7 @@ public class AlchemyBrewCheckTask extends BukkitRunnable {
|
||||
if (oldInventory[Alchemy.INGREDIENT_SLOT] == null || newInventory[Alchemy.INGREDIENT_SLOT] == null || !oldInventory[Alchemy.INGREDIENT_SLOT].isSimilar(newInventory[Alchemy.INGREDIENT_SLOT]) || !validBrew) {
|
||||
Alchemy.brewingStandMap.get(location).cancelBrew();
|
||||
}
|
||||
}
|
||||
else if (validBrew) {
|
||||
} else if (validBrew) {
|
||||
Alchemy.brewingStandMap.put(location, new AlchemyBrewTask(brewingStand, player));
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package com.gmail.nossr50.core.runnables.skills;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.core.skills.primary.alchemy.AlchemyPotionBrewer;
|
||||
import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerBrewEvent;
|
||||
import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerCatalysisEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.core.skills.primary.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.core.skills.primary.alchemy.AlchemyPotionBrewer;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -19,7 +19,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class AlchemyBrewTask extends BukkitRunnable {
|
||||
private static double DEFAULT_BREW_SPEED = 1.0;
|
||||
private static int DEFAULT_BREW_TICKS = 400;
|
||||
private static int DEFAULT_BREW_TICKS = 400;
|
||||
|
||||
private BlockState brewingStand;
|
||||
private Location location;
|
||||
@ -84,8 +84,7 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
||||
if (brewTimer < Math.max(brewSpeed, 2)) {
|
||||
this.cancel();
|
||||
finish();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
((BrewingStand) brewingStand).setBrewingTime((int) brewTimer);
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,10 @@ public class BleedContainer {
|
||||
public LivingEntity target;
|
||||
public LivingEntity damageSource;
|
||||
|
||||
public BleedContainer(LivingEntity target, int bleedTicks, int bleedRank, LivingEntity damageSource)
|
||||
{
|
||||
this.target = target;
|
||||
this.bleedTicks = bleedTicks;
|
||||
this.bleedRank = bleedRank;
|
||||
this.damageSource = damageSource;
|
||||
public BleedContainer(LivingEntity target, int bleedTicks, int bleedRank, LivingEntity damageSource) {
|
||||
this.target = target;
|
||||
this.bleedTicks = bleedTicks;
|
||||
this.bleedRank = bleedRank;
|
||||
this.damageSource = damageSource;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,46 @@ import java.util.Map.Entry;
|
||||
public class BleedTimerTask extends BukkitRunnable {
|
||||
private static Map<LivingEntity, BleedContainer> bleedList = new HashMap<LivingEntity, BleedContainer>();
|
||||
|
||||
public static BleedContainer copyContainer(BleedContainer container) {
|
||||
LivingEntity target = container.target;
|
||||
LivingEntity source = container.damageSource;
|
||||
int bleedTicks = container.bleedTicks;
|
||||
int bleedRank = container.bleedRank;
|
||||
|
||||
BleedContainer newContainer = new BleedContainer(target, bleedTicks, bleedRank, source);
|
||||
return newContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantly Bleed out a LivingEntity
|
||||
*
|
||||
* @param entity LivingEntity to bleed out
|
||||
*/
|
||||
public static void bleedOut(LivingEntity entity) {
|
||||
/*
|
||||
* Don't remove anything from the list outside of run()
|
||||
*/
|
||||
|
||||
if (bleedList.containsKey(entity)) {
|
||||
CombatUtils.dealNoInvulnerabilityTickDamage(entity, bleedList.get(entity).bleedTicks * 2, bleedList.get(entity).damageSource);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a LivingEntity to the bleedList if it is not in it.
|
||||
*
|
||||
* @param entity LivingEntity to add
|
||||
* @param ticks Number of bleeding ticks
|
||||
*/
|
||||
public static void add(LivingEntity entity, LivingEntity attacker, int ticks, int bleedRank) {
|
||||
BleedContainer newBleedContainer = new BleedContainer(entity, ticks, bleedRank, attacker);
|
||||
bleedList.put(entity, newBleedContainer);
|
||||
}
|
||||
|
||||
public static boolean isBleeding(LivingEntity entity) {
|
||||
return bleedList.containsKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Iterator<Entry<LivingEntity, BleedContainer>> bleedIterator = bleedList.entrySet().iterator();
|
||||
@ -75,45 +115,4 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
containerEntry.setValue(loweredBleedContainer);
|
||||
}
|
||||
}
|
||||
|
||||
public static BleedContainer copyContainer(BleedContainer container)
|
||||
{
|
||||
LivingEntity target = container.target;
|
||||
LivingEntity source = container.damageSource;
|
||||
int bleedTicks = container.bleedTicks;
|
||||
int bleedRank = container.bleedRank;
|
||||
|
||||
BleedContainer newContainer = new BleedContainer(target, bleedTicks, bleedRank, source);
|
||||
return newContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantly Bleed out a LivingEntity
|
||||
*
|
||||
* @param entity LivingEntity to bleed out
|
||||
*/
|
||||
public static void bleedOut(LivingEntity entity) {
|
||||
/*
|
||||
* Don't remove anything from the list outside of run()
|
||||
*/
|
||||
|
||||
if (bleedList.containsKey(entity)) {
|
||||
CombatUtils.dealNoInvulnerabilityTickDamage(entity, bleedList.get(entity).bleedTicks * 2, bleedList.get(entity).damageSource);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a LivingEntity to the bleedList if it is not in it.
|
||||
*
|
||||
* @param entity LivingEntity to add
|
||||
* @param ticks Number of bleeding ticks
|
||||
*/
|
||||
public static void add(LivingEntity entity, LivingEntity attacker, int ticks, int bleedRank) {
|
||||
BleedContainer newBleedContainer = new BleedContainer(entity, ticks, bleedRank, attacker);
|
||||
bleedList.put(entity, newBleedContainer);
|
||||
}
|
||||
|
||||
public static boolean isBleeding(LivingEntity entity) {
|
||||
return bleedList.containsKey(entity);
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,7 @@ public class ExperienceBarHideTask extends BukkitRunnable {
|
||||
public final PrimarySkillType primarySkillType;
|
||||
public final ExperienceBarManager experienceBarManagerRef;
|
||||
|
||||
public ExperienceBarHideTask(ExperienceBarManager experienceBarManagerRef, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType)
|
||||
{
|
||||
public ExperienceBarHideTask(ExperienceBarManager experienceBarManagerRef, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType) {
|
||||
this.experienceBarManagerRef = experienceBarManagerRef;
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
this.primarySkillType = primarySkillType;
|
||||
@ -30,7 +29,7 @@ public class ExperienceBarHideTask extends BukkitRunnable {
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
if(experienceBarManagerRef == null || mcMMOPlayer == null)
|
||||
if (experienceBarManagerRef == null || mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
experienceBarManagerRef.hideExperienceBar(primarySkillType);
|
||||
|
@ -10,18 +10,20 @@ public class SkillUnlockNotificationTask extends BukkitRunnable {
|
||||
private McMMOPlayer mcMMOPlayer;
|
||||
private SubSkillType subSkillType;
|
||||
private int rank;
|
||||
|
||||
/**
|
||||
* Notify a player about a newly unlocked subskill
|
||||
* @param mcMMOPlayer target player
|
||||
*
|
||||
* @param mcMMOPlayer target player
|
||||
* @param subSkillType the subskill that they just unlocked
|
||||
* @param rank the rank of the subskill
|
||||
* @param rank the rank of the subskill
|
||||
*/
|
||||
public SkillUnlockNotificationTask(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType, int rank)
|
||||
{
|
||||
public SkillUnlockNotificationTask(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType, int rank) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
this.subSkillType = subSkillType;
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* When an object implementing interface <code>Runnable</code> is used
|
||||
* to create a thread, starting the thread causes the object's
|
||||
|
@ -9,11 +9,9 @@ public enum ModConfigType {
|
||||
public static ModConfigType getModConfigType(String materialName) {
|
||||
if (materialName.contains("HELM") || (materialName.contains("CHEST") && !materialName.contains("CHESTNUT")) || materialName.contains("LEGS") || materialName.contains("LEGGINGS") || materialName.contains("BOOT")) {
|
||||
return ARMOR;
|
||||
}
|
||||
else if (materialName.contains("PICKAXE") || materialName.contains("AXE") || (materialName.contains("BOW") && !materialName.contains("BOWL")) || materialName.contains("HOE") || materialName.contains("SHOVEL") || materialName.contains("SWORD")) {
|
||||
} else if (materialName.contains("PICKAXE") || materialName.contains("AXE") || (materialName.contains("BOW") && !materialName.contains("BOWL")) || materialName.contains("HOE") || materialName.contains("SHOVEL") || materialName.contains("SWORD")) {
|
||||
return TOOLS;
|
||||
}
|
||||
else if (materialName.contains("LOG") || materialName.contains("LEAVES") || materialName.contains("FLOWER") || materialName.contains("PLANT") || materialName.contains("CROP") || materialName.contains("ORE") || materialName.contains("DIRT") || materialName.contains("SAND") || materialName.contains("GRASS")) {
|
||||
} else if (materialName.contains("LOG") || materialName.contains("LEAVES") || materialName.contains("FLOWER") || materialName.contains("PLANT") || materialName.contains("CROP") || materialName.contains("ORE") || materialName.contains("DIRT") || materialName.contains("SAND") || materialName.contains("GRASS")) {
|
||||
return BLOCKS;
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,6 @@ public enum PotionStage {
|
||||
this.numerical = numerical;
|
||||
}
|
||||
|
||||
public int toNumerical() {
|
||||
return numerical;
|
||||
}
|
||||
|
||||
private static PotionStage getPotionStageNumerical(int numerical) {
|
||||
for (PotionStage potionStage : values()) {
|
||||
if (numerical >= potionStage.toNumerical()) {
|
||||
@ -60,12 +56,12 @@ public enum PotionStage {
|
||||
}
|
||||
|
||||
// Check if potion has a glowstone dust amplifier
|
||||
// Else check if the potion has a custom effect with an amplifier added by mcMMO
|
||||
// Else check if the potion has a custom effect with an amplifier added by mcMMO
|
||||
if (data.isUpgraded()) {
|
||||
stage++;
|
||||
} else if(!effects.isEmpty()) {
|
||||
for (PotionEffect effect : effects){
|
||||
if(effect.getAmplifier() > 0){
|
||||
} else if (!effects.isEmpty()) {
|
||||
for (PotionEffect effect : effects) {
|
||||
if (effect.getAmplifier() > 0) {
|
||||
stage++;
|
||||
break;
|
||||
}
|
||||
@ -84,4 +80,8 @@ public enum PotionStage {
|
||||
|
||||
return PotionStage.getPotionStageNumerical(stage);
|
||||
}
|
||||
|
||||
public int toNumerical() {
|
||||
return numerical;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
package com.gmail.nossr50.core.skills;
|
||||
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.config.skills.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
|
||||
import com.gmail.nossr50.skills.archery.ArcheryManager;
|
||||
@ -51,18 +50,10 @@ public enum PrimarySkillType {
|
||||
UNARMED(UnarmedManager.class, Color.BLACK, SuperAbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SubSkillType.UNARMED_BERSERK, SubSkillType.UNARMED_BLOCK_CRACKER, SubSkillType.UNARMED_ARROW_DEFLECT, SubSkillType.UNARMED_DISARM, SubSkillType.UNARMED_IRON_ARM_STYLE, SubSkillType.UNARMED_IRON_GRIP)),
|
||||
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, SuperAbilityType.TREE_FELLER, ToolType.AXE, ImmutableList.of(SubSkillType.WOODCUTTING_LEAF_BLOWER, SubSkillType.WOODCUTTING_TREE_FELLER, SubSkillType.WOODCUTTING_HARVEST_LUMBER));
|
||||
|
||||
private Class<? extends SkillManager> managerClass;
|
||||
private Color runescapeColor;
|
||||
private SuperAbilityType ability;
|
||||
private ToolType tool;
|
||||
private List<SubSkillType> subSkillTypes;
|
||||
|
||||
public static final List<String> SKILL_NAMES;
|
||||
public static final List<String> SUBSKILL_NAMES;
|
||||
|
||||
public static final List<PrimarySkillType> CHILD_SKILLS;
|
||||
public static final List<PrimarySkillType> NON_CHILD_SKILLS;
|
||||
|
||||
public static final List<PrimarySkillType> COMBAT_SKILLS = ImmutableList.of(ARCHERY, AXES, SWORDS, TAMING, UNARMED);
|
||||
public static final List<PrimarySkillType> GATHERING_SKILLS = ImmutableList.of(EXCAVATION, FISHING, HERBALISM, MINING, WOODCUTTING);
|
||||
public static final List<PrimarySkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
|
||||
@ -76,13 +67,11 @@ public enum PrimarySkillType {
|
||||
for (PrimarySkillType skill : values()) {
|
||||
if (skill.isChildSkill()) {
|
||||
childSkills.add(skill);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
nonChildSkills.add(skill);
|
||||
}
|
||||
|
||||
for(SubSkillType subSkillType : skill.subSkillTypes)
|
||||
{
|
||||
for (SubSkillType subSkillType : skill.subSkillTypes) {
|
||||
subSkillNames.add(subSkillType.getNiceNameNoSpaces(subSkillType));
|
||||
}
|
||||
names.add(skill.getName());
|
||||
@ -96,6 +85,12 @@ public enum PrimarySkillType {
|
||||
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
|
||||
}
|
||||
|
||||
private Class<? extends SkillManager> managerClass;
|
||||
private Color runescapeColor;
|
||||
private SuperAbilityType ability;
|
||||
private ToolType tool;
|
||||
private List<SubSkillType> subSkillTypes;
|
||||
|
||||
private PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkillType> subSkillTypes) {
|
||||
this(managerClass, runescapeColor, null, null, subSkillTypes);
|
||||
}
|
||||
@ -108,6 +103,47 @@ public enum PrimarySkillType {
|
||||
this.subSkillTypes = subSkillTypes;
|
||||
}
|
||||
|
||||
public static PrimarySkillType getSkill(String skillName) {
|
||||
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
||||
for (PrimarySkillType type : values()) {
|
||||
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (PrimarySkillType type : values()) {
|
||||
if (type.name().equalsIgnoreCase(skillName)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
if (!skillName.equalsIgnoreCase("all")) {
|
||||
mcMMO.p.getLogger().warning("Invalid mcMMO skill (" + skillName + ")"); //TODO: Localize
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PrimarySkillType bySecondaryAbility(SubSkillType subSkillType) {
|
||||
for (PrimarySkillType type : values()) {
|
||||
if (type.getSkillAbilities().contains(subSkillType)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PrimarySkillType byAbility(SuperAbilityType ability) {
|
||||
for (PrimarySkillType type : values()) {
|
||||
if (type.getAbility() == ability) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Class<? extends SkillManager> getManagerClass() {
|
||||
return managerClass;
|
||||
}
|
||||
@ -125,7 +161,9 @@ public enum PrimarySkillType {
|
||||
return Config.getInstance().getLevelCap(this);
|
||||
}
|
||||
|
||||
public boolean isSuperAbilityUnlocked(Player player) { return RankUtils.getRank(player, getAbility().getSubSkillTypeDefinition()) >= 1; }
|
||||
public boolean isSuperAbilityUnlocked(Player player) {
|
||||
return RankUtils.getRank(player, getAbility().getSubSkillTypeDefinition()) >= 1;
|
||||
}
|
||||
|
||||
public boolean getPVPEnabled() {
|
||||
return Config.getInstance().getPVPEnabled(this);
|
||||
@ -167,28 +205,6 @@ public enum PrimarySkillType {
|
||||
return ExperienceConfig.getInstance().getFormulaSkillModifier(this);
|
||||
}
|
||||
|
||||
public static PrimarySkillType getSkill(String skillName) {
|
||||
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
||||
for (PrimarySkillType type : values()) {
|
||||
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (PrimarySkillType type : values()) {
|
||||
if (type.name().equalsIgnoreCase(skillName)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
if (!skillName.equalsIgnoreCase("all")) {
|
||||
mcMMO.p.getLogger().warning("Invalid mcMMO skill (" + skillName + ")"); //TODO: Localize
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO: This is a little "hacky", we probably need to add something to distinguish child skills in the enum, or to use another enum for them
|
||||
public boolean isChildSkill() {
|
||||
switch (this) {
|
||||
@ -201,25 +217,6 @@ public enum PrimarySkillType {
|
||||
}
|
||||
}
|
||||
|
||||
public static PrimarySkillType bySecondaryAbility(SubSkillType subSkillType) {
|
||||
for (PrimarySkillType type : values()) {
|
||||
if (type.getSkillAbilities().contains(subSkillType)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PrimarySkillType byAbility(SuperAbilityType ability) {
|
||||
for (PrimarySkillType type : values()) {
|
||||
if (type.getAbility() == ability) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? StringUtils.getCapitalized(this.toString()) : StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(this.toString()) + ".SkillName"));
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ public abstract class SkillManager {
|
||||
|
||||
/**
|
||||
* Applies XP to a player, provides SELF as an XpGainSource source
|
||||
* @param xp amount of XP to apply
|
||||
*
|
||||
* @param xp amount of XP to apply
|
||||
* @param xpGainReason the reason for the XP gain
|
||||
* @deprecated use applyXpGain(float, XPGainReason, XPGainSource)
|
||||
*/
|
||||
@ -37,7 +38,8 @@ public abstract class SkillManager {
|
||||
|
||||
/**
|
||||
* Applies XP to a player
|
||||
* @param xp amount of XP to apply
|
||||
*
|
||||
* @param xp amount of XP to apply
|
||||
* @param xpGainReason the reason for the XP gain
|
||||
* @param xpGainSource the source of the XP
|
||||
*/
|
||||
|
@ -6,14 +6,14 @@ public class SubSkillFlags {
|
||||
* These are so I can flag properties for subskills
|
||||
* Flags are in the power of 2 because binary is a base-2 system
|
||||
*/
|
||||
public static final int ACTIVE = 1; //Active subskills are ones that aren't passive
|
||||
public static final int SUPERABILITY = 2; // Super abilities are redundantly active
|
||||
public static final int RNG = 4; //If the subskill makes use of RNG
|
||||
public static final int PVP = 8; //If the subskill has properties that change in PVP conditions
|
||||
public static final int TIMED = 16; //If the subskill has a duration or time component
|
||||
public static final int TARGET_COLLECTION = 32; //If the subskill has multiple target types
|
||||
public static final int REWARD_COLLECTION = 64; //If the subskill has multiple reward types
|
||||
public static final int CHARGES = 128;
|
||||
public static final int LIMITED = 256;
|
||||
public static final int ACTIVE = 1; //Active subskills are ones that aren't passive
|
||||
public static final int SUPERABILITY = 2; // Super abilities are redundantly active
|
||||
public static final int RNG = 4; //If the subskill makes use of RNG
|
||||
public static final int PVP = 8; //If the subskill has properties that change in PVP conditions
|
||||
public static final int TIMED = 16; //If the subskill has a duration or time component
|
||||
public static final int TARGET_COLLECTION = 32; //If the subskill has multiple target types
|
||||
public static final int REWARD_COLLECTION = 64; //If the subskill has multiple reward types
|
||||
public static final int CHARGES = 128;
|
||||
public static final int LIMITED = 256;
|
||||
//public static final int RANDOM_ACTIVATION = 128; //If the subskill has random activation
|
||||
}
|
||||
|
@ -94,11 +94,11 @@ public enum SubSkillType {
|
||||
UNARMED_IRON_GRIP(1),
|
||||
|
||||
/* Woodcutting */
|
||||
/* WOODCUTTING_BARK_SURGEON(3),*/
|
||||
/* WOODCUTTING_BARK_SURGEON(3),*/
|
||||
WOODCUTTING_HARVEST_LUMBER(1),
|
||||
WOODCUTTING_LEAF_BLOWER(1),
|
||||
/* WOODCUTTING_NATURES_BOUNTY(3),
|
||||
WOODCUTTING_SPLINTER(3),*/
|
||||
/* WOODCUTTING_NATURES_BOUNTY(3),
|
||||
WOODCUTTING_SPLINTER(3),*/
|
||||
WOODCUTTING_TREE_FELLER(1);
|
||||
|
||||
private final int numRanks;
|
||||
@ -106,32 +106,34 @@ public enum SubSkillType {
|
||||
|
||||
/**
|
||||
* If our SubSkillType has more than 1 rank define it
|
||||
*
|
||||
* @param numRanks The number of ranks our SubSkillType has
|
||||
*/
|
||||
SubSkillType(int numRanks)
|
||||
{
|
||||
SubSkillType(int numRanks) {
|
||||
this.numRanks = numRanks;
|
||||
}
|
||||
|
||||
SubSkillType()
|
||||
{
|
||||
SubSkillType() {
|
||||
this.numRanks = 0;
|
||||
}
|
||||
|
||||
public int getNumRanks()
|
||||
{
|
||||
public int getNumRanks() {
|
||||
return numRanks;
|
||||
}
|
||||
|
||||
/**
|
||||
* !!! This relies on the immutable lists in PrimarySkillType being populated !!!
|
||||
* If we add skills, those immutable lists need to be updated
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public PrimarySkillType getParentSkill() { return PrimarySkillType.bySecondaryAbility(this); }
|
||||
public PrimarySkillType getParentSkill() {
|
||||
return PrimarySkillType.bySecondaryAbility(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the root address for this skill in the advanced.yml file
|
||||
*
|
||||
* @return the root address for this skill in advanced.yml
|
||||
*/
|
||||
public String getAdvConfigAddress() {
|
||||
@ -140,6 +142,7 @@ public enum SubSkillType {
|
||||
|
||||
/**
|
||||
* Returns the root address for this skill in the rankskills.yml file
|
||||
*
|
||||
* @return the root address for this skill in rankskills.yml
|
||||
*/
|
||||
public String getRankConfigAddress() {
|
||||
@ -148,16 +151,17 @@ public enum SubSkillType {
|
||||
|
||||
/**
|
||||
* Get the string representation of the permission node for this subskill
|
||||
*
|
||||
* @return the permission node for this subskill
|
||||
*/
|
||||
public String getPermissionNodeAddress()
|
||||
{
|
||||
public String getPermissionNodeAddress() {
|
||||
//TODO: This could be optimized
|
||||
return "mcmmo.ability." + getParentSkill().toString().toLowerCase() + "." + getConfigName(toString()).toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the skill as it is used in advanced.yml and other config files
|
||||
*
|
||||
* @return the yaml identifier for this skill
|
||||
*/
|
||||
private String getConfigName(String subSkillName) {
|
||||
@ -181,12 +185,10 @@ public enum SubSkillType {
|
||||
* Split the string up so we can capitalize each part
|
||||
*/
|
||||
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
||||
if(subskillNameWithoutPrefix.contains("_"))
|
||||
{
|
||||
if (subskillNameWithoutPrefix.contains("_")) {
|
||||
String splitStrings[] = subskillNameWithoutPrefix.split("_");
|
||||
|
||||
for(String string : splitStrings)
|
||||
{
|
||||
for (String string : splitStrings) {
|
||||
endResult += StringUtils.getCapitalized(string);
|
||||
}
|
||||
} else {
|
||||
@ -207,14 +209,12 @@ public enum SubSkillType {
|
||||
* Split the string up so we can capitalize each part
|
||||
*/
|
||||
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
||||
if(subskillNameWithoutPrefix.contains("_"))
|
||||
{
|
||||
if (subskillNameWithoutPrefix.contains("_")) {
|
||||
String splitStrings[] = subskillNameWithoutPrefix.split("_");
|
||||
|
||||
for(int i = 0; i < splitStrings.length; i++)
|
||||
{
|
||||
if(i+1 >= splitStrings.length)
|
||||
endResult+=StringUtils.getCapitalized(splitStrings[i]);
|
||||
for (int i = 0; i < splitStrings.length; i++) {
|
||||
if (i + 1 >= splitStrings.length)
|
||||
endResult += StringUtils.getCapitalized(splitStrings[i]);
|
||||
else {
|
||||
endResult += StringUtils.getCapitalized(splitStrings[i]);
|
||||
endResult += "_";
|
||||
@ -229,25 +229,26 @@ public enum SubSkillType {
|
||||
|
||||
/**
|
||||
* Returns the name of the parent skill from the Locale file
|
||||
*
|
||||
* @return The parent skill as defined in the locale
|
||||
*/
|
||||
public String getParentNiceNameLocale()
|
||||
{
|
||||
return LocaleLoader.getString(StringUtils.getCapitalized(getParentSkill().toString())+".SkillName");
|
||||
public String getParentNiceNameLocale() {
|
||||
return LocaleLoader.getString(StringUtils.getCapitalized(getParentSkill().toString()) + ".SkillName");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the "nice" name of the subskill without spaces
|
||||
*
|
||||
* @param subSkillType target subskill
|
||||
* @return the "nice" name without spaces
|
||||
*/
|
||||
public String getNiceNameNoSpaces(SubSkillType subSkillType)
|
||||
{
|
||||
public String getNiceNameNoSpaces(SubSkillType subSkillType) {
|
||||
return getConfigName(subSkillType.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* This finds the substring index for our SubSkillType's name after its parent name prefix
|
||||
*
|
||||
* @param subSkillName The name to process
|
||||
* @return The value of the substring index after our parent's prefix
|
||||
*/
|
||||
@ -266,35 +267,40 @@ public enum SubSkillType {
|
||||
return subStringIndex;
|
||||
}
|
||||
|
||||
public String getLocaleKeyRoot()
|
||||
{
|
||||
return StringUtils.getCapitalized(getParentSkill().toString())+".SubSkill."+getConfigName(toString());
|
||||
public String getLocaleKeyRoot() {
|
||||
return StringUtils.getCapitalized(getParentSkill().toString()) + ".SubSkill." + getConfigName(toString());
|
||||
}
|
||||
|
||||
public String getLocaleName()
|
||||
{
|
||||
public String getLocaleName() {
|
||||
return getFromLocaleSubAddress(".Name");
|
||||
}
|
||||
|
||||
public String getLocaleDescription()
|
||||
{
|
||||
public String getLocaleDescription() {
|
||||
return getFromLocaleSubAddress(".Description");
|
||||
}
|
||||
|
||||
public String getLocaleStatDescription() { return getFromLocaleSubAddress(".Stat"); }
|
||||
public String getLocaleKeyStatDescription() { return getLocaleKeyFromSubAddress(".Stat"); }
|
||||
public String getLocaleStatDescription() {
|
||||
return getFromLocaleSubAddress(".Stat");
|
||||
}
|
||||
|
||||
public String getLocaleStatExtraDescription() { return getFromLocaleSubAddress(".Stat.Extra"); }
|
||||
public String getLocaleKeyStatExtraDescription() { return getLocaleKeyFromSubAddress(".Stat.Extra"); }
|
||||
public String getLocaleKeyStatDescription() {
|
||||
return getLocaleKeyFromSubAddress(".Stat");
|
||||
}
|
||||
|
||||
public String getLocaleStat(String... vars)
|
||||
{
|
||||
public String getLocaleStatExtraDescription() {
|
||||
return getFromLocaleSubAddress(".Stat.Extra");
|
||||
}
|
||||
|
||||
public String getLocaleKeyStatExtraDescription() {
|
||||
return getLocaleKeyFromSubAddress(".Stat.Extra");
|
||||
}
|
||||
|
||||
public String getLocaleStat(String... vars) {
|
||||
String statMsg = LocaleLoader.getString("Ability.Generic.Template", (Object[]) vars);
|
||||
return statMsg;
|
||||
}
|
||||
|
||||
public String getCustomLocaleStat(String... vars)
|
||||
{
|
||||
public String getCustomLocaleStat(String... vars) {
|
||||
String statMsg = LocaleLoader.getString("Ability.Generic.Template.Custom", (Object[]) vars);
|
||||
return statMsg;
|
||||
}
|
||||
@ -303,8 +309,7 @@ public enum SubSkillType {
|
||||
return LocaleLoader.getString(getLocaleKeyRoot() + s);
|
||||
}
|
||||
|
||||
private String getLocaleKeyFromSubAddress(String s)
|
||||
{
|
||||
private String getLocaleKeyFromSubAddress(String s) {
|
||||
return getLocaleKeyRoot() + s;
|
||||
}
|
||||
}
|
||||
|
@ -74,14 +74,14 @@ public enum SuperAbilityType {
|
||||
* This is a bit of a band-aid fix until the new skill system is in place
|
||||
*/
|
||||
static {
|
||||
BERSERK.subSkillTypeDefinition = SubSkillType.UNARMED_BERSERK;
|
||||
SUPER_BREAKER.subSkillTypeDefinition = SubSkillType.MINING_SUPER_BREAKER;
|
||||
GIGA_DRILL_BREAKER.subSkillTypeDefinition = SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER;
|
||||
GREEN_TERRA.subSkillTypeDefinition = SubSkillType.HERBALISM_GREEN_TERRA;
|
||||
SKULL_SPLITTER.subSkillTypeDefinition = SubSkillType.AXES_SKULL_SPLITTER;
|
||||
TREE_FELLER.subSkillTypeDefinition = SubSkillType.WOODCUTTING_TREE_FELLER;
|
||||
SERRATED_STRIKES.subSkillTypeDefinition = SubSkillType.SWORDS_SERRATED_STRIKES;
|
||||
BLAST_MINING.subSkillTypeDefinition = SubSkillType.MINING_BLAST_MINING;
|
||||
BERSERK.subSkillTypeDefinition = SubSkillType.UNARMED_BERSERK;
|
||||
SUPER_BREAKER.subSkillTypeDefinition = SubSkillType.MINING_SUPER_BREAKER;
|
||||
GIGA_DRILL_BREAKER.subSkillTypeDefinition = SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER;
|
||||
GREEN_TERRA.subSkillTypeDefinition = SubSkillType.HERBALISM_GREEN_TERRA;
|
||||
SKULL_SPLITTER.subSkillTypeDefinition = SubSkillType.AXES_SKULL_SPLITTER;
|
||||
TREE_FELLER.subSkillTypeDefinition = SubSkillType.WOODCUTTING_TREE_FELLER;
|
||||
SERRATED_STRIKES.subSkillTypeDefinition = SubSkillType.SWORDS_SERRATED_STRIKES;
|
||||
BLAST_MINING.subSkillTypeDefinition = SubSkillType.MINING_BLAST_MINING;
|
||||
}
|
||||
|
||||
private String abilityOn;
|
||||
@ -219,6 +219,7 @@ public enum SuperAbilityType {
|
||||
|
||||
/**
|
||||
* Grabs the associated SubSkillType definition for this SuperAbilityType
|
||||
*
|
||||
* @return the matching SubSkillType definition for this SuperAbilityType
|
||||
*/
|
||||
public SubSkillType getSubSkillTypeDefinition() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user