Temporarily comment out the API since we're about to break everything

This commit is contained in:
nossr50 2019-06-27 00:01:58 -07:00
parent 6504e06b5f
commit 5ee862effd
13 changed files with 1850 additions and 1850 deletions

View File

@ -1,89 +1,89 @@
package com.gmail.nossr50.api; //package com.gmail.nossr50.api;
//
import com.gmail.nossr50.datatypes.player.McMMOPlayer; //import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; //import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.runnables.skills.BleedTimerTask; //import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.util.player.UserManager; //import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.LivingEntity; //import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; //import org.bukkit.entity.Player;
//
public final class AbilityAPI { //public final class AbilityAPI {
private AbilityAPI() { // private AbilityAPI() {
} // }
//
public static boolean berserkEnabled(Player player) { // public static boolean berserkEnabled(Player player) {
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.BERSERK); // return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.BERSERK);
} // }
//
public static boolean gigaDrillBreakerEnabled(Player player) { // public static boolean gigaDrillBreakerEnabled(Player player) {
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER); // return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER);
} // }
//
public static boolean greenTerraEnabled(Player player) { // public static boolean greenTerraEnabled(Player player) {
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GREEN_TERRA); // return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GREEN_TERRA);
} // }
//
public static boolean serratedStrikesEnabled(Player player) { // public static boolean serratedStrikesEnabled(Player player) {
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SERRATED_STRIKES); // return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SERRATED_STRIKES);
} // }
//
public static boolean skullSplitterEnabled(Player player) { // public static boolean skullSplitterEnabled(Player player) {
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SKULL_SPLITTER); // return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SKULL_SPLITTER);
} // }
//
public static boolean superBreakerEnabled(Player player) { // public static boolean superBreakerEnabled(Player player) {
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SUPER_BREAKER); // return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SUPER_BREAKER);
} // }
//
public static boolean treeFellerEnabled(Player player) { // public static boolean treeFellerEnabled(Player player) {
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.TREE_FELLER); // return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.TREE_FELLER);
} // }
//
public static boolean isAnyAbilityEnabled(Player player) { // public static boolean isAnyAbilityEnabled(Player player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); // McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//
for (SuperAbilityType ability : SuperAbilityType.values()) { // for (SuperAbilityType ability : SuperAbilityType.values()) {
if (mcMMOPlayer.getAbilityMode(ability)) { // if (mcMMOPlayer.getAbilityMode(ability)) {
return true; // return true;
} // }
} // }
//
return false; // return false;
} // }
//
public static void resetCooldowns(Player player) { // public static void resetCooldowns(Player player) {
UserManager.getPlayer(player).resetCooldowns(); // UserManager.getPlayer(player).resetCooldowns();
} // }
//
public static void setBerserkCooldown(Player player, long cooldown) { // public static void setBerserkCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.BERSERK, cooldown); // UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.BERSERK, cooldown);
} // }
//
public static void setGigaDrillBreakerCooldown(Player player, long cooldown) { // public static void setGigaDrillBreakerCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER, cooldown); // UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER, cooldown);
} // }
//
public static void setGreenTerraCooldown(Player player, long cooldown) { // public static void setGreenTerraCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GREEN_TERRA, cooldown); // UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GREEN_TERRA, cooldown);
} // }
//
public static void setSerratedStrikesCooldown(Player player, long cooldown) { // public static void setSerratedStrikesCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SERRATED_STRIKES, cooldown); // UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SERRATED_STRIKES, cooldown);
} // }
//
public static void setSkullSplitterCooldown(Player player, long cooldown) { // public static void setSkullSplitterCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SKULL_SPLITTER, cooldown); // UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SKULL_SPLITTER, cooldown);
} // }
//
public static void setSuperBreakerCooldown(Player player, long cooldown) { // public static void setSuperBreakerCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SUPER_BREAKER, cooldown); // UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SUPER_BREAKER, cooldown);
} // }
//
public static void setTreeFellerCooldown(Player player, long cooldown) { // public static void setTreeFellerCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.TREE_FELLER, cooldown); // UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.TREE_FELLER, cooldown);
} // }
//
public static boolean isBleeding(LivingEntity entity) { // public static boolean isBleeding(LivingEntity entity) {
return BleedTimerTask.isBleeding(entity); // return BleedTimerTask.isBleeding(entity);
} // }
} //}

View File

@ -1,154 +1,154 @@
package com.gmail.nossr50.api; //package com.gmail.nossr50.api;
//
import com.gmail.nossr50.chat.ChatManager; //import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatManagerFactory; //import com.gmail.nossr50.chat.ChatManagerFactory;
import com.gmail.nossr50.chat.PartyChatManager; //import com.gmail.nossr50.chat.PartyChatManager;
import com.gmail.nossr50.datatypes.chat.ChatMode; //import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.party.PartyManager; //import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; //import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.Player; //import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; //import org.bukkit.plugin.Plugin;
//
public final class ChatAPI { //public final class ChatAPI {
private ChatAPI() { // private ChatAPI() {
} // }
//
/** // /**
* Send a message to all members of a party // * Send a message to all members of a party
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param plugin The plugin sending the message // * @param plugin The plugin sending the message
* @param sender The name of the sender // * @param sender The name of the sender
* @param displayName The display name of the sender // * @param displayName The display name of the sender
* @param party The name of the party to send to // * @param party The name of the party to send to
* @param message The message to send // * @param message The message to send
*/ // */
public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) { // public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
getPartyChatManager(plugin, party).handleChat(sender, displayName, message); // getPartyChatManager(plugin, party).handleChat(sender, displayName, message);
} // }
//
/** // /**
* Send a message to all members of a party // * Send a message to all members of a party
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param plugin The plugin sending the message // * @param plugin The plugin sending the message
* @param sender The name of the sender to display in the chat // * @param sender The name of the sender to display in the chat
* @param party The name of the party to send to // * @param party The name of the party to send to
* @param message The message to send // * @param message The message to send
*/ // */
public static void sendPartyChat(Plugin plugin, String sender, String party, String message) { // public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
getPartyChatManager(plugin, party).handleChat(sender, message); // getPartyChatManager(plugin, party).handleChat(sender, message);
} // }
//
/** // /**
* Send a message to administrators // * Send a message to administrators
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param plugin The plugin sending the message // * @param plugin The plugin sending the message
* @param sender The name of the sender // * @param sender The name of the sender
* @param displayName The display name of the sender // * @param displayName The display name of the sender
* @param message The message to send // * @param message The message to send
*/ // */
public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) { // public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, displayName, message); // ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, displayName, message);
} // }
//
/** // /**
* Send a message to administrators // * Send a message to administrators
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param plugin The plugin sending the message // * @param plugin The plugin sending the message
* @param sender The name of the sender to display in the chat // * @param sender The name of the sender to display in the chat
* @param message The message to send // * @param message The message to send
*/ // */
public static void sendAdminChat(Plugin plugin, String sender, String message) { // public static void sendAdminChat(Plugin plugin, String sender, String message) {
ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, message); // ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, message);
} // }
//
/** // /**
* Check if a player is currently talking in party chat. // * Check if a player is currently talking in party chat.
* // *
* @param player The player to check // * @param player The player to check
* @return true if the player is using party chat, false otherwise // * @return true if the player is using party chat, false otherwise
*/ // */
public static boolean isUsingPartyChat(Player player) { // public static boolean isUsingPartyChat(Player player) {
return UserManager.getPlayer(player).isChatEnabled(ChatMode.PARTY); // return UserManager.getPlayer(player).isChatEnabled(ChatMode.PARTY);
} // }
//
/** // /**
* Check if a player is currently talking in party chat. // * Check if a player is currently talking in party chat.
* // *
* @param playerName The name of the player to check // * @param playerName The name of the player to check
* @return true if the player is using party chat, false otherwise // * @return true if the player is using party chat, false otherwise
*/ // */
public static boolean isUsingPartyChat(String playerName) { // public static boolean isUsingPartyChat(String playerName) {
return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.PARTY); // return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.PARTY);
} // }
//
/** // /**
* Check if a player is currently talking in admin chat. // * Check if a player is currently talking in admin chat.
* // *
* @param player The player to check // * @param player The player to check
* @return true if the player is using admin chat, false otherwise // * @return true if the player is using admin chat, false otherwise
*/ // */
public static boolean isUsingAdminChat(Player player) { // public static boolean isUsingAdminChat(Player player) {
return UserManager.getPlayer(player).isChatEnabled(ChatMode.ADMIN); // return UserManager.getPlayer(player).isChatEnabled(ChatMode.ADMIN);
} // }
//
/** // /**
* Check if a player is currently talking in admin chat. // * Check if a player is currently talking in admin chat.
* // *
* @param playerName The name of the player to check // * @param playerName The name of the player to check
* @return true if the player is using admin chat, false otherwise // * @return true if the player is using admin chat, false otherwise
*/ // */
public static boolean isUsingAdminChat(String playerName) { // public static boolean isUsingAdminChat(String playerName) {
return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.ADMIN); // return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.ADMIN);
} // }
//
/** // /**
* Toggle the party chat mode of a player. // * Toggle the party chat mode of a player.
* // *
* @param player The player to toggle party chat on. // * @param player The player to toggle party chat on.
*/ // */
public static void togglePartyChat(Player player) { // public static void togglePartyChat(Player player) {
UserManager.getPlayer(player).toggleChat(ChatMode.PARTY); // UserManager.getPlayer(player).toggleChat(ChatMode.PARTY);
} // }
//
/** // /**
* Toggle the party chat mode of a player. // * Toggle the party chat mode of a player.
* // *
* @param playerName The name of the player to toggle party chat on. // * @param playerName The name of the player to toggle party chat on.
*/ // */
public static void togglePartyChat(String playerName) { // public static void togglePartyChat(String playerName) {
UserManager.getPlayer(playerName).toggleChat(ChatMode.PARTY); // UserManager.getPlayer(playerName).toggleChat(ChatMode.PARTY);
} // }
//
/** // /**
* Toggle the admin chat mode of a player. // * Toggle the admin chat mode of a player.
* // *
* @param player The player to toggle admin chat on. // * @param player The player to toggle admin chat on.
*/ // */
public static void toggleAdminChat(Player player) { // public static void toggleAdminChat(Player player) {
UserManager.getPlayer(player).toggleChat(ChatMode.ADMIN); // UserManager.getPlayer(player).toggleChat(ChatMode.ADMIN);
} // }
//
/** // /**
* Toggle the admin chat mode of a player. // * Toggle the admin chat mode of a player.
* // *
* @param playerName The name of the player to toggle party chat on. // * @param playerName The name of the player to toggle party chat on.
*/ // */
public static void toggleAdminChat(String playerName) { // public static void toggleAdminChat(String playerName) {
UserManager.getPlayer(playerName).toggleChat(ChatMode.ADMIN); // UserManager.getPlayer(playerName).toggleChat(ChatMode.ADMIN);
} // }
//
private static ChatManager getPartyChatManager(Plugin plugin, String party) { // private static ChatManager getPartyChatManager(Plugin plugin, String party) {
ChatManager chatManager = ChatManagerFactory.getChatManager(plugin, ChatMode.PARTY); // ChatManager chatManager = ChatManagerFactory.getChatManager(plugin, ChatMode.PARTY);
((PartyChatManager) chatManager).setParty(PartyManager.getParty(party)); // ((PartyChatManager) chatManager).setParty(PartyManager.getParty(party));
//
return chatManager; // return chatManager;
} // }
} //}

View File

@ -1,33 +1,33 @@
package com.gmail.nossr50.api; //package com.gmail.nossr50.api;
//
import com.gmail.nossr50.datatypes.player.PlayerProfile; //import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.mcMMO; //import com.gmail.nossr50.mcMMO;
//
import java.util.UUID; //import java.util.UUID;
//
public class DatabaseAPI { //public class DatabaseAPI {
//
/** // /**
* Checks if a player exists in the mcMMO Database // * Checks if a player exists in the mcMMO Database
* @param uuid player UUID // * @param uuid player UUID
* @return true if the player exists in the DB, false if they do not // * @return true if the player exists in the DB, false if they do not
*/ // */
public boolean doesPlayerExistInDB(String uuid) { // public boolean doesPlayerExistInDB(String uuid) {
return doesPlayerExistInDB(UUID.fromString(uuid)); // return doesPlayerExistInDB(UUID.fromString(uuid));
} // }
//
/** // /**
* Checks if a player exists in the mcMMO Database // * Checks if a player exists in the mcMMO Database
* @param uuid player UUID // * @param uuid player UUID
* @return true if the player exists in the DB, false if they do not // * @return true if the player exists in the DB, false if they do not
*/ // */
public boolean doesPlayerExistInDB(UUID uuid) { // public boolean doesPlayerExistInDB(UUID uuid) {
PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid); // PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);
//
if(playerProfile.isLoaded()) // if(playerProfile.isLoaded())
return true; // return true;
else // else
return false; // return false;
} // }
//
} //}

File diff suppressed because it is too large Load Diff

View File

@ -1,265 +1,265 @@
package com.gmail.nossr50.api; //package com.gmail.nossr50.api;
//
import com.gmail.nossr50.datatypes.interactions.NotificationType; //import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.party.Party; //import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyLeader; //import com.gmail.nossr50.datatypes.party.PartyLeader;
import com.gmail.nossr50.mcMMO; //import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager; //import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; //import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.OfflinePlayer; //import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; //import org.bukkit.entity.Player;
//
import java.util.*; //import java.util.*;
//
public final class PartyAPI { //public final class PartyAPI {
private PartyAPI() { // private PartyAPI() {
} // }
//
/** // /**
* Get the name of the party a player is in. // * Get the name of the party a player is in.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param player The player to check the party name of // * @param player The player to check the party name of
* @return the name of the player's party, or null if not in a party // * @return the name of the player's party, or null if not in a party
*/ // */
public static String getPartyName(Player player) { // public static String getPartyName(Player player) {
if (!inParty(player)) { // if (!inParty(player)) {
return null; // return null;
} // }
//
return UserManager.getPlayer(player).getParty().getName(); // return UserManager.getPlayer(player).getParty().getName();
} // }
//
/** // /**
* Checks if a player is in a party. // * Checks if a player is in a party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param player The player to check // * @param player The player to check
* @return true if the player is in a party, false otherwise // * @return true if the player is in a party, false otherwise
*/ // */
public static boolean inParty(Player player) { // public static boolean inParty(Player player) {
if (UserManager.getPlayer(player) == null) // if (UserManager.getPlayer(player) == null)
return false; // return false;
//
return UserManager.getPlayer(player).inParty(); // return UserManager.getPlayer(player).inParty();
} // }
//
/** // /**
* Check if two players are in the same party. // * Check if two players are in the same party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param playera The first player to check // * @param playera The first player to check
* @param playerb The second player to check // * @param playerb The second player to check
* @return true if the two players are in the same party, false otherwise // * @return true if the two players are in the same party, false otherwise
*/ // */
public static boolean inSameParty(Player playera, Player playerb) { // public static boolean inSameParty(Player playera, Player playerb) {
return PartyManager.inSameParty(playera, playerb); // return PartyManager.inSameParty(playera, playerb);
} // }
//
/** // /**
* Get a list of all current parties. // * Get a list of all current parties.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @return the list of parties. // * @return the list of parties.
*/ // */
public static List<Party> getParties() { // public static List<Party> getParties() {
return PartyManager.getParties(); // return PartyManager.getParties();
} // }
//
/** // /**
* Add a player to a party. // * Add a player to a party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param player The player to add to the party // * @param player The player to add to the party
* @param partyName The party to add the player to // * @param partyName The party to add the player to
* @deprecated parties can have limits, use the other method // * @deprecated parties can have limits, use the other method
*/ // */
@Deprecated // @Deprecated
public static void addToParty(Player player, String partyName) { // public static void addToParty(Player player, String partyName) {
//Check if player profile is loaded // //Check if player profile is loaded
if (UserManager.getPlayer(player) == null) // if (UserManager.getPlayer(player) == null)
return; // return;
//
Party party = PartyManager.getParty(partyName); // Party party = PartyManager.getParty(partyName);
//
if (party == null) { // if (party == null) {
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); // party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
} else if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) { // } else if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) {
if (PartyManager.isPartyFull(player, party)) { // if (PartyManager.isPartyFull(player, party)) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString()); // mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
return; // return;
} // }
} // }
//
PartyManager.addToParty(UserManager.getPlayer(player), party); // PartyManager.addToParty(UserManager.getPlayer(player), party);
} // }
//
/** // /**
* The max party size of the server // * The max party size of the server
* Limits are only enforced if the enforcement setting is on // * Limits are only enforced if the enforcement setting is on
* // *
* @return the max party size on this server // * @return the max party size on this server
*/ // */
public static int getMaxPartySize() { // public static int getMaxPartySize() {
return mcMMO.getConfigManager().getConfigParty().getPartySizeLimit(); // return mcMMO.getConfigManager().getConfigParty().getPartySizeLimit();
} // }
//
/** // /**
* Checks if parties are currently size capped which is determined by the user config // * Checks if parties are currently size capped which is determined by the user config
* // *
* @return true if parties are size capped // * @return true if parties are size capped
*/ // */
public static boolean isPartySizeCapped() { // public static boolean isPartySizeCapped() {
return mcMMO.getConfigManager().getConfigParty().isPartySizeCapped(); // return mcMMO.getConfigManager().getConfigParty().isPartySizeCapped();
} // }
//
/** // /**
* Add a player to a party. // * Add a player to a party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param player The player to add to the party // * @param player The player to add to the party
* @param partyName The party to add the player to // * @param partyName The party to add the player to
* @param bypassLimit if true bypasses party size limits // * @param bypassLimit if true bypasses party size limits
*/ // */
//TODO: bypasslimit not used? // //TODO: bypasslimit not used?
public static void addToParty(Player player, String partyName, boolean bypassLimit) { // public static void addToParty(Player player, String partyName, boolean bypassLimit) {
//Check if player profile is loaded // //Check if player profile is loaded
if (UserManager.getPlayer(player) == null) // if (UserManager.getPlayer(player) == null)
return; // return;
//
Party party = PartyManager.getParty(partyName); // Party party = PartyManager.getParty(partyName);
//
if (party == null) { // if (party == null) {
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); // party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
} // }
//
PartyManager.addToParty(UserManager.getPlayer(player), party); // PartyManager.addToParty(UserManager.getPlayer(player), party);
} // }
//
/** // /**
* Remove a player from a party. // * Remove a player from a party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param player The player to remove // * @param player The player to remove
*/ // */
public static void removeFromParty(Player player) { // public static void removeFromParty(Player player) {
//Check if player profile is loaded // //Check if player profile is loaded
if (UserManager.getPlayer(player) == null) // if (UserManager.getPlayer(player) == null)
return; // return;
//
PartyManager.removeFromParty(UserManager.getPlayer(player)); // PartyManager.removeFromParty(UserManager.getPlayer(player));
} // }
//
/** // /**
* Get the leader of a party. // * Get the leader of a party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param partyName The party name // * @param partyName The party name
* @return the leader of the party // * @return the leader of the party
*/ // */
public static String getPartyLeader(String partyName) { // public static String getPartyLeader(String partyName) {
return PartyManager.getPartyLeaderName(partyName); // return PartyManager.getPartyLeaderName(partyName);
} // }
//
/** // /**
* Set the leader of a party. // * Set the leader of a party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param partyName The name of the party to set the leader of // * @param partyName The name of the party to set the leader of
* @param playerName The playerName to set as leader // * @param playerName The playerName to set as leader
*/ // */
@Deprecated // @Deprecated
public static void setPartyLeader(String partyName, String playerName) { // public static void setPartyLeader(String partyName, String playerName) {
PartyManager.setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), PartyManager.getParty(partyName)); // PartyManager.setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), PartyManager.getParty(partyName));
} // }
//
/** // /**
* Get a list of all players in this player's party. // * Get a list of all players in this player's party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param player The player to check // * @param player The player to check
* @return all the players in the player's party // * @return all the players in the player's party
*/ // */
@Deprecated // @Deprecated
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) { // public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
List<OfflinePlayer> members = new ArrayList<>(); // List<OfflinePlayer> members = new ArrayList<>();
//
for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) { // for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) {
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId); // OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);
members.add(member); // members.add(member);
} // }
return members; // return members;
} // }
//
/** // /**
* Get a list of all player names in this player's party. // * Get a list of all player names in this player's party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param player The player to check // * @param player The player to check
* @return all the player names in the player's party // * @return all the player names in the player's party
*/ // */
@Deprecated // @Deprecated
public static LinkedHashSet<String> getMembers(Player player) { // public static LinkedHashSet<String> getMembers(Player player) {
return (LinkedHashSet<String>) PartyManager.getAllMembers(player).values(); // return (LinkedHashSet<String>) PartyManager.getAllMembers(player).values();
} // }
//
/** // /**
* Get a list of all player names and uuids in this player's party. // * Get a list of all player names and uuids in this player's party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param player The player to check // * @param player The player to check
* @return all the player names and uuids in the player's party // * @return all the player names and uuids in the player's party
*/ // */
public static LinkedHashMap<UUID, String> getMembersMap(Player player) { // public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
return PartyManager.getAllMembers(player); // return PartyManager.getAllMembers(player);
} // }
//
/** // /**
* Get a list of all online players in this party. // * Get a list of all online players in this party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param partyName The party to check // * @param partyName The party to check
* @return all online players in this party // * @return all online players in this party
*/ // */
public static List<Player> getOnlineMembers(String partyName) { // public static List<Player> getOnlineMembers(String partyName) {
return PartyManager.getOnlineMembers(partyName); // return PartyManager.getOnlineMembers(partyName);
} // }
//
/** // /**
* Get a list of all online players in this player's party. // * Get a list of all online players in this player's party.
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @param player The player to check // * @param player The player to check
* @return all online players in the player's party // * @return all online players in the player's party
*/ // */
public static List<Player> getOnlineMembers(Player player) { // public static List<Player> getOnlineMembers(Player player) {
return PartyManager.getOnlineMembers(player); // return PartyManager.getOnlineMembers(player);
} // }
//
public static boolean hasAlly(String partyName) { // public static boolean hasAlly(String partyName) {
return getAllyName(partyName) != null; // return getAllyName(partyName) != null;
} // }
//
public static String getAllyName(String partyName) { // public static String getAllyName(String partyName) {
Party ally = PartyManager.getParty(partyName).getAlly(); // Party ally = PartyManager.getParty(partyName).getAlly();
if (ally != null) { // if (ally != null) {
return ally.getName(); // return ally.getName();
} // }
//
return null; // return null;
} // }
} //}

View File

@ -1,94 +1,94 @@
package com.gmail.nossr50.api; //package com.gmail.nossr50.api;
//
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; //import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.Arrays; //import java.util.Arrays;
import java.util.List; //import java.util.List;
//
public final class SkillAPI { //public final class SkillAPI {
private SkillAPI() { // private SkillAPI() {
} // }
//
/** // /**
* Returns a list of strings with mcMMO's skills // * Returns a list of strings with mcMMO's skills
* This includes parent and child skills // * This includes parent and child skills
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @return a list of strings with valid skill names // * @return a list of strings with valid skill names
*/ // */
public static List<String> getSkills() { // public static List<String> getSkills() {
return getListFromEnum(Arrays.asList(PrimarySkillType.values())); // return getListFromEnum(Arrays.asList(PrimarySkillType.values()));
} // }
//
/** // /**
* Returns a list of strings with mcMMO's skills // * Returns a list of strings with mcMMO's skills
* This only includes parent skills // * This only includes parent skills
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @return a list of strings with valid skill names // * @return a list of strings with valid skill names
*/ // */
public static List<String> getNonChildSkills() { // public static List<String> getNonChildSkills() {
return getListFromEnum(PrimarySkillType.NON_CHILD_SKILLS); // return getListFromEnum(PrimarySkillType.NON_CHILD_SKILLS);
} // }
//
/** // /**
* Returns a list of strings with mcMMO's skills // * Returns a list of strings with mcMMO's skills
* This only includes child skills // * This only includes child skills
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @return a list of strings with valid skill names // * @return a list of strings with valid skill names
*/ // */
public static List<String> getChildSkills() { // public static List<String> getChildSkills() {
return getListFromEnum(PrimarySkillType.CHILD_SKILLS); // return getListFromEnum(PrimarySkillType.CHILD_SKILLS);
} // }
//
/** // /**
* Returns a list of strings with mcMMO's skills // * Returns a list of strings with mcMMO's skills
* This only includes combat skills // * This only includes combat skills
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @return a list of strings with valid skill names // * @return a list of strings with valid skill names
*/ // */
public static List<String> getCombatSkills() { // public static List<String> getCombatSkills() {
return getListFromEnum(PrimarySkillType.COMBAT_SKILLS); // return getListFromEnum(PrimarySkillType.COMBAT_SKILLS);
} // }
//
/** // /**
* Returns a list of strings with mcMMO's skills // * Returns a list of strings with mcMMO's skills
* This only includes gathering skills // * This only includes gathering skills
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @return a list of strings with valid skill names // * @return a list of strings with valid skill names
*/ // */
public static List<String> getGatheringSkills() { // public static List<String> getGatheringSkills() {
return getListFromEnum(PrimarySkillType.GATHERING_SKILLS); // return getListFromEnum(PrimarySkillType.GATHERING_SKILLS);
} // }
//
/** // /**
* Returns a list of strings with mcMMO's skills // * Returns a list of strings with mcMMO's skills
* This only includes misc skills // * This only includes misc skills
* </br> // * </br>
* This function is designed for API usage. // * This function is designed for API usage.
* // *
* @return a list of strings with valid skill names // * @return a list of strings with valid skill names
*/ // */
public static List<String> getMiscSkills() { // public static List<String> getMiscSkills() {
return getListFromEnum(PrimarySkillType.MISC_SKILLS); // return getListFromEnum(PrimarySkillType.MISC_SKILLS);
} // }
//
private static List<String> getListFromEnum(List<PrimarySkillType> skillsTypes) { // private static List<String> getListFromEnum(List<PrimarySkillType> skillsTypes) {
List<String> skills = new ArrayList<>(); // List<String> skills = new ArrayList<>();
//
for (PrimarySkillType primarySkillType : skillsTypes) { // for (PrimarySkillType primarySkillType : skillsTypes) {
skills.add(primarySkillType.name()); // skills.add(primarySkillType.name());
} // }
//
return skills; // return skills;
} // }
} //}

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.api.exceptions; //package com.gmail.nossr50.api.exceptions;
//
public class InvalidFormulaTypeException extends RuntimeException { //public class InvalidFormulaTypeException extends RuntimeException {
private static final long serialVersionUID = 3368670229490121886L; // private static final long serialVersionUID = 3368670229490121886L;
//
public InvalidFormulaTypeException() { // public InvalidFormulaTypeException() {
super("That is not a valid FormulaType."); // super("That is not a valid FormulaType.");
} // }
} //}

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.api.exceptions; //package com.gmail.nossr50.api.exceptions;
//
public class InvalidPlayerException extends RuntimeException { //public class InvalidPlayerException extends RuntimeException {
private static final long serialVersionUID = 907213002618581385L; // private static final long serialVersionUID = 907213002618581385L;
//
public InvalidPlayerException() { // public InvalidPlayerException() {
super("That player does not exist in the database."); // super("That player does not exist in the database.");
} // }
} //}

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.api.exceptions; //package com.gmail.nossr50.api.exceptions;
//
public class InvalidSkillException extends RuntimeException { //public class InvalidSkillException extends RuntimeException {
private static final long serialVersionUID = 942705284195791157L; // private static final long serialVersionUID = 942705284195791157L;
//
public InvalidSkillException(String s) { // public InvalidSkillException(String s) {
super(s + " does not match a valid skill."); // super(s + " does not match a valid skill.");
} // }
} //}

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.api.exceptions; //package com.gmail.nossr50.api.exceptions;
//
public class InvalidXPGainReasonException extends RuntimeException { //public class InvalidXPGainReasonException extends RuntimeException {
private static final long serialVersionUID = 4427052841957931157L; // private static final long serialVersionUID = 4427052841957931157L;
//
public InvalidXPGainReasonException() { // public InvalidXPGainReasonException() {
super("That is not a valid XPGainReason."); // super("That is not a valid XPGainReason.");
} // }
} //}

View File

@ -1,11 +1,11 @@
package com.gmail.nossr50.api.exceptions; //package com.gmail.nossr50.api.exceptions;
//
import org.bukkit.entity.Player; //import org.bukkit.entity.Player;
//
public class McMMOPlayerNotFoundException extends RuntimeException { //public class McMMOPlayerNotFoundException extends RuntimeException {
private static final long serialVersionUID = 761917904993202836L; // private static final long serialVersionUID = 761917904993202836L;
//
public McMMOPlayerNotFoundException(Player player) { // public McMMOPlayerNotFoundException(Player player) {
super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId()); // super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId());
} // }
} //}

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.api.exceptions; //package com.gmail.nossr50.api.exceptions;
//
public class MissingSkillPropertyDefinition extends RuntimeException { //public class MissingSkillPropertyDefinition extends RuntimeException {
public MissingSkillPropertyDefinition(String details) { // public MissingSkillPropertyDefinition(String details) {
super("A skill property is undefined! Details: " + details); // super("A skill property is undefined! Details: " + details);
} // }
} //}

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.api.exceptions; //package com.gmail.nossr50.api.exceptions;
//
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; //import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
//
public class UndefinedSkillBehaviour extends RuntimeException { //public class UndefinedSkillBehaviour extends RuntimeException {
public UndefinedSkillBehaviour(PrimarySkillType primarySkillType) { // public UndefinedSkillBehaviour(PrimarySkillType primarySkillType) {
super("Undefined behaviour for skill! - " + primarySkillType.toString()); // super("Undefined behaviour for skill! - " + primarySkillType.toString());
} // }
} //}