diff --git a/.classpath b/.classpath index b367607..ba20ed7 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + diff --git a/src/plugin.yml b/plugin.yml similarity index 64% rename from src/plugin.yml rename to plugin.yml index 4f90abe..e95ded5 100644 --- a/src/plugin.yml +++ b/plugin.yml @@ -2,5 +2,5 @@ name: PluginLibrary author: Staartvin main: me.staartvin.plugins.pluginlibrary.PluginLibrary version: 1.0 -description: A library plugin that allows developers to easily get a lot of data from other plugins. +description: Allows developers to get a lot of data from other plugins without importing the APIs themselves. softdepend: [Autorank, Stats, mcMMO, Factions, afkTerminator, OnTime, RoyalCommands, UltimateCore] \ No newline at end of file diff --git a/src/me/staartvin/plugins/pluginlibrary/Library.java b/src/me/staartvin/plugins/pluginlibrary/Library.java index e16e894..b2826ab 100644 --- a/src/me/staartvin/plugins/pluginlibrary/Library.java +++ b/src/me/staartvin/plugins/pluginlibrary/Library.java @@ -20,14 +20,11 @@ */ public enum Library { - AUTORANK("Autorank", new AutorankHook()), - STATS("Stats", new StatsHook()), - MCMMO("mcMMO", new McMMOHook()), - FACTIONS("Factions", new FactionsHook()), - ONTIME("OnTime", new OnTimeHook()), - AFKTERMINATOR("afkTerminator", new AFKTerminatorHook()), - ROYALCOMMANDS("RoyalCommands", new RoyalCommandsHook()), - ULTIMATECORE("UltimateCore", new UltimateCoreHook()); + AUTORANK("Autorank", new AutorankHook()), STATS("Stats", new StatsHook()), MCMMO("mcMMO", + new McMMOHook()), FACTIONS("Factions", new FactionsHook()), ONTIME("OnTime", + new OnTimeHook()), AFKTERMINATOR("afkTerminator", new AFKTerminatorHook()), ROYALCOMMANDS( + "RoyalCommands", + new RoyalCommandsHook()), ULTIMATECORE("UltimateCore", new UltimateCoreHook()); private String pluginName; private LibraryHook hook; @@ -46,8 +43,11 @@ public LibraryHook getHook() { } /** - * Get a library programmaticaly. This method is the same as valueOf(), but is case-insensitive. - * @param value name of the library + * Get a library programmaticaly. This method is the same as valueOf(), but + * is case-insensitive. + * + * @param value + * name of the library * @return the Library object or null if not found. */ public static Library getEnum(String value) { diff --git a/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java b/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java index f809f50..4c55558 100644 --- a/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java +++ b/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java @@ -28,23 +28,22 @@ public void onEnable() { loadedLibraries.clear(); - //this is a test + // this is a test logMessage(ChatColor.GOLD + "***== Loading libraries ==***"); - logMessage(ChatColor.GOLD + "***== Loaded " + ChatColor.WHITE - + loadLibraries() + ChatColor.GOLD + " libraries! ==***"); + logMessage(ChatColor.GOLD + "***== Loaded " + ChatColor.WHITE + loadLibraries() + ChatColor.GOLD + + " libraries! ==***"); if (this.isLibraryLoaded(Library.STATS)) { - // Register custom stats so that Stats has special mobs and food eaten requirement. + // Register custom stats so that Stats has special mobs and food + // eaten requirement. setCustomStatsManager(new CustomStatsManager(this)); this.getCustomStatsManager().registerCustomStats(); } - logMessage(ChatColor.GOLD + "Loaded libraries: " - + getLoadedLibrariesAsString()); + logMessage(ChatColor.GOLD + "Loaded libraries: " + getLoadedLibrariesAsString()); + + logMessage(ChatColor.GREEN + "*** Ready for plugins to send/retrieve data. ***"); - logMessage(ChatColor.GREEN - + "*** Ready for plugins to send/retrieve data. ***"); - logMessage(this.getDescription().getFullName() + " is now enabled!"); } @@ -81,8 +80,7 @@ public int loadLibraries() { public void logMessage(String message) { // This makes sure it can support colours. - this.getServer().getConsoleSender() - .sendMessage(ChatColor.GRAY + "[PluginLibrary] " + message); + this.getServer().getConsoleSender().sendMessage(ChatColor.GRAY + "[PluginLibrary] " + message); } /** @@ -101,7 +99,8 @@ public List getLoadedLibraries() { * Will throw a {@link IllegalArgumentException} when there is no library * with the given name. * - * @param pluginName Name of the plugin. Case-insensitive! + * @param pluginName + * Name of the plugin. Case-insensitive! * @return {@link me.staartvin.plugins.pluginlibrary.LibraryHook} class or * an error. */ @@ -110,10 +109,10 @@ public static LibraryHook getLibrary(String pluginName) { } /** - * @see #getLibrary(String) - *
+ * @see #getLibrary(String)
* Returns the same as {@link #getLibrary(String)}. - * @param lib Library enum to get the library hook for. + * @param lib + * Library enum to get the library hook for. * @return {@link me.staartvin.plugins.pluginlibrary.LibraryHook} class or * an error. */ @@ -124,7 +123,8 @@ public static LibraryHook getLibrary(Library lib) { /** * Checks to see whether the library is loaded and thus ready for use. * - * @param lib Library to check. + * @param lib + * Library to check. * @return true if the library is loaded; false otherwise. */ public boolean isLibraryLoaded(Library lib) { @@ -144,18 +144,13 @@ private String getLoadedLibrariesAsString() { for (int i = 0, l = loadedLibraries.size(); i < l; i++) { if (i == 0) { - builder.append(ChatColor.DARK_AQUA - + loadedLibraries.get(i).getPluginName() + ChatColor.RESET); + builder.append(ChatColor.DARK_AQUA + loadedLibraries.get(i).getPluginName() + ChatColor.RESET); } else if (i == (l - 1)) { - builder.append(ChatColor.GRAY - + " and " - + (ChatColor.DARK_AQUA - + loadedLibraries.get(i).getPluginName() + ChatColor.RESET)); + builder.append(ChatColor.GRAY + " and " + + (ChatColor.DARK_AQUA + loadedLibraries.get(i).getPluginName() + ChatColor.RESET)); } else { - builder.append(ChatColor.GRAY - + ", " - + (ChatColor.DARK_AQUA - + loadedLibraries.get(i).getPluginName() + ChatColor.RESET)); + builder.append(ChatColor.GRAY + ", " + + (ChatColor.DARK_AQUA + loadedLibraries.get(i).getPluginName() + ChatColor.RESET)); } } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/AFKTerminatorHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/AFKTerminatorHook.java index 2c70508..4d8c3d3 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/AFKTerminatorHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/AFKTerminatorHook.java @@ -7,8 +7,8 @@ import me.staartvin.plugins.pluginlibrary.Library; /** - * afkTerminator library, link. + * afkTerminator library, + * link. *

* Date created: 16:26:41 14 aug. 2015 * @@ -17,72 +17,93 @@ */ public class AFKTerminatorHook extends LibraryHook { - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable() */ @Override public boolean isAvailable() { - return this.getPlugin().getServer().getPluginManager() - .isPluginEnabled(Library.AFKTERMINATOR.getPluginName()); + return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.AFKTERMINATOR.getPluginName()); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook() */ @Override public boolean hook() { - // All api calls are done static, so there is no need to get the plugin class. + // All api calls are done static, so there is no need to get the plugin + // class. // We only check if the plugin is available. return isAvailable(); } - - /**See if a player is suspected of using an AFK Machine. - *
This will return 'true' if the player's activity is indicative of an AFK Machine, but not all conditions of an AFK machine are confirmed. - * @param uuid UUID of the player to check. - * @return true if afkTerminator suspects that the player is using an AFK machine; false otherwise. + + /** + * See if a player is suspected of using an AFK Machine.
+ * This will return 'true' if the player's activity is indicative of an AFK + * Machine, but not all conditions of an AFK machine are confirmed. + * + * @param uuid + * UUID of the player to check. + * @return true if afkTerminator suspects that the player is using an AFK + * machine; false otherwise. */ public boolean isAFKMachineSuspected(UUID uuid) { return AfkDetect.isAFKMachineSuspected(uuid); } - + /** - * See if use of an AFK machine has been confirmed for a user. - *
This will return 'true' if the player's activity is confirmed to be an AFK Machine by the plugin. - *
If the machine is a big one, it can take a while before afkTerminator detects it. - * @param uuid UUID of the player to check. - * @return true if afkTerminator detected that the player is using an AFK machine; false otherwise. + * See if use of an AFK machine has been confirmed for a user.
+ * This will return 'true' if the player's activity is confirmed to be an + * AFK Machine by the plugin.
+ * If the machine is a big one, it can take a while before afkTerminator + * detects it. + * + * @param uuid + * UUID of the player to check. + * @return true if afkTerminator detected that the player is using an AFK + * machine; false otherwise. */ public boolean isAFKMachineDetected(UUID uuid) { return AfkDetect.isAFKMachineDetected(uuid); } - - /** - * If a machine is suspected or later detected, find out the timestamp of when the player is thought to have started using the machine. - *
This is expressed in milliseconds, as measured from the java epoch of Jan 1, 1970. - * @param uuid UUID of the player to check. - * @return Time in milliseconds since the player started using the machine, UNIX time; otherwise 0. + /** + * If a machine is suspected or later detected, find out the timestamp of + * when the player is thought to have started using the machine.
+ * This is expressed in milliseconds, as measured from the java epoch of Jan + * 1, 1970. + * + * @param uuid + * UUID of the player to check. + * @return Time in milliseconds since the player started using the machine, + * UNIX time; otherwise 0. */ public long getAFKMachineStartTime(UUID uuid) { return AfkDetect.getAFKMachineStartTime(uuid); - + } - + /** - * When a player is using an AFK machine, you can get the type of the AFK machine. - *
Types possible: - *
VEHICLE, TETHERED_PIG, HORSE, WATER, JUMP, PISTON, FISHING, PROJECTILE or INTERACTION. - * @param uuid UUID of the player to check. + * When a player is using an AFK machine, you can get the type of the AFK + * machine.
+ * Types possible:
+ * VEHICLE, TETHERED_PIG, HORSE, WATER, JUMP, PISTON, FISHING, PROJECTILE or + * INTERACTION. + * + * @param uuid + * UUID of the player to check. * @return Type of the AFK machine or null if the player is not using any. */ public String getAFKMachineType(UUID uuid) { AFKMACHINES type = AfkDetect.getAFKMachineType(uuid); - - if (type == null) return null; - + + if (type == null) + return null; + return type.toString(); } - - } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/AutorankHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/AutorankHook.java index ed53e6c..771cd82 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/AutorankHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/AutorankHook.java @@ -10,133 +10,177 @@ import me.staartvin.plugins.pluginlibrary.Library; /** - * Autorank library, link. + * Autorank library, + * link. *

- * Date created: 14:21:44 - * 12 aug. 2015 + * Date created: 14:21:44 12 aug. 2015 + * * @author Staartvin * */ public class AutorankHook extends LibraryHook { private Autorank autorank; - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.LibraryHook#isAvailable() */ @Override public boolean isAvailable() { // TODO Auto-generated method stub - + return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.AUTORANK.getPluginName()); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.LibraryHook#hook() */ @Override public boolean hook() { // TODO Auto-generated method stub - - if (!isAvailable()) return false; - - autorank = (Autorank) this.getPlugin().getServer().getPluginManager().getPlugin(Library.AUTORANK.getPluginName()); - + + if (!isAvailable()) + return false; + + autorank = (Autorank) this.getPlugin().getServer().getPluginManager() + .getPlugin(Library.AUTORANK.getPluginName()); + return autorank != null; } - + /** * Gets playtime of a player in minutes on this local server. - * @param uuid UUID of the player + * + * @param uuid + * UUID of the player * @return amount of minutes a player has played. */ public int getLocalPlayTime(UUID uuid) { return autorank.getAPI().getLocalPlayTime(uuid); } - + /** - * When Autorank is set up on multiple servers in the same network, it will sum a player's time across all servers. - *
If a player plays on server A for 10 minutes and on server B for 15 minutes, the global time will be 25 minutes. - *
This method allows you to get the global time of a player in minutes. - * @param uuid UUID of the player - * @return amount of minutes a player has played across all servers in the network. + * When Autorank is set up on multiple servers in the same network, it will + * sum a player's time across all servers.
+ * If a player plays on server A for 10 minutes and on server B for 15 + * minutes, the global time will be 25 minutes.
+ * This method allows you to get the global time of a player in minutes. + * + * @param uuid + * UUID of the player + * @return amount of minutes a player has played across all servers in the + * network. */ public int getGlobalPlayTime(UUID uuid) { return autorank.getAPI().getGlobalPlayTime(uuid); } - + /** - * When a player is in a permission group that has requirements before the player can rank up, - *
this method will show all the requirements that the player should complete before he ranks up. - *
This method does not take into account which requirements are already completed by the player. - *
If you only want the requirements that have yet to be completed by the player, - *
use {@link #getFailedRequirements(Player)}. - *
This method merely copies the config of Autorank and is used for getting all the requirements of a player's permission group. - * @param player Player to get the requirements for. - * @return A list of all requirements + * When a player is in a permission group that has requirements before the + * player can rank up,
+ * this method will show all the requirements that the player should + * complete before he ranks up.
+ * This method does not take into account which requirements are already + * completed by the player.
+ * If you only want the requirements that have yet to be completed by the + * player,
+ * use {@link #getFailedRequirements(Player)}.
+ * This method merely copies the config of Autorank and is used for getting + * all the requirements of a player's permission group. + * + * @param player + * Player to get the requirements for. + * @return A list of all requirements */ public List getAllRequirements(Player player) { return autorank.getAPI().getAllRequirements(player); } - + /** - * See {@link #getAllRequirements(Player)} for more info. - *
This method only returns the requirements that have yet to be completed by the player. - * @param player Player to get the requirements for. + * See {@link #getAllRequirements(Player)} for more info.
+ * This method only returns the requirements that have yet to be completed + * by the player. + * + * @param player + * Player to get the requirements for. * @return A list of all requirements that should still be completed. */ public List getFailedRequirements(Player player) { return autorank.getAPI().getFailedRequirements(player); } - + /** - * Gets the name of the database that Autorank uses to store its global times. + * Gets the name of the database that Autorank uses to store its global + * times. + * * @return name of database or null if MySQL is not used by Autorank. */ public String getMySQLDatabase() { return autorank.getAPI().getMySQLDatabase(); } - + /** - * Gets a list of all permission groups a player is currently in. - *
Most permission plugins only allow a player to be in one group at the time, but some allow multiple. - * @param player Player to get the groups of. + * Gets a list of all permission groups a player is currently in.
+ * Most permission plugins only allow a player to be in one group at the + * time, but some allow multiple. + * + * @param player + * Player to get the groups of. * @return a list of groups a player is part of. */ public List getPermissionGroups(Player player) { return autorank.getAPI().getPermissionGroups(player); } - + /** - * Gets the primary permission group a player is in. - *
Some permission plugins allow players to be in multiple permission groups at the same time. - *
Autorank uses some clever ways to determine which of those groups is the 'primary group'. - * @param player Player to get the primary group of. - * @return the name of the primary permission group or null if nothing was found. + * Gets the primary permission group a player is in.
+ * Some permission plugins allow players to be in multiple permission groups + * at the same time.
+ * Autorank uses some clever ways to determine which of those groups is the + * 'primary group'. + * + * @param player + * Player to get the primary group of. + * @return the name of the primary permission group or null if nothing was + * found. */ public String getPrimaryGroup(Player player) { return autorank.getAPI().getPrimaryGroup(player); } - + /** - * Registers a custom requirement to Autorank. - *
Users of Autorank can use different requirements already coded by the author, - *
but it's also possible to add your own requirements. - *
For more info about custom requirements and results, see: - *
https://github.com/Armarr/Autorank-2/wiki/Developer's-API#custom-requirements - * @param requirementName Name of the requirement. - * @param req The custom requirement class for Autorank to use. + * Registers a custom requirement to Autorank.
+ * Users of Autorank can use different requirements already coded by the + * author,
+ * but it's also possible to add your own requirements.
+ * For more info about custom requirements and results, see:
+ * + * https://github.com/Armarr/Autorank-2/wiki/Developer's-API#custom- + * requirements + * + * @param requirementName + * Name of the requirement. + * @param req + * The custom requirement class for Autorank to use. */ public void registerRequirement(String requirementName, Class req) { autorank.getAPI().registerRequirement(requirementName, req); } - + /** * @see #registerRequirement(String, Class) - * @param resultName The name of the result. - * @param res The custom result class for Autorank to use. + * @param resultName + * The name of the result. + * @param res + * The custom result class for Autorank to use. */ - public void registerResult(String resultName, Class res) { + public void registerResult(String resultName, + Class res) { autorank.getAPI().registerResult(resultName, res); } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/LibraryHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/LibraryHook.java index d8afd00..79ff65f 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/LibraryHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/LibraryHook.java @@ -7,8 +7,8 @@ /** * Represents a hook to another plugin *

- * Date created: 14:13:45 - * 12 aug. 2015 + * Date created: 14:13:45 12 aug. 2015 + * * @author Staartvin * */ @@ -17,15 +17,17 @@ public abstract class LibraryHook { protected PluginLibrary getPlugin() { return (PluginLibrary) Bukkit.getServer().getPluginManager().getPlugin("PluginLibrary"); } - + /** * Whether or not the plugin is available. + * * @return true when plugin is available to use; false otherwise. */ public abstract boolean isAvailable(); - + /** * Hook the plugin to make sure data can be retrieved. + * * @return true if PluginLibrary could successfully hook; false otherwise. */ public abstract boolean hook(); diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java index f2315e3..e8d6a4f 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java @@ -25,8 +25,8 @@ import me.staartvin.plugins.pluginlibrary.Library; /** - * mcMMO library, link. + * mcMMO library, + * link. *

* Date created: 18:25:13 12 aug. 2015 * @@ -37,18 +37,21 @@ public class McMMOHook extends LibraryHook { private mcMMO api; - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable() */ @Override public boolean isAvailable() { // TODO Auto-generated method stub - return this.getPlugin().getServer().getPluginManager() - .isPluginEnabled(Library.MCMMO.getPluginName()); + return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.MCMMO.getPluginName()); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook() */ @Override @@ -58,8 +61,7 @@ public boolean hook() { if (!isAvailable()) return false; - api = (mcMMO) this.getPlugin().getServer().getPluginManager() - .getPlugin(Library.MCMMO.getPluginName()); + api = (mcMMO) this.getPlugin().getServer().getPluginManager().getPlugin(Library.MCMMO.getPluginName()); return api != null; } @@ -68,10 +70,10 @@ public boolean hook() { /** * Checks whether given string is a valid type of skill suitable for the - * other API calls in mcMMO. - *
+ * other API calls in mcMMO.
* - * @param skillType String to check. + * @param skillType + * String to check. * @return true if this is a valid mcMMO skill. */ public boolean isValidSkillType(String skillType) { @@ -79,12 +81,12 @@ public boolean isValidSkillType(String skillType) { } /** - * Checks whether the given skill type string is both valid and not a - * child skill. (Child skills have no XP of their own, and their level is - * derived from the parent(s).) - *
+ * Checks whether the given skill type string is both valid and not a child + * skill. (Child skills have no XP of their own, and their level is derived + * from the parent(s).)
* - * @param skillType the skill to check + * @param skillType + * the skill to check * @return true if this is a valid, non-child mcMMO skill */ public boolean isNonChildSkill(String skillType) { @@ -92,36 +94,43 @@ public boolean isNonChildSkill(String skillType) { } /** - * Adds raw XP to the player. - *
+ * Adds raw XP to the player.
* - * @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, choose from PVP, PVE, - * VAMPIRISM, SHARED_PVP, SHARED_PVE, COMMAND or UNKNOWN. - * @param isUnshared true if the XP cannot be shared with party members + * @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, choose from PVP, PVE, VAMPIRISM, + * SHARED_PVP, SHARED_PVE, COMMAND or UNKNOWN. + * @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 + * @throws InvalidSkillException + * if the given skill is not valid + * @throws InvalidXPGainReasonException + * if the given xpGainReason is not valid */ - public void addRawXP(Player player, String skillType, float XP, - String xpGainReason, boolean isUnshared) { + public void addRawXP(Player player, String skillType, float XP, String xpGainReason, boolean isUnshared) { ExperienceAPI.addRawXP(player, skillType, XP, xpGainReason, isUnshared); } /** - * Adds raw XP to an offline player. - *
+ * Adds raw XP to an offline player.
* - * @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 + * @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 - * @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 */ public void addRawXPOffline(UUID uuid, String skillType, float XP) { @@ -129,78 +138,90 @@ public void addRawXPOffline(UUID uuid, String skillType, float XP) { } /** - * Adds XP to the player, calculates for XP Rate and skill modifier. - *
+ * Adds XP to the player, calculates for XP Rate and skill modifier.
* - * @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, choose from PVP, PVE, - * VAMPIRISM, SHARED_PVP, SHARED_PVE, COMMAND or UNKNOWN. - * @param isUnshared true if the XP cannot be shared with party members + * @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, choose from PVP, PVE, VAMPIRISM, + * SHARED_PVP, SHARED_PVE, COMMAND or UNKNOWN. + * @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 + * @throws InvalidSkillException + * if the given skill is not valid + * @throws InvalidXPGainReasonException + * if the given xpGainReason is not valid */ - public void addModifiedXP(Player player, String skillType, int XP, - String xpGainReason, boolean isUnshared) { - ExperienceAPI.addModifiedXP(player, skillType, XP, xpGainReason, - isUnshared); + public void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) { + ExperienceAPI.addModifiedXP(player, skillType, XP, xpGainReason, isUnshared); } /** - * Adds XP to the player, calculates for XP Rate only. - *
+ * Adds XP to the player, calculates for XP Rate only.
* - * @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, choose from PVP, PVE, - * VAMPIRISM, SHARED_PVP, SHARED_PVE, COMMAND or UNKNOWN. + * @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, choose from PVP, PVE, VAMPIRISM, + * SHARED_PVP, SHARED_PVE, COMMAND or UNKNOWN. * - * @throws InvalidSkillException if the given skill is not valid - * @throws InvalidXPGainReasonException if the given xpGainReason is not - * valid + * @throws InvalidSkillException + * if the given skill is not valid + * @throws InvalidXPGainReasonException + * if the given xpGainReason is not valid */ - public void addMultipliedXP(Player player, String skillType, int XP, - String xpGainReason) { + public void addMultipliedXP(Player player, String skillType, int XP, String xpGainReason) { ExperienceAPI.addMultipliedXP(player, skillType, XP, xpGainReason); } /** - * Adds XP to an offline player, calculates for XP Rate only. - *
+ * Adds XP to an offline player, calculates for XP Rate only.
* * @deprecated Unknown reason * - * @param playerName The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add + * @param 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 + * @throws InvalidSkillException + * if the given skill is not valid + * @throws InvalidPlayerException + * if the given player does not exist in the database */ @Deprecated - public void addMultipliedXPOffline(String playerName, String skillType, - int XP) { + public void addMultipliedXPOffline(String playerName, String skillType, int XP) { ExperienceAPI.addMultipliedXPOffline(playerName, skillType, XP); } /** - * Adds XP to an offline player, calculates for XP Rate and skill modifier. - *
+ * Adds XP to an offline player, calculates for XP Rate and skill + * modifier.
* * @deprecated Unknown reason * - * @param playerName The player to add XP to - * @param skillType The skill to add XP to - * @param XP The amount of XP to add + * @param 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 + * @throws InvalidSkillException + * if the given skill is not valid + * @throws InvalidPlayerException + * if the given player does not exist in the database */ @Deprecated public void addModifiedXPOffline(String playerName, String skillType, int XP) { @@ -209,100 +230,118 @@ public void addModifiedXPOffline(String playerName, String skillType, int XP) { /** * Adds XP to the player, calculates for XP Rate, skill modifiers, perks, - * child skills, - * and party sharing. - *
- * - * @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, choose from PVP, PVE, - * VAMPIRISM, SHARED_PVP, SHARED_PVE, COMMAND or UNKNOWN. - * @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 void addXP(Player player, String skillType, int XP, - String xpGainReason, boolean isUnshared) { + * child skills, and party sharing.
+ * + * @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, choose from PVP, PVE, VAMPIRISM, + * SHARED_PVP, SHARED_PVE, COMMAND or UNKNOWN. + * @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 void addXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) { ExperienceAPI.addXP(player, skillType, XP, xpGainReason, isUnshared); } /** - * Get the amount of XP a player has in a specific skill. - *
+ * Get the amount of XP a player has in a specific skill.
* - * @param player The player to get XP for - * @param skillType The skill 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 UnsupportedOperationException if the given skill is a child skill + * @throws InvalidSkillException + * if the given skill is not valid + * @throws UnsupportedOperationException + * if the given skill is a child skill */ public int getXP(Player player, String skillType) { return ExperienceAPI.getXP(player, skillType); } /** - * Get the amount of XP an offline player has in a specific skill. - *
+ * Get the amount of XP an offline player has in a specific skill.
* - * @param uuid The player to get XP for - * @param skillType The skill 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 UnsupportedOperationException if the given skill is a child skill + * @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 int getOfflineXP(UUID uuid, String skillType) { return ExperienceAPI.getOfflineXP(uuid, skillType); } /** - * Get the raw amount of XP a player has in a specific skill. - *
+ * Get the raw amount of XP a player has in a specific skill.
* - * @param player The player to get XP for - * @param skillType The skill 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 UnsupportedOperationException if the given skill is a child skill + * @throws InvalidSkillException + * if the given skill is not valid + * @throws UnsupportedOperationException + * if the given skill is a child skill */ public float getXPRaw(Player player, String skillType) { return ExperienceAPI.getXPRaw(player, skillType); } /** - * Get the raw amount of XP an offline player has in a specific skill. - *
+ * Get the raw amount of XP an offline player has in a specific skill.
* - * @param uuid The player to get XP for - * @param skillType The skill 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 UnsupportedOperationException if the given skill is a child skill + * @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 float getOfflineXPRaw(UUID uuid, String skillType) { return ExperienceAPI.getOfflineXPRaw(uuid, skillType); } /** - * Get the total amount of XP needed to reach the next level. - *
+ * Get the total amount of XP needed to reach the next level.
* - * @param player The player to get the XP amount for - * @param skillType The skill 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 UnsupportedOperationException if the given skill is a child skill + * @throws InvalidSkillException + * if the given skill is not valid + * @throws UnsupportedOperationException + * if the given skill is a child skill */ public int getXPToNextLevel(Player player, String skillType) { return ExperienceAPI.getXPToNextLevel(player, skillType); @@ -310,119 +349,139 @@ public int getXPToNextLevel(Player player, String skillType) { /** * Get the total amount of XP an offline player needs to reach the next - * level. - *
+ * level.
* - * @param uuid The player to get XP for - * @param skillType The skill 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 UnsupportedOperationException if the given skill is a child skill + * @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 int getOfflineXPToNextLevel(UUID uuid, String skillType) { return ExperienceAPI.getOfflineXPToNextLevel(uuid, skillType); } /** - * Get the amount of XP remaining until the next level. - *
+ * Get the amount of XP remaining until the next level.
* - * @param player The player to get the XP amount for - * @param skillType The skill 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 UnsupportedOperationException if the given skill is a child skill + * @throws InvalidSkillException + * if the given skill is not valid + * @throws UnsupportedOperationException + * if the given skill is a child skill */ public int getXPRemaining(Player player, String skillType) { return ExperienceAPI.getXPRemaining(player, skillType); } /** - * Get the amount of XP an offline player has left before leveling up. - *
+ * Get the amount of XP an offline player has left before leveling up.
* - * @param uuid The player to get XP for - * @param skillType The skill 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 UnsupportedOperationException if the given skill is a child skill + * @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 float getOfflineXPRemaining(UUID uuid, String skillType) { return ExperienceAPI.getOfflineXPRemaining(uuid, skillType); } /** - * Add levels to a skill. - *
+ * Add levels to a skill.
* - * @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 player + * 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 + * @throws InvalidSkillException + * if the given skill is not valid */ public void addLevel(Player player, String skillType, int levels) { ExperienceAPI.addLevel(player, skillType, levels); } /** - * Add levels to a skill for an offline player. - *
. + * Add levels to a skill for an offline player.
+ * . * - * @param uuid The player to add levels to - * @param skillType Type of skill to add levels to - * @param levels Number of levels to add + * @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 - * @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 */ public void addLevelOffline(UUID uuid, String skillType, int levels) { ExperienceAPI.addLevelOffline(uuid, skillType, levels); } /** - * Get the level a player has in a specific skill. - *
+ * Get the level a player has in a specific skill.
* - * @param player The player to get the level for - * @param skillType The skill 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 + * @throws InvalidSkillException + * if the given skill is not valid */ public int getLevel(Player player, String skillType) { return ExperienceAPI.getLevel(player, skillType); } /** - * Get the level an offline player has in a specific skill. - *
+ * Get the level an offline player has in a specific skill.
* - * @param uuid The player to get the level for - * @param skillType The skill 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 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 */ public int getLevelOffline(UUID uuid, String skillType) { return ExperienceAPI.getLevelOffline(uuid, skillType); } /** - * Gets the power level of a player. - *
+ * Gets the power level of a player.
* - * @param player The player to get the power level for + * @param player + * The player to get the power level for * @return the power level of the player */ public int getPowerLevel(Player player) { @@ -430,35 +489,35 @@ public int getPowerLevel(Player player) { } /** - * Gets the power level of an offline player. - *
+ * Gets the power level of an offline player.
* - * @param uuid The player to get the power level for + * @param uuid + * The player to get the power level for * @return the power level of the player * - * @throws InvalidPlayerException if the given player does not exist in the - * database + * @throws InvalidPlayerException + * if the given player does not exist in the database */ public int getPowerLevelOffline(UUID uuid) { return ExperienceAPI.getPowerLevelOffline(uuid); } /** - * Get the level cap of a specific skill. - *
+ * Get the level cap of a specific skill.
* - * @param skillType The skill to get the level cap for + * @param skillType + * The skill to get the level cap for * @return the level cap of a given skill * - * @throws InvalidSkillException if the given skill is not valid + * @throws InvalidSkillException + * if the given skill is not valid */ public int getLevelCap(String skillType) { return ExperienceAPI.getLevelCap(skillType); } /** - * Get the power level cap. - *
+ * Get the power level cap.
* * @return the overall power level cap */ @@ -467,16 +526,19 @@ public int getPowerLevelCap() { } /** - * Get the position on the leaderboard of a player. - *
+ * Get the position on the leaderboard of a player.
* - * @param uuid The name of the player to check - * @param skillType The skill 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 + * @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 */ @@ -485,13 +547,13 @@ public int getPlayerRankSkill(UUID uuid, String skillType) { } /** - * Get the position on the power level leaderboard of a player. - *
+ * Get the position on the power level leaderboard of a player.
* - * @param uuid The name of the player to check + * @param uuid + * The name of the player to check * - * @throws InvalidPlayerException if the given player does not exist in the - * database + * @throws InvalidPlayerException + * if the given player does not exist in the database * * @return the position on the power level leaderboard */ @@ -500,94 +562,116 @@ public int getPlayerRankOverall(UUID uuid) { } /** - * Sets the level of a player in a specific skill type. - *
+ * Sets the level of a player in a specific skill type.
* - * @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 + * @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 + * @throws InvalidSkillException + * if the given skill is not valid */ public void setLevel(Player player, String skillType, int skillLevel) { ExperienceAPI.setLevel(player, skillType, skillLevel); } /** - * Sets the level of an offline player in a specific skill type. - *
+ * Sets the level of an offline player in a specific skill type.
* - * @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 + * @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 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 */ public void setLevelOffline(UUID uuid, String skillType, int skillLevel) { ExperienceAPI.setLevelOffline(uuid, skillType, skillLevel); } /** - * Sets the XP of a player in a specific skill type. - *
+ * Sets the XP of a player in a specific skill type.
* - * @param player The player to set the XP of - * @param skillType The skill to set the XP for - * @param newValue The value to set the XP to + * @param 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 - * @throws UnsupportedOperationException if the given skill is a child skill + * @throws InvalidSkillException + * if the given skill is not valid + * @throws UnsupportedOperationException + * if the given skill is a child skill */ public void setXP(Player player, String skillType, int newValue) { ExperienceAPI.setXP(player, skillType, newValue); } /** - * Sets the XP of an offline player in a specific skill type. - *
+ * Sets the XP of an offline player in a specific skill type.
* - * @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 + * @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 - * @throws UnsupportedOperationException if the given skill is a child skill + * @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 void setXPOffline(UUID uuid, String skillType, int newValue) { ExperienceAPI.setXPOffline(uuid, skillType, newValue); } /** - * Removes XP from a player in a specific skill type. - *
+ * Removes XP from a player in a specific skill type.
* - * @param player The player to change the XP of - * @param skillType The skill to change the XP for - * @param xp The amount of XP to remove + * @param 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 - * @throws UnsupportedOperationException if the given skill is a child skill + * @throws InvalidSkillException + * if the given skill is not valid + * @throws UnsupportedOperationException + * if the given skill is a child skill */ public void removeXP(Player player, String skillType, int xp) { ExperienceAPI.removeXP(player, skillType, xp); } /** - * Removes XP from an offline player in a specific skill type. - *
+ * Removes XP from an offline player in a specific skill type.
* - * @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 + * @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 - * @throws UnsupportedOperationException if the given skill is a child skill + * @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 void removeXPOffline(UUID uuid, String skillType, int xp) { ExperienceAPI.removeXPOffline(uuid, skillType, xp); @@ -595,12 +679,13 @@ public void removeXPOffline(UUID uuid, String skillType, int xp) { /** * Check how much XP is needed for a specific level with the selected level - * curve. - *
+ * curve.
* - * @param level The level to get the amount of XP for + * @param level + * The level to get the amount of XP for * - * @throws InvalidFormulaTypeException if the given formulaType is not valid + * @throws InvalidFormulaTypeException + * if the given formulaType is not valid */ public int getXpNeededToLevel(int level) { return ExperienceAPI.getXpNeededToLevel(level); @@ -608,13 +693,15 @@ public int getXpNeededToLevel(int level) { /** * Check how much XP is needed for a specific level with the provided level - * curve. - *
+ * curve.
* - * @param level The level to get the amount of XP for - * @param formulaType The formula type 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 + * @throws InvalidFormulaTypeException + * if the given formulaType is not valid */ public int getXpNeededToLevel(int level, String formulaType) { return ExperienceAPI.getXpNeededToLevel(level, formulaType); @@ -625,7 +712,8 @@ public int getXpNeededToLevel(int level, String formulaType) { /** * Checks whether Berserk is enabled for a specific player. * - * @param player Player to check for + * @param player + * Player to check for * @return true if enabled; false otherwise. */ public boolean berserkEnabled(Player player) { @@ -635,7 +723,8 @@ public boolean berserkEnabled(Player player) { /** * Checks whether GigaDrill Breaker is enabled for a specific player. * - * @param player Player to check for + * @param player + * Player to check for * @return true if enabled; false otherwise. */ public boolean gigaDrillBreakerEnabled(Player player) { @@ -645,7 +734,8 @@ public boolean gigaDrillBreakerEnabled(Player player) { /** * Checks whether Green Terra is enabled for a specific player. * - * @param player Player to check for + * @param player + * Player to check for * @return true if enabled; false otherwise. */ public boolean greenTerraEnabled(Player player) { @@ -655,7 +745,8 @@ public boolean greenTerraEnabled(Player player) { /** * Checks whether Serrated Strikes is enabled for a specific player. * - * @param player Player to check for + * @param player + * Player to check for * @return true if enabled; false otherwise. */ public boolean serratedStrikesEnabled(Player player) { @@ -665,7 +756,8 @@ public boolean serratedStrikesEnabled(Player player) { /** * Checks whether Skull Splitter is enabled for a specific player. * - * @param player Player to check for + * @param player + * Player to check for * @return true if enabled; false otherwise. */ public boolean skullSplitterEnabled(Player player) { @@ -675,7 +767,8 @@ public boolean skullSplitterEnabled(Player player) { /** * Checks whether Super Breaker is enabled for a specific player. * - * @param player Player to check for + * @param player + * Player to check for * @return true if enabled; false otherwise. */ public boolean superBreakerEnabled(Player player) { @@ -685,7 +778,8 @@ public boolean superBreakerEnabled(Player player) { /** * Checks whether Tree Feller is enabled for a specific player. * - * @param player Player to check for + * @param player + * Player to check for * @return true if enabled; false otherwise. */ public boolean treeFellerEnabled(Player player) { @@ -695,7 +789,8 @@ public boolean treeFellerEnabled(Player player) { /** * Checks whether any special ability is enabled for a specific player. * - * @param player Player to check for + * @param player + * Player to check for * @return true if enabled; false otherwise. */ public boolean isAnyAbilityEnabled(Player player) { @@ -706,7 +801,8 @@ public boolean isAnyAbilityEnabled(Player player) { * Resets all ability cooldowns for a player so he/she can use it again * immediately. * - * @param player Player to reset cooldowns for. + * @param player + * Player to reset cooldowns for. */ public void resetCooldowns(Player player) { AbilityAPI.resetCooldowns(player); @@ -715,8 +811,10 @@ public void resetCooldowns(Player player) { /** * Set the cooldown of Berserk of a specific player. * - * @param player Player to set the cooldown for. - * @param cooldown Cooldown (in seconds) for the ability. + * @param player + * Player to set the cooldown for. + * @param cooldown + * Cooldown (in seconds) for the ability. */ public void setBerserkCooldown(Player player, long cooldown) { AbilityAPI.setBerserkCooldown(player, cooldown); @@ -725,8 +823,10 @@ public void setBerserkCooldown(Player player, long cooldown) { /** * Set the cooldown of GigaDrill Breaker of a specific player. * - * @param player Player to set the cooldown for. - * @param cooldown Cooldown (in seconds) for the ability. + * @param player + * Player to set the cooldown for. + * @param cooldown + * Cooldown (in seconds) for the ability. */ public void setGigaDrillBreakerCooldown(Player player, long cooldown) { AbilityAPI.setGigaDrillBreakerCooldown(player, cooldown); @@ -735,8 +835,10 @@ public void setGigaDrillBreakerCooldown(Player player, long cooldown) { /** * Set the cooldown of Green Terra of a specific player. * - * @param player Player to set the cooldown for. - * @param cooldown Cooldown (in seconds) for the ability. + * @param player + * Player to set the cooldown for. + * @param cooldown + * Cooldown (in seconds) for the ability. */ public void setGreenTerraCooldown(Player player, long cooldown) { AbilityAPI.setGreenTerraCooldown(player, cooldown); @@ -745,8 +847,10 @@ public void setGreenTerraCooldown(Player player, long cooldown) { /** * Set the cooldown of Serrated Strikes of a specific player. * - * @param player Player to set the cooldown for. - * @param cooldown Cooldown (in seconds) for the ability. + * @param player + * Player to set the cooldown for. + * @param cooldown + * Cooldown (in seconds) for the ability. */ public void setSerratedStrikesCooldown(Player player, long cooldown) { AbilityAPI.setSerratedStrikesCooldown(player, cooldown); @@ -755,8 +859,10 @@ public void setSerratedStrikesCooldown(Player player, long cooldown) { /** * Set the cooldown of Skull Splitter of a specific player. * - * @param player Player to set the cooldown for. - * @param cooldown Cooldown (in seconds) for the ability. + * @param player + * Player to set the cooldown for. + * @param cooldown + * Cooldown (in seconds) for the ability. */ public void setSkullSplitterCooldown(Player player, long cooldown) { AbilityAPI.setSkullSplitterCooldown(player, cooldown); @@ -765,8 +871,10 @@ public void setSkullSplitterCooldown(Player player, long cooldown) { /** * Set the cooldown of Super Breaker of a specific player. * - * @param player Player to set the cooldown for. - * @param cooldown Cooldown (in seconds) for the ability. + * @param player + * Player to set the cooldown for. + * @param cooldown + * Cooldown (in seconds) for the ability. */ public void setSuperBreakerCooldown(Player player, long cooldown) { AbilityAPI.setSuperBreakerCooldown(player, cooldown); @@ -775,8 +883,10 @@ public void setSuperBreakerCooldown(Player player, long cooldown) { /** * Set the cooldown of Tree Feller of a specific player. * - * @param player Player to set the cooldown for. - * @param cooldown Cooldown (in seconds) for the ability. + * @param player + * Player to set the cooldown for. + * @param cooldown + * Cooldown (in seconds) for the ability. */ public void setTreeFellerCooldown(Player player, long cooldown) { AbilityAPI.setTreeFellerCooldown(player, cooldown); @@ -785,7 +895,8 @@ public void setTreeFellerCooldown(Player player, long cooldown) { /** * Checks whether the given entity is bleeding. * - * @param entity Entity to check. + * @param entity + * Entity to check. * @return true if bleeding; false otherwise. */ public boolean isBleeding(LivingEntity entity) { @@ -795,59 +906,68 @@ public boolean isBleeding(LivingEntity entity) { /* ChatAPI below */ /** - * Send a message to all members of a party - *
+ * Send a message to all members of a party
* * - * @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 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 */ - public void sendPartyChat(Plugin plugin, String sender, String displayName, - String party, String message) { + public void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) { ChatAPI.sendPartyChat(plugin, sender, displayName, party, message); } /** - * Send a message to all members of a party - *
+ * Send a message to all members of a party
* * - * @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 + * @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 void sendPartyChat(Plugin plugin, String sender, String party, - String message) { + public void sendPartyChat(Plugin plugin, String sender, String party, String message) { ChatAPI.sendPartyChat(plugin, sender, party, message); } /** - * Send a message to administrators - *
+ * Send a message to administrators
* * - * @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 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 */ - public void sendAdminChat(Plugin plugin, String sender, String displayName, - String message) { + public void sendAdminChat(Plugin plugin, String sender, String displayName, String message) { ChatAPI.sendAdminChat(plugin, sender, displayName, message); } /** - * Send a message to administrators - *
+ * Send a message to administrators
* * - * @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 + * @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 void sendAdminChat(Plugin plugin, String sender, String message) { ChatAPI.sendAdminChat(plugin, sender, message); @@ -856,7 +976,8 @@ public void sendAdminChat(Plugin plugin, String sender, String message) { /** * 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 */ public boolean isUsingPartyChat(Player player) { @@ -866,7 +987,8 @@ public boolean isUsingPartyChat(Player player) { /** * 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 */ public boolean isUsingPartyChat(String playerName) { @@ -876,7 +998,8 @@ public boolean isUsingPartyChat(String playerName) { /** * 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 */ public boolean isUsingAdminChat(Player player) { @@ -886,7 +1009,8 @@ public boolean isUsingAdminChat(Player player) { /** * 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 */ public boolean isUsingAdminChat(String playerName) { @@ -896,7 +1020,8 @@ public boolean isUsingAdminChat(String playerName) { /** * 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 void togglePartyChat(Player player) { ChatAPI.togglePartyChat(player); @@ -905,7 +1030,8 @@ public void togglePartyChat(Player 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 void togglePartyChat(String playerName) { ChatAPI.togglePartyChat(playerName); @@ -914,7 +1040,8 @@ public void togglePartyChat(String playerName) { /** * 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 void toggleAdminChat(Player player) { ChatAPI.toggleAdminChat(player); @@ -923,262 +1050,266 @@ public void toggleAdminChat(Player 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 void toggleAdminChat(String playerName) { ChatAPI.toggleAdminChat(playerName); } - + /* PartyAPI below */ - - /** - * Get the name of the party a player is in. - *
- - * - * @param player The player to check the party name of - * @return the name of the player's party, or null if not in a party - */ - public String getPartyName(Player player) { - return PartyAPI.getPartyName(player); - } - - /** - * Checks if a player is in a party. - *
- - * - * @param player The player to check - * @return true if the player is in a party, false otherwise - */ - public boolean inParty(Player player) { - return PartyAPI.inParty(player); - } - - /** - * Check if two players are in the same party. - *
- - * - * @param playera The first player to check - * @param playerb The second player to check - * @return true if the two players are in the same party, false otherwise - */ - public boolean inSameParty(Player playera, Player playerb) { - return PartyAPI.inSameParty(playera, playerb); - } - - /** - * Get a list of all current parties. - *
- - * - * @return the list of parties. - */ - public List getParties() { - return PartyAPI.getParties(); - } - - /** - * Add a player to a party. - *
- - * - * @param player The player to add to the party - * @param partyName The party to add the player to - */ - public void addToParty(Player player, String partyName) { - PartyAPI.addToParty(player, partyName); - } - - /** - * Remove a player from a party. - *
- - * - * @param player The player to remove - */ - public void removeFromParty(Player player) { - PartyAPI.removeFromParty(player); - } - - /** - * Get the leader of a party. - *
- - * - * @param partyName The party name - * @return the leader of the party - */ - public String getPartyLeader(String partyName) { - return PartyAPI.getPartyLeader(partyName); - } - - /** - * Set the leader of a party. - *
- * @deprecated Unknown reason. - * - * @param partyName The name of the party to set the leader of - * @param playerName The playerName to set as leader - */ - @Deprecated - public void setPartyLeader(String partyName, String playerName) { - PartyAPI.setPartyLeader(partyName, playerName); - } - - /** - * Get a list of all players in this player's party. - *
- @deprecated Unknown reason. - * - * @param player The player to check - * @return all the players in the player's party - */ - @Deprecated - public List getOnlineAndOfflineMembers(Player player) { - return PartyAPI.getOnlineAndOfflineMembers(player); - } - - /** - * Get a list of all player names in this player's party. - *
- @deprecated Unknown reason. - * - * @param player The player to check - * @return all the player names in the player's party - */ - @Deprecated - public LinkedHashSet getMembers(Player player) { - return PartyAPI.getMembers(player); - } - - /** - * Get a list of all player names and uuids in this player's party. - *
- - * - * @param player The player to check - * @return all the player names and uuids in the player's party - */ - public LinkedHashMap getMembersMap(Player player) { - return PartyAPI.getMembersMap(player); - } - - /** - * Get a list of all online players in this party. - *
- - * - * @param partyName The party to check - * @return all online players in this party - */ - public List getOnlineMembers(String partyName) { - return PartyAPI.getOnlineMembers(partyName); - } - - /** - * Get a list of all online players in this player's party. - *
- - * - * @param player The player to check - * @return all online players in the player's party - */ - public List getOnlineMembers(Player player) { - return PartyAPI.getOnlineMembers(player); - } - - /** - * Whether the given party has an ally. - * @param partyName Party to check. - * @return true if the party has an ally; false otherwise. - */ - public boolean hasAlly(String partyName) { - return PartyAPI.hasAlly(partyName); - } - - /** - * Get the ally of a party. - * @param partyName Party to get the ally from. - * @return Name of the ally or null if not found. - */ - public String getAllyName(String partyName) { - return PartyAPI.getAllyName(partyName); - } - - /* SkillAPI below */ - - /** - * Returns a list of strings with mcMMO's skills - * This includes parent and child skills - *
- - * - * @return a list of strings with valid skill names - */ - public List getSkills() { - return SkillAPI.getSkills(); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes parent skills - *
- - * - * @return a list of strings with valid skill names - */ - public List getNonChildSkills() { - return SkillAPI.getNonChildSkills(); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes child skills - *
- - * - * @return a list of strings with valid skill names - */ - public List getChildSkills() { - return SkillAPI.getChildSkills(); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes combat skills - *
- - * - * @return a list of strings with valid skill names - */ - public List getCombatSkills() { - return SkillAPI.getCombatSkills(); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes gathering skills - *
- - * - * @return a list of strings with valid skill names - */ - public List getGatheringSkills() { - return SkillAPI.getGatheringSkills(); - } - - /** - * Returns a list of strings with mcMMO's skills - * This only includes misc skills - *
- - * - * @return a list of strings with valid skill names - */ - public List getMiscSkills() { - return SkillAPI.getMiscSkills(); - } + + /** + * Get the name of the party a player is in.
+ * + * + * @param player + * The player to check the party name of + * @return the name of the player's party, or null if not in a party + */ + public String getPartyName(Player player) { + return PartyAPI.getPartyName(player); + } + + /** + * Checks if a player is in a party.
+ * + * + * @param player + * The player to check + * @return true if the player is in a party, false otherwise + */ + public boolean inParty(Player player) { + return PartyAPI.inParty(player); + } + + /** + * Check if two players are in the same party.
+ * + * + * @param playera + * The first player to check + * @param playerb + * The second player to check + * @return true if the two players are in the same party, false otherwise + */ + public boolean inSameParty(Player playera, Player playerb) { + return PartyAPI.inSameParty(playera, playerb); + } + + /** + * Get a list of all current parties.
+ * + * + * @return the list of parties. + */ + public List getParties() { + return PartyAPI.getParties(); + } + + /** + * Add a player to a party.
+ * + * + * @param player + * The player to add to the party + * @param partyName + * The party to add the player to + */ + public void addToParty(Player player, String partyName) { + PartyAPI.addToParty(player, partyName); + } + + /** + * Remove a player from a party.
+ * + * + * @param player + * The player to remove + */ + public void removeFromParty(Player player) { + PartyAPI.removeFromParty(player); + } + + /** + * Get the leader of a party.
+ * + * + * @param partyName + * The party name + * @return the leader of the party + */ + public String getPartyLeader(String partyName) { + return PartyAPI.getPartyLeader(partyName); + } + + /** + * Set the leader of a party.
+ * + * @deprecated Unknown reason. + * + * @param partyName + * The name of the party to set the leader of + * @param playerName + * The playerName to set as leader + */ + @Deprecated + public void setPartyLeader(String partyName, String playerName) { + PartyAPI.setPartyLeader(partyName, playerName); + } + + /** + * Get a list of all players in this player's party.
+ * + * @deprecated Unknown reason. + * + * @param player + * The player to check + * @return all the players in the player's party + */ + @Deprecated + public List getOnlineAndOfflineMembers(Player player) { + return PartyAPI.getOnlineAndOfflineMembers(player); + } + + /** + * Get a list of all player names in this player's party.
+ * + * @deprecated Unknown reason. + * + * @param player + * The player to check + * @return all the player names in the player's party + */ + @Deprecated + public LinkedHashSet getMembers(Player player) { + return PartyAPI.getMembers(player); + } + + /** + * Get a list of all player names and uuids in this player's party.
+ * + * + * @param player + * The player to check + * @return all the player names and uuids in the player's party + */ + public LinkedHashMap getMembersMap(Player player) { + return PartyAPI.getMembersMap(player); + } + + /** + * Get a list of all online players in this party.
+ * + * + * @param partyName + * The party to check + * @return all online players in this party + */ + public List getOnlineMembers(String partyName) { + return PartyAPI.getOnlineMembers(partyName); + } + + /** + * Get a list of all online players in this player's party.
+ * + * + * @param player + * The player to check + * @return all online players in the player's party + */ + public List getOnlineMembers(Player player) { + return PartyAPI.getOnlineMembers(player); + } + + /** + * Whether the given party has an ally. + * + * @param partyName + * Party to check. + * @return true if the party has an ally; false otherwise. + */ + public boolean hasAlly(String partyName) { + return PartyAPI.hasAlly(partyName); + } + + /** + * Get the ally of a party. + * + * @param partyName + * Party to get the ally from. + * @return Name of the ally or null if not found. + */ + public String getAllyName(String partyName) { + return PartyAPI.getAllyName(partyName); + } + + /* SkillAPI below */ + + /** + * Returns a list of strings with mcMMO's skills This includes parent and + * child skills
+ * + * + * @return a list of strings with valid skill names + */ + public List getSkills() { + return SkillAPI.getSkills(); + } + + /** + * Returns a list of strings with mcMMO's skills This only includes parent + * skills
+ * + * + * @return a list of strings with valid skill names + */ + public List getNonChildSkills() { + return SkillAPI.getNonChildSkills(); + } + + /** + * Returns a list of strings with mcMMO's skills This only includes child + * skills
+ * + * + * @return a list of strings with valid skill names + */ + public List getChildSkills() { + return SkillAPI.getChildSkills(); + } + + /** + * Returns a list of strings with mcMMO's skills This only includes combat + * skills
+ * + * + * @return a list of strings with valid skill names + */ + public List getCombatSkills() { + return SkillAPI.getCombatSkills(); + } + + /** + * Returns a list of strings with mcMMO's skills This only includes + * gathering skills
+ * + * + * @return a list of strings with valid skill names + */ + public List getGatheringSkills() { + return SkillAPI.getGatheringSkills(); + } + + /** + * Returns a list of strings with mcMMO's skills This only includes misc + * skills
+ * + * + * @return a list of strings with valid skill names + */ + public List getMiscSkills() { + return SkillAPI.getMiscSkills(); + } } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/OnTimeHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/OnTimeHook.java index 16f042e..c39f39a 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/OnTimeHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/OnTimeHook.java @@ -10,8 +10,8 @@ import me.staartvin.plugins.pluginlibrary.Library; /** - * OnTime library, link. + * OnTime library, + * link. *

* Date created: 15:35:44 14 aug. 2015 * @@ -20,23 +20,27 @@ */ public class OnTimeHook extends LibraryHook { - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable() */ @Override public boolean isAvailable() { // TODO Auto-generated method stub - return this.getPlugin().getServer().getPluginManager() - .isPluginEnabled(Library.ONTIME.getPluginName()); + return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.ONTIME.getPluginName()); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook() */ @Override public boolean hook() { - // All api calls are done static, so there is no need to get the plugin class. + // All api calls are done static, so there is no need to get the plugin + // class. // We only check if the plugin is available. return isAvailable(); } @@ -44,7 +48,8 @@ public boolean hook() { /** * Whether or not the given player is stored by OnTime. * - * @param playerName Name of the player to check. + * @param playerName + * Name of the player to check. * @return true if the player is stored; false otherwise. */ public boolean isPlayerStored(String playerName) { @@ -100,8 +105,10 @@ public boolean isPlayerStored(String playerName) { * MONTHREFER: Number of referrals made by the player in the current * month. * - * @param playerName Name of the player to get data for. - * @param dataType Type of data, see above. + * @param playerName + * Name of the player to get data for. + * @param dataType + * Type of data, see above. * @return long value corresponding to the data type, -1 if no data was * found or the player was invalid. */ @@ -119,27 +126,32 @@ public long getPlayerData(String playerName, String dataType) { } /** - * Gets a leaderboard-like map containing all top scores of players for the given data type. - *
All data types that are specified at {@link #getPlayerData(String, String)} can be used, except LASTLOGIN and LASTVOTE. + * Gets a leaderboard-like map containing all top scores of players for the + * given data type.
+ * All data types that are specified at + * {@link #getPlayerData(String, String)} can be used, except LASTLOGIN and + * LASTVOTE. * - * @param dataType Data type to get the leaderboard for. - * @return a map containing the names of the players and their values; null when data type was invalid. + * @param dataType + * Data type to get the leaderboard for. + * @return a map containing the names of the players and their values; null + * when data type was invalid. */ public Map getTopData(String dataType) { HashMap leaderboard = new HashMap(); - + OnTimeAPI.data data = OnTimeAPI.data.valueOf(dataType.toUpperCase()); - + if (data == null) { return null; } - + topData[] topData = DataIO.getTopData(data); - - for (topData td: topData) { + + for (topData td : topData) { leaderboard.put(td.getPlayerName(), td.getValue()); } - + return leaderboard; } } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/RoyalCommandsHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/RoyalCommandsHook.java index afc1032..0534972 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/RoyalCommandsHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/RoyalCommandsHook.java @@ -9,8 +9,8 @@ import me.staartvin.plugins.pluginlibrary.Library; /** - * RoyalCommands library, link. + * RoyalCommands library, + * link. *

* Date created: 16:46:20 14 aug. 2015 * @@ -21,16 +21,19 @@ public class RoyalCommandsHook extends LibraryHook { private RoyalCommands api; - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable() */ @Override public boolean isAvailable() { - return this.getPlugin().getServer().getPluginManager() - .isPluginEnabled(Library.ROYALCOMMANDS.getPluginName()); + return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.ROYALCOMMANDS.getPluginName()); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook() */ @Override @@ -43,44 +46,57 @@ public boolean hook() { return api != null; } - + public void doSOmething() { - + } - + /** * Whether or not the given player is afk according to RoyalCommands. - * @param player Player to check. + * + * @param player + * Player to check. * @return true if the player is afk; false otherwise. */ public boolean isAFK(Player player) { return api.getAPI().getPlayerAPI().isAfk(player); } - + /** - * Gets the display name of the given player. - * @param player Player to get the display name of. - * @return The display name of the player; when no display name was found, the default name of the player. + * Gets the display name of the given player. + * + * @param player + * Player to get the display name of. + * @return The display name of the player; when no display name was found, + * the default name of the player. */ public String getDisplayName(Player player) { return api.getAPI().getPlayerAPI().getDisplayName(player); } - + /** * Gets the offline inventory of a player on a given world. - * @param player Offline player to get the inventory of. - * @param worldName Name of the world to get the inventory on. - * @return A {@link Inventory} representing the inventory of the offline player on that world; null if any errors occured. + * + * @param player + * Offline player to get the inventory of. + * @param worldName + * Name of the world to get the inventory on. + * @return A {@link Inventory} representing the inventory of the offline + * player on that world; null if any errors occured. */ public Inventory getOfflineInventory(OfflinePlayer player, String worldName) { return WorldManager.il.getOfflinePlayerInventory(player, worldName); } - + /** * Gets the offline inventory (enderchest) of a player on a given world. - * @param player Offline player to get the inventory of. - * @param worldName Name of the world to get the inventory on. - * @return A {@link Inventory} representing the enderchest inventory of the offline player on that world; null if any errors occured. + * + * @param player + * Offline player to get the inventory of. + * @param worldName + * Name of the world to get the inventory on. + * @return A {@link Inventory} representing the enderchest inventory of the + * offline player on that world; null if any errors occured. */ public Inventory getOfflineEnderInventory(OfflinePlayer player, String worldName) { return WorldManager.il.getOfflinePlayerEnderInventory(player, worldName); diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java index 3b8e570..69499db 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java @@ -17,8 +17,8 @@ import nl.lolmewn.stats.bukkit.BukkitMain; /** - * Stats library, link. + * Stats library, + * link. *

* Date created: 16:30:26 12 aug. 2015 * @@ -29,17 +29,20 @@ public class StatsHook extends LibraryHook { private BukkitMain stats; - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable() */ @Override public boolean isAvailable() { // TODO Auto-generated method stub - return this.getPlugin().getServer().getPluginManager() - .isPluginEnabled(Library.STATS.getPluginName()); + return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.STATS.getPluginName()); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook() */ @Override @@ -47,8 +50,7 @@ public boolean hook() { if (!isAvailable()) return false; - stats = (BukkitMain) this.getPlugin().getServer().getPluginManager() - .getPlugin(Library.STATS.getPluginName()); + stats = (BukkitMain) this.getPlugin().getServer().getPluginManager().getPlugin(Library.STATS.getPluginName()); return stats != null; } @@ -57,21 +59,25 @@ public boolean hook() { * Gets the total amount of blocks that are broken by a player with a * certain item id and damage value. *

- * You must specify the UUID of the player and the item id of the block.
+ * You must specify the UUID of the player and the item id of the block. + *
* Damage value and worldName are optional. If you don't want to check for a * block with a damage value, just use -1.
* If you want to check on all worlds, use null as worldName. * - * @param uuid UUID of player. - * @param id Item ID to check for. - * @param damageValue Damage value to check for. (-1 for no damage value) - * @param worldName World to check in. Null for global. + * @param uuid + * UUID of player. + * @param id + * Item ID to check for. + * @param damageValue + * Damage value to check for. (-1 for no damage value) + * @param worldName + * World to check in. Null for global. * @return The amount of blocks a player has broken. */ @SuppressWarnings("deprecation") - public int getBlocksBroken(final UUID uuid, final int id, - final int damageValue, final String worldName) { + public int getBlocksBroken(final UUID uuid, final int id, final int damageValue, final String worldName) { if (!isAvailable()) return 0; @@ -104,8 +110,7 @@ public int getBlocksBroken(final UUID uuid, final int id, // Check correct id if (metadata.containsKey("name")) { - Material material = Material.matchMaterial(metadata.get("name") - .toString()); + Material material = Material.matchMaterial(metadata.get("name").toString()); if (material.getId() != id) continue; @@ -116,26 +121,30 @@ public int getBlocksBroken(final UUID uuid, final int id, return value; } - + /** * Gets the total amount of blocks that are placed by a player with a * certain item id and damage value. *

- * You must specify the UUID of the player and the item id of the block.
+ * You must specify the UUID of the player and the item id of the block. + *
* Damage value and worldName are optional. If you don't want to check for a * block with a damage value, just use -1.
* If you want to check on all worlds, use null as worldName. * - * @param uuid UUID of player. - * @param id Item ID to check for. - * @param damageValue Damage value to check for. (-1 for no damage value) - * @param worldName World to check in. Null for global. + * @param uuid + * UUID of player. + * @param id + * Item ID to check for. + * @param damageValue + * Damage value to check for. (-1 for no damage value) + * @param worldName + * World to check in. Null for global. * @return The amount of blocks a player has placed. */ @SuppressWarnings("deprecation") - public int getBlocksPlaced(final UUID uuid, final int id, - final int damageValue, final String worldName) { + public int getBlocksPlaced(final UUID uuid, final int id, final int damageValue, final String worldName) { if (!isAvailable()) return 0; @@ -168,8 +177,7 @@ public int getBlocksPlaced(final UUID uuid, final int id, // Check correct id if (metadata.containsKey("name")) { - Material material = Material.matchMaterial(metadata.get("name") - .toString()); + Material material = Material.matchMaterial(metadata.get("name").toString()); if (material.getId() != id) continue; @@ -191,19 +199,24 @@ public EntityType getEntityType(final String entityName) { /** * If there is no method for getting specific data, you can use this one. - *
This is just for generic stats. - *
Most stats can be retrieved with this method: - *
Arrows, Beds entered, Buckets emptied, Buckets filled, Commands done, Damage taken, Eggs thrown, Fish caught, Joins, - * Last join, Last seen, Money, Omnomnom (amount of food eaten), PVP streak, PVP top streak, Playtime, Shears, Teleports, - * Times kicked, Trades, Votes, Words said, Times changed world, XP gained - * - * @param uuid UUID of the player. - * @param statName Name of the stat. - * @param worldName Name of the world, or null for global. + *
+ * This is just for generic stats.
+ * Most stats can be retrieved with this method:
+ * Arrows, Beds entered, Buckets emptied, Buckets filled, Commands done, + * Damage taken, Eggs thrown, Fish caught, Joins, Last join, Last seen, + * Money, Omnomnom (amount of food eaten), PVP streak, PVP top streak, + * Playtime, Shears, Teleports, Times kicked, Trades, Votes, Words said, + * Times changed world, XP gained + * + * @param uuid + * UUID of the player. + * @param statName + * Name of the stat. + * @param worldName + * Name of the world, or null for global. * @return */ - public int getNormalStat(final UUID uuid, final String statName, - final String worldName) { + public int getNormalStat(final UUID uuid, final String statName, final String worldName) { if (!isAvailable()) return 0; @@ -230,12 +243,13 @@ public int getNormalStat(final UUID uuid, final String statName, * Get the stats of a player, a new stat will be created if it didn't exist * yet. * - * @param statName Name of the stat to get - * @param uuid UUID to get the stats of. + * @param statName + * Name of the stat to get + * @param uuid + * UUID to get the stats of. * @return Requested stat of the player */ - public Collection getStatType(final String statName, - final UUID uuid) { + public Collection getStatType(final String statName, final UUID uuid) { if (uuid == null) { return new ArrayList(); @@ -244,9 +258,7 @@ public Collection getStatType(final String statName, StatsHolder holder = stats.getUserManager().getUser(uuid); if (holder == null) { - this.getPlugin().logMessage( - "UUID '" + uuid.toString() - + "' was not found in Stats database!"); + this.getPlugin().logMessage("UUID '" + uuid.toString() + "' was not found in Stats database!"); return new ArrayList(); } @@ -254,18 +266,22 @@ public Collection getStatType(final String statName, Stat stat = stats.getStatManager().getStat(statName); if (stat == null) - throw new IllegalArgumentException("Unknown stat '" + statName - + "'!"); + throw new IllegalArgumentException("Unknown stat '" + statName + "'!"); return holder.getStats(stat); } /** - * Gets the total amount of all broken blocks. It ignores item id or damage value. - *
If you want to check the amount of broken blocks for a certain type of block or with a damage value, - *
use {@link #getBlocksBroken(UUID, int, int, String)}. - * @param uuid UUID of the player. - * @param worldName Name of the world, or null for global. + * Gets the total amount of all broken blocks. It ignores item id or damage + * value.
+ * If you want to check the amount of broken blocks for a certain type of + * block or with a damage value,
+ * use {@link #getBlocksBroken(UUID, int, int, String)}. + * + * @param uuid + * UUID of the player. + * @param worldName + * Name of the world, or null for global. * @return The amount of total blocks broken. */ public int getTotalBlocksBroken(final UUID uuid, final String worldName) { @@ -277,22 +293,26 @@ public int getTotalBlocksBroken(final UUID uuid, final String worldName) { /** * Gets the total amount of blocks a player has moved.
- * You need specify a type of movement: - *
0: By foot - *
1: By boat - *
2: By cart - *
3: By pig - *
4: By pig in cart - *
5: By horse + * You need specify a type of movement:
+ * 0: By foot
+ * 1: By boat
+ * 2: By cart
+ * 3: By pig
+ * 4: By pig in cart
+ * 5: By horse * - *

If you want to check on all worlds, use null as worldName. - * @param uuid UUID of the player to check - * @param type Type of movement - * @param worldName Name of world, null for global + *

+ * If you want to check on all worlds, use null as worldName. + * + * @param uuid + * UUID of the player to check + * @param type + * Type of movement + * @param worldName + * Name of world, null for global * @return The amount of blocks moved by a player */ - public int getTotalBlocksMoved(final UUID uuid, final int type, - final String worldName) { + public int getTotalBlocksMoved(final UUID uuid, final int type, final String worldName) { if (!isAvailable()) return 0; @@ -312,8 +332,7 @@ public int getTotalBlocksMoved(final UUID uuid, final int type, continue; } - if (metadata.containsKey("type") - && (Integer) metadata.get("type") != type) + if (metadata.containsKey("type") && (Integer) metadata.get("type") != type) continue; value += s.getValue(); @@ -324,11 +343,16 @@ public int getTotalBlocksMoved(final UUID uuid, final int type, } /** - * Gets the total amount of all placed blocks. It ignores item id or damage value. - *
If you want to check the amount of placed blocks for a certain type of block or with a damage value, - *
use {@link #getBlocksPlaced(UUID, int, int, String)}. - * @param uuid UUID of the player. - * @param worldName Name of the world, or null for global. + * Gets the total amount of all placed blocks. It ignores item id or damage + * value.
+ * If you want to check the amount of placed blocks for a certain type of + * block or with a damage value,
+ * use {@link #getBlocksPlaced(UUID, int, int, String)}. + * + * @param uuid + * UUID of the player. + * @param worldName + * Name of the world, or null for global. * @return The amount of total blocks placed. */ public int getTotalBlocksPlaced(final UUID uuid, final String worldName) { @@ -339,16 +363,21 @@ public int getTotalBlocksPlaced(final UUID uuid, final String worldName) { } /** - * Gets the amount of mobs a player has killed. - *
You can specify a mob name. If you don't, it will return the total amount of mob kills. - *
A few special mobs are the 'wither_skeleton', 'charged_creeper', 'spider_jockey', 'chicken_jockey' and 'elder_guardian'. - * @param uuid UUID of the player. - * @param mobName Name of the mob, or null for all mobs. - * @param worldName Name of the world, or null for global. + * Gets the amount of mobs a player has killed.
+ * You can specify a mob name. If you don't, it will return the total amount + * of mob kills.
+ * A few special mobs are the 'wither_skeleton', 'charged_creeper', + * 'spider_jockey', 'chicken_jockey' and 'elder_guardian'. + * + * @param uuid + * UUID of the player. + * @param mobName + * Name of the mob, or null for all mobs. + * @param worldName + * Name of the world, or null for global. * @return The amount of mobs killed a player has killed. */ - public int getMobsKilled(final UUID uuid, final String mobName, - final String worldName) { + public int getMobsKilled(final UUID uuid, final String mobName, final String worldName) { if (!isAvailable()) return 0; @@ -360,27 +389,20 @@ public int getMobsKilled(final UUID uuid, final String mobName, if (mobName != null && !mobName.equals("")) { if (mobName.equalsIgnoreCase("wither_skeleton")) { - return this.getSpecialMobsKilled(uuid, "WITHER SKELETON", - worldName); + return this.getSpecialMobsKilled(uuid, "WITHER SKELETON", worldName); } else if (mobName.equalsIgnoreCase("charged_creeper")) { - return this.getSpecialMobsKilled(uuid, "POWERED CREEPER", - worldName); + return this.getSpecialMobsKilled(uuid, "POWERED CREEPER", worldName); } else if (mobName.equalsIgnoreCase("spider_jockey")) { - return this.getSpecialMobsKilled(uuid, "SPIDER JOCKEY", - worldName); + return this.getSpecialMobsKilled(uuid, "SPIDER JOCKEY", worldName); } else if (mobName.equalsIgnoreCase("chicken_jockey")) { - return this.getSpecialMobsKilled(uuid, "CHICKEN JOCKEY", - worldName); + return this.getSpecialMobsKilled(uuid, "CHICKEN JOCKEY", worldName); } else if (mobName.equalsIgnoreCase("killer_rabbit")) { - return this.getSpecialMobsKilled(uuid, "KILLER RABBIT", - worldName); + return this.getSpecialMobsKilled(uuid, "KILLER RABBIT", worldName); } else if (mobName.equalsIgnoreCase("elder_guardian")) { - return this.getSpecialMobsKilled(uuid, "ELDER GUARDIAN", - worldName); + return this.getSpecialMobsKilled(uuid, "ELDER GUARDIAN", worldName); } - type = EntityType.valueOf( - mobName.toUpperCase().replaceAll(" ", "_")).toString(); + type = EntityType.valueOf(mobName.toUpperCase().replaceAll(" ", "_")).toString(); } final Collection stat = getStatType(statName, uuid); @@ -397,13 +419,12 @@ public int getMobsKilled(final UUID uuid, final String mobName, continue; } - if (type != null && metadata.containsKey("entityType") - && !metadata.get("entityType").equals(type)) + if (type != null && metadata.containsKey("entityType") && !metadata.get("entityType").equals(type)) continue; - // If no type was given (so any mob can be killed, exclude 'player' kills, as most admins don't see players as a real mob). - if (type == null && metadata.containsKey("entityType") - && metadata.get("entityType").equals("PLAYER")) + // If no type was given (so any mob can be killed, exclude 'player' + // kills, as most admins don't see players as a real mob). + if (type == null && metadata.containsKey("entityType") && metadata.get("entityType").equals("PLAYER")) continue; value += s.getValue(); @@ -436,12 +457,10 @@ private int getSpecialMobsKilled(UUID uuid, String mobName, String worldName) { continue; } - if (metadata.containsKey("entityType") - && !metadata.get("entityType").equals(entityType)) + if (metadata.containsKey("entityType") && !metadata.get("entityType").equals(entityType)) continue; - if (metadata.containsKey("extraType") - && !metadata.get("extraType").equals(extraType)) + if (metadata.containsKey("extraType") && !metadata.get("extraType").equals(extraType)) continue; value += s.getValue(); @@ -450,11 +469,14 @@ private int getSpecialMobsKilled(UUID uuid, String mobName, String worldName) { return value; } - + /** * Gets the amount of players a player has killed. - * @param uuid UUID of the player. - * @param worldName Name of the world, or null for global. + * + * @param uuid + * UUID of the player. + * @param worldName + * Name of the world, or null for global. * @return The amount of players a player has killed. */ public int getPlayersKilled(UUID uuid, String worldName) { @@ -462,16 +484,23 @@ public int getPlayersKilled(UUID uuid, String worldName) { } /** - * Gets the amount of specific food a player has eaten. - *
If you only want to know about the total amount of food eaten, use {@link #getNormalStat(UUID, String, String)} with statName as 'Omnomnom' instead. - *

A list of usable food types can be found here. - * @param uuid UUID of the player. - * @param worldName Name of the world, or null for global. - * @param foodType Type of food. + * Gets the amount of specific food a player has eaten.
+ * If you only want to know about the total amount of food eaten, use + * {@link #getNormalStat(UUID, String, String)} with statName as 'Omnomnom' + * instead. + *

+ * A list of usable food types can be found + * here. + * + * @param uuid + * UUID of the player. + * @param worldName + * Name of the world, or null for global. + * @param foodType + * Type of food. * @return The amount of specific food eaten by a player. */ - public int getFoodEaten(final UUID uuid, final String worldName, - String foodType) { + public int getFoodEaten(final UUID uuid, final String worldName, String foodType) { if (!isAvailable()) return 0; @@ -500,15 +529,15 @@ public int getFoodEaten(final UUID uuid, final String worldName, return value; } - + public void addStat(Stat stat) { stats.getStatManager().addStat(stat); } - + public Stat getStat(String statName) { return stats.getStatManager().getStat(statName); } - + public StatsHolder getStatsHolder(UUID uuid) { return stats.getUserManager().getUser(uuid); } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/UltimateCoreHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/UltimateCoreHook.java index d4ea790..2c7b316 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/UltimateCoreHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/UltimateCoreHook.java @@ -4,28 +4,31 @@ import me.staartvin.plugins.pluginlibrary.Library; /** - * UltimateCore library, link. + * UltimateCore library, + * link. *

- * Date created: 17:30:19 - * 14 aug. 2015 + * Date created: 17:30:19 14 aug. 2015 + * * @author Staartvin * */ public class UltimateCoreHook extends LibraryHook { private UltimateCore api; - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable() */ @Override public boolean isAvailable() { - return this.getPlugin().getServer().getPluginManager() - .isPluginEnabled(Library.ULTIMATECORE.getPluginName()); + return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.ULTIMATECORE.getPluginName()); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook() */ @Override diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/CustomStatsManager.java b/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/CustomStatsManager.java index cf2bd7a..fa74339 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/CustomStatsManager.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/CustomStatsManager.java @@ -23,25 +23,27 @@ public CustomStatsManager(PluginLibrary instance) { } public void registerCustomStats() { - + // Stats is not available if (!plugin.isLibraryLoaded(Library.STATS)) return; - + StatsHook hook = (StatsHook) PluginLibrary.getLibrary(Library.STATS); hook.addStat(new MobKilledStat()); - /*plugin.debugMessage("Registered '" + MobKilledStat.statName - + "' to Stats.");*/ + /* + * plugin.debugMessage("Registered '" + MobKilledStat.statName + + * "' to Stats."); + */ hook.addStat(new FoodEatenStat()); - /*plugin.debugMessage("Registered '" + FoodEatenStat.statName - + "' to Stats.");*/ + /* + * plugin.debugMessage("Registered '" + FoodEatenStat.statName + + * "' to Stats."); + */ // Register listeners - plugin.getServer().getPluginManager() - .registerEvents(new PlayerEatsFoodListener(plugin), plugin); - plugin.getServer().getPluginManager() - .registerEvents(new PlayerKillsMobListener(plugin), plugin); + plugin.getServer().getPluginManager().registerEvents(new PlayerEatsFoodListener(plugin), plugin); + plugin.getServer().getPluginManager().registerEvents(new PlayerKillsMobListener(plugin), plugin); } } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/FoodEatenStat.java b/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/FoodEatenStat.java index 7c14727..8bc1f71 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/FoodEatenStat.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/FoodEatenStat.java @@ -27,8 +27,11 @@ public FoodEatenStat() { data.put("world", DataType.STRING); } - /* (non-Javadoc) - * @see nl.lolmewn.stats.api.stat.Stat#format(nl.lolmewn.stats.api.stat.StatEntry) + /* + * (non-Javadoc) + * + * @see nl.lolmewn.stats.api.stat.Stat#format(nl.lolmewn.stats.api.stat. + * StatEntry) */ @Override public String format(StatEntry arg0) { @@ -36,7 +39,9 @@ public String format(StatEntry arg0) { return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#getDataTypes() */ @Override @@ -45,7 +50,9 @@ public Map getDataTypes() { return data; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#getDescription() */ @Override @@ -54,7 +61,9 @@ public String getDescription() { return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#getName() */ @Override @@ -63,7 +72,9 @@ public String getName() { return statName; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#isEnabled() */ @Override @@ -72,7 +83,9 @@ public boolean isEnabled() { return true; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#setEnabled(boolean) */ @Override diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/MobKilledStat.java b/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/MobKilledStat.java index 8364eae..39dba81 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/MobKilledStat.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/MobKilledStat.java @@ -29,8 +29,11 @@ public MobKilledStat() { data.put("world", DataType.STRING); } - /* (non-Javadoc) - * @see nl.lolmewn.stats.api.stat.Stat#format(nl.lolmewn.stats.api.stat.StatEntry) + /* + * (non-Javadoc) + * + * @see nl.lolmewn.stats.api.stat.Stat#format(nl.lolmewn.stats.api.stat. + * StatEntry) */ @Override public String format(StatEntry arg0) { @@ -38,7 +41,9 @@ public String format(StatEntry arg0) { return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#getDataTypes() */ @Override @@ -47,7 +52,9 @@ public Map getDataTypes() { return data; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#getDescription() */ @Override @@ -56,7 +63,9 @@ public String getDescription() { return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#getName() */ @Override @@ -65,7 +74,9 @@ public String getName() { return statName; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#isEnabled() */ @Override @@ -74,7 +85,9 @@ public boolean isEnabled() { return true; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see nl.lolmewn.stats.api.stat.Stat#setEnabled(boolean) */ @Override diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/factions/PLFaction.java b/src/me/staartvin/plugins/pluginlibrary/hooks/factions/PLFaction.java index 7de5dfd..66b69b7 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/factions/PLFaction.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/factions/PLFaction.java @@ -17,11 +17,12 @@ import com.massivecraft.massivecore.ps.PS; /** - * Represents the {@link com.massivecraft.factions.entity.Faction} class. - *
This class mirroring is used so developers don't have to import the API of Factions. + * Represents the {@link com.massivecraft.factions.entity.Faction} class.
+ * This class mirroring is used so developers don't have to import the API of + * Factions. *

- * Date created: 23:56:42 - * 13 aug. 2015 + * Date created: 23:56:42 13 aug. 2015 + * * @author Staartvin * */ @@ -36,9 +37,11 @@ public PLFaction(com.massivecraft.factions.entity.Faction fac) { } /** - * Gets the name of the faction. - *
When using other API calls, always use {@link #getId()} (where applicable) or {@link #getComparisonName()}. - *
Only use this method when you want to show the name of the faction to a player! + * Gets the name of the faction.
+ * When using other API calls, always use {@link #getId()} (where + * applicable) or {@link #getComparisonName()}.
+ * Only use this method when you want to show the name of the faction to + * a player! * * @return Name of the faction. */ @@ -99,7 +102,8 @@ public Double getPowerBoost() { /** * Sets the name of the faction. * - * @param name New name for the faction. + * @param name + * New name for the faction. */ public void setName(String name) { faction.setName(name); @@ -108,7 +112,8 @@ public void setName(String name) { /** * Sets the description of the faction. * - * @param description Description to set. + * @param description + * Description to set. */ public void setDescription(String description) { faction.setDescription(getDescription()); @@ -117,7 +122,8 @@ public void setDescription(String description) { /** * Sets the MOTD of a faction. * - * @param motd MOTD to set to. + * @param motd + * MOTD to set to. */ public void setMotd(String motd) { faction.setMotd(motd); @@ -126,7 +132,8 @@ public void setMotd(String motd) { /** * Sets the time the faction was created at. * - * @param time Time (in milliseconds) in UNIX timestamp. + * @param time + * Time (in milliseconds) in UNIX timestamp. */ public void setCreatedAt(long time) { faction.setCreatedAtMillis(time); @@ -135,7 +142,8 @@ public void setCreatedAt(long time) { /** * Sets the location of the home of a faction. * - * @param location Location to set the home to. + * @param location + * Location to set the home to. */ public void setHomeLocation(Location location) { faction.setHome(PS.valueOf(location)); @@ -144,7 +152,8 @@ public void setHomeLocation(Location location) { /** * Sets the powerboost of the faction. * - * @param powerBoost Powerboost to set it to. + * @param powerBoost + * Powerboost to set it to. */ public void setPowerBoost(Double powerBoost) { faction.setPowerBoost(powerBoost); @@ -153,13 +162,14 @@ public void setPowerBoost(Double powerBoost) { /** * Gets the boolean value of the flag specified for this faction. * - * @param flagId Name of the flag. You can use: open, monsters, powerloss, - * pvp, friendlyfire, explosions, offlineexplosions, firespread, + * @param flagId + * Name of the flag. You can use: open, monsters, powerloss, pvp, + * friendlyfire, explosions, offlineexplosions, firespread, * endergrief, permanent, peaceful or infpower. * @return true if flag is true; false if faction does not exist or flag is * false. - * @throws NullPointerException If faction does not exist or flagId is - * invalid. + * @throws NullPointerException + * If faction does not exist or flagId is invalid. */ public boolean getFlagValue(String flagId) { // throw new NullPointerException("flagId"); @@ -169,9 +179,11 @@ public boolean getFlagValue(String flagId) { /** * Sets the value of the given flag for a faction. * - * @param flagId Name of the flag. For a list of flags, see + * @param flagId + * Name of the flag. For a list of flags, see * {@link #getFactionFlag(String, String)}. - * @param value Value to set the flag to. + * @param value + * Value to set the flag to. */ public void setFlagValue(String flagId, boolean value) { // throw new NullPointerException("flagId"); @@ -196,7 +208,8 @@ public Set getInvitedPlayerIds() { /** * Checks whether a player is invited or not. * - * @param uuid UUID to check. + * @param uuid + * UUID to check. * @return true if invited; false otherwise. */ public boolean isInvited(UUID uuid) { @@ -215,13 +228,14 @@ public double getPower() { /** * Gets the leader of the faction. * - * @return {@link PLMPlayer} that is the leader of this faction or null if not - * found. + * @return {@link PLMPlayer} that is the leader of this faction or null if + * not found. */ public PLMPlayer getLeader() { - - if (faction.getLeader() == null) return null; - + + if (faction.getLeader() == null) + return null; + return new PLMPlayer(faction.getLeader()); } @@ -249,12 +263,12 @@ public List getChunks() { * Will return a relationship type. This can be ALLY, TRUCE, NEUTRAL and * ENEMY. * - * @param otherFaction Other faction. + * @param otherFaction + * Other faction. * @return A relationship type or null if the other faction was not found. */ public String getRelationWish(PLFaction otherFaction) { - com.massivecraft.factions.entity.Faction otherFac = FactionColl.get() - .get(otherFaction.getId()); + com.massivecraft.factions.entity.Faction otherFac = FactionColl.get().get(otherFaction.getId()); if (otherFac == null) return null; @@ -270,15 +284,18 @@ public String getRelationWish(PLFaction otherFaction) { /** * Sets the relation wish of this faction to another faction.
* For a list of relation types, see {@link #getRelationWish(PLFaction)} - *
NOTE: You can only try to set the relation as a wish, as the other faction has to accept it. - *
There is no setRelation(). + *
+ * NOTE: You can only try to set the relation as a wish, as the other + * faction has to accept it.
+ * There is no setRelation(). * - * @param otherFaction The other faction to set the relation to. - * @param relation Relation type. + * @param otherFaction + * The other faction to set the relation to. + * @param relation + * Relation type. */ public void setRelationWish(PLFaction otherFaction, String relation) { - com.massivecraft.factions.entity.Faction otherFac = FactionColl.get() - .get(otherFaction.getId()); + com.massivecraft.factions.entity.Faction otherFac = FactionColl.get().get(otherFaction.getId()); if (otherFac == null) return; @@ -296,12 +313,12 @@ public void setRelationWish(PLFaction otherFaction, String relation) { * Will return a relationship type. This can be ALLY, TRUCE, NEUTRAL and * ENEMY. * - * @param otherFaction Other faction. + * @param otherFaction + * Other faction. * @return A relationship type or null if the other faction was not found. */ public String getRelationTo(PLFaction otherFaction) { - com.massivecraft.factions.entity.Faction otherFac = FactionColl.get() - .get(otherFaction.getId()); + com.massivecraft.factions.entity.Faction otherFac = FactionColl.get().get(otherFaction.getId()); if (otherFac == null) return null; @@ -334,58 +351,69 @@ public int getLandCount() { /** * Sends a message to all online players of this faction. - * @param message Message to send. + * + * @param message + * Message to send. */ public void sendMessage(String message) { faction.sendMessage(message); } - + /** * Gets the maximum amount of power this faction may have. - * @return maximum power amount or null if it doesn't exist. Can also return 999999 if max power is infinite (due to flag). + * + * @return maximum power amount or null if it doesn't exist. Can also return + * 999999 if max power is infinite (due to flag). */ public Double getPowerMax() { return faction.getPowerMax(); } - + /** * Whether or not this faction is the Wilderness. + * * @return true if the Wilderness; false otherwise. */ public boolean isWilderness() { return faction.isNone(); } - + /** * Whether or not this faction is the Safezone. + * * @return true if the Safezone; false otherwise. */ public boolean isSafezone() { return !faction.getFlag(MFlag.ID_PVP); } - + /** * Whether or not this faction is the Warzone. + * * @return true if the Warzone; false otherwise. */ public boolean isWarzone() { // Faction allows pvp and is not normal return faction.getFlag(MFlag.ID_PVP) && !faction.isNormal(); } - + /** - * Gets the id of this faction. - *
Internally used to reference unique factions. + * Gets the id of this faction.
+ * Internally used to reference unique factions. + * * @return id of the faction. */ public String getId() { return faction.getId(); } - + /** - * Gets the 'comparison name' of the faction. - *
When retrieving the name of the faction via {@link #getName()}, it will also include colour codes. - *
This method will remove those colour codes and is internally used by Factions to reference each seperate Faction. + * Gets the 'comparison name' of the faction.
+ * When retrieving the name of the faction via {@link #getName()}, it will + * also include colour codes.
+ * This method will remove those colour codes and is internally used by + * Factions to reference each seperate Faction. + * * @return Unique name of Faction without colour codes. */ public String getComparisonName() { diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/factions/PLMPlayer.java b/src/me/staartvin/plugins/pluginlibrary/hooks/factions/PLMPlayer.java index ed3cacb..cf53acc 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/factions/PLMPlayer.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/factions/PLMPlayer.java @@ -6,107 +6,126 @@ import com.massivecraft.factions.entity.FactionColl; /** - * Represents the {@link com.massivecraft.factions.entity.MPlayer} class. - *
This class mirroring is used so developers don't have to import the API of Factions. - *
This can either be a console or a real player. You can check with {@link #isConsole()} and {@link #isPlayer()}. + * Represents the {@link com.massivecraft.factions.entity.MPlayer} class.
+ * This class mirroring is used so developers don't have to import the API of + * Factions.
+ * This can either be a console or a real player. You can check with + * {@link #isConsole()} and {@link #isPlayer()}. *

- * Date created: 23:56:36 - * 13 aug. 2015 + * Date created: 23:56:36 13 aug. 2015 + * * @author Staartvin * */ public class PLMPlayer { private final com.massivecraft.factions.entity.MPlayer mPlayer; - + public PLMPlayer(com.massivecraft.factions.entity.MPlayer mPlayer) { if (mPlayer == null) { throw new NullPointerException("MPlayer is null!"); } - + this.mPlayer = mPlayer; } - + /** - * Gets the faction id of the faction that the player is part of. - *
This will never be null. If a player does not belong to a 'human-made' faction, - *
it will return the id of the wilderness, warzone or safezone. - * @return A faction id corresponding to the faction the player is currently in. + * Gets the faction id of the faction that the player is part of.
+ * This will never be null. If a player does not belong to a + * 'human-made' faction,
+ * it will return the id of the wilderness, warzone or safezone. + * + * @return A faction id corresponding to the faction the player is currently + * in. */ public String getFactionId() { return mPlayer.getFactionId(); } - + /** - * Gets the faction the player is part of. - *
This will never be null. See {@link #getFactionId()} for more info. + * Gets the faction the player is part of.
+ * This will never be null. See {@link #getFactionId()} for more + * info. + * * @return The faction a player is part of. */ - public PLFaction getFaction() { + public PLFaction getFaction() { return new PLFaction(mPlayer.getFaction()); } - + /** - * Gets the role of the player in his current faction. - *
This will never be null as the player is always in a faction. See {@link #getFactionId()} for more info. - *
Roles can be LEADER, OFFICER, MEMBER and RECRUIT. + * Gets the role of the player in his current faction.
+ * This will never be null as the player is always in a faction. See + * {@link #getFactionId()} for more info.
+ * Roles can be LEADER, OFFICER, MEMBER and RECRUIT. + * * @return The player's role in the current faction. */ public String getRole() { Rel rel = mPlayer.getRole(); - + return rel.toString(); } - + /** - * Sets the role of a player in his current faction. - *
See {@link #getRole()} for more info about the roles. - * @param role Role type. + * Sets the role of a player in his current faction.
+ * See {@link #getRole()} for more info about the roles. + * + * @param role + * Role type. */ public void setRole(String role) { Rel rel = Rel.valueOf(role); - - if (rel == null) return; - + + if (rel == null) + return; + mPlayer.setRole(rel); } - + /** - * Gets the title of the player in his current faction. - *
The title is just for fun. It's not connected to any game mechanic. + * Gets the title of the player in his current faction.
+ * The title is just for fun. It's not connected to any game mechanic. + * * @return the title of the player. */ public String getTitle() { return mPlayer.getTitle(); } - + /** - * Sets the title of the player in his current faction. - *
The title is just for fun. It's not connected to any game mechanic. - * @param title String to change the title to. + * Sets the title of the player in his current faction.
+ * The title is just for fun. It's not connected to any game mechanic. + * + * @param title + * String to change the title to. */ public void setTitle(String title) { mPlayer.setTitle(title); } - + /** * Gets the power boost of this player. + * * @return Power boost value. */ public double getPowerBoost() { return mPlayer.getPowerBoost(); } - + /** * Sets the power boost of this player. - * @param boost Boost to set it to. + * + * @param boost + * Boost to set it to. */ public void setPowerBoost(double boost) { mPlayer.setPower(boost); } - + /** * Gets the maximum power this player can have. + * * @return Maximum power. */ public double getPowerMax() { @@ -115,14 +134,16 @@ public double getPowerMax() { /** * Gets the minimum power this player can have. + * * @return Minimum power. */ public double getPowerMin() { return mPlayer.getPowerMin(); } - + /** * Gets the amount of power this player gets per hour. + * * @return Amount of power gained per hour. */ public double getPowerPerHour() { @@ -131,149 +152,178 @@ public double getPowerPerHour() { /** * Gets the amount of power this player loses when he dies. + * * @return Amount of power lost on death. */ public double getPowerPerDeath() { return mPlayer.getPowerMin(); } - + /** * Gets the power this player currently has. + * * @return Current power of player. */ public double getPower() { return mPlayer.getPower(); } - + /** * Sets the power this player currently has. - * @param power Amount to change it to. + * + * @param power + * Amount to change it to. */ public void setPower(double power) { mPlayer.setPower(power); } - + /** * Whether this player is using the admin mode of Factions. + * * @return True if using admin mode; false otherwise. */ public boolean isUsingAdminMode() { return mPlayer.isUsingAdminMode(); } - + /** * Sets whether the player is using admin mode. - * @param value Value to set the use of admin mode to. + * + * @param value + * Value to set the use of admin mode to. */ public void setUsingAdminMode(boolean value) { mPlayer.setUsingAdminMode(value); } - + /** * Whether or not this player is in its own territory (land of its faction). + * * @return true if the player is; false otherwise. */ public boolean isInOwnTerritory() { return mPlayer.isInOwnTerritory(); } - + /** - * Whether or not this player is in enemy territory (land of another faction). + * Whether or not this player is in enemy territory (land of another + * faction). + * * @return true if the player is; false otherwise. */ public boolean isInEnemyTerritory() { return mPlayer.isInEnemyTerritory(); } - + /** * Gets the UUID of this player. + * * @return UUID of the player. */ public UUID getUUID() { return mPlayer.getUuid(); } - + /** - * Gets the relation from this player towards another player. - *
The relation types it can return are: LEADER, OFFICER, MEMBER, RECRUIT, ALLY, TRUCE, NEUTRAL and ENEMY. - * @param otherPlayer Other player. + * Gets the relation from this player towards another player.
+ * The relation types it can return are: LEADER, OFFICER, MEMBER, RECRUIT, + * ALLY, TRUCE, NEUTRAL and ENEMY. + * + * @param otherPlayer + * Other player. * @return A relation type or null if the other player was not found. */ public String getRelationTo(PLMPlayer otherPlayer) { - com.massivecraft.factions.entity.MPlayer player = com.massivecraft.factions.entity.MPlayer.get(otherPlayer.getUUID()); - - if (player == null) return null; - + com.massivecraft.factions.entity.MPlayer player = com.massivecraft.factions.entity.MPlayer + .get(otherPlayer.getUUID()); + + if (player == null) + return null; + Rel rel = mPlayer.getRelationTo(player); - - if (rel == null) return null; - + + if (rel == null) + return null; + return rel.toString(); } - + /** - * Gets the relation from this player towards a faction. - *
The relation types it can return are: LEADER, OFFICER, MEMBER, RECRUIT, ALLY, TRUCE, NEUTRAL and ENEMY. - * @param faction A faction. + * Gets the relation from this player towards a faction.
+ * The relation types it can return are: LEADER, OFFICER, MEMBER, RECRUIT, + * ALLY, TRUCE, NEUTRAL and ENEMY. + * + * @param faction + * A faction. * @return A relation type or null if the faction was not found. */ public String getRelationTo(PLFaction faction) { - if (faction == null) return null; - + if (faction == null) + return null; + Rel rel = mPlayer.getRelationTo(FactionColl.get().get(faction.getId())); - - if (rel == null) return null; - + + if (rel == null) + return null; + return rel.toString(); } - + /** * Whether this player is currently auto claiming land for his faction. + * * @return true if he is; false otherwise. */ public boolean isAutoClaiming() { return mPlayer.getAutoClaimFaction() != null; } - + /** - * Whether this player is currently part of a non-default (so no Wilderness, Safezone or Warzone) faction. + * Whether this player is currently part of a non-default (so no Wilderness, + * Safezone or Warzone) faction. + * * @return true if the player is; false otherwise. */ public boolean hasFaction() { return mPlayer.hasFaction(); } - + /** - * Wipes all faction data of this player. - *
Will delete the current faction he's in, his title, his role and sets auto claiming to false. - *
Take caution with this method, I've not tested it. + * Wipes all faction data of this player.
+ * Will delete the current faction he's in, his title, his role and sets + * auto claiming to false.
+ * Take caution with this method, I've not tested it. */ public void resetFactionData() { mPlayer.resetFactionData(); } - + /** * Gets the name of this player. + * * @return Name of the player. */ public String getName() { return mPlayer.getName(); } - + /** * Whether this player is the console. + * * @return true if this player is the console; false otherwise. */ public boolean isConsole() { return mPlayer.isConsole(); } - + /** * Whether this player is the a real player. + * * @return true if this player is a real player; false otherwise. */ public boolean isPlayer() { return mPlayer.isPlayer(); } - + } diff --git a/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerEatsFoodListener.java b/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerEatsFoodListener.java index 683744b..cd43ad6 100644 --- a/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerEatsFoodListener.java +++ b/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerEatsFoodListener.java @@ -52,9 +52,8 @@ public void OnEat(final PlayerItemConsumeEvent event) { StatsHolder holder = hook.getStatsHolder(p.getUniqueId()); - holder.addEntry(stat, new DefaultStatEntry(1, new MetadataPair( - "foodType", foodName), new MetadataPair("world", p.getWorld() - .getName()))); + holder.addEntry(stat, new DefaultStatEntry(1, new MetadataPair("foodType", foodName), + new MetadataPair("world", p.getWorld().getName()))); } diff --git a/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerKillsMobListener.java b/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerKillsMobListener.java index d16b9e3..7e49713 100644 --- a/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerKillsMobListener.java +++ b/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerKillsMobListener.java @@ -49,8 +49,7 @@ public void OnKill(final EntityDeathEvent event) { final Entity e = event.getEntity(); if (e.getLastDamageCause() instanceof EntityDamageByEntityEvent) { - final EntityDamageByEntityEvent nEvent = (EntityDamageByEntityEvent) e - .getLastDamageCause(); + final EntityDamageByEntityEvent nEvent = (EntityDamageByEntityEvent) e.getLastDamageCause(); if (nEvent.getDamager() instanceof Player) { String extraType = null; @@ -99,14 +98,12 @@ public void OnKill(final EntityDeathEvent event) { Stat mobkilled = hook.getStat(MobKilledStat.statName); - StatsHolder holder = hook.getStatsHolder(nEvent.getDamager() - .getUniqueId()); + StatsHolder holder = hook.getStatsHolder(nEvent.getDamager().getUniqueId()); - holder.addEntry(mobkilled, new DefaultStatEntry(1, - new MetadataPair("entityType", e.getType().toString()), - new MetadataPair("extraType", extraType), - new MetadataPair("world", e.getLocation().getWorld() - .getName().toString()))); + holder.addEntry(mobkilled, + new DefaultStatEntry(1, new MetadataPair("entityType", e.getType().toString()), + new MetadataPair("extraType", extraType), + new MetadataPair("world", e.getLocation().getWorld().getName().toString()))); } } } diff --git a/src/me/staartvin/plugins/pluginlibrary/util/Util.java b/src/me/staartvin/plugins/pluginlibrary/util/Util.java index 19ad2ed..53fb307 100644 --- a/src/me/staartvin/plugins/pluginlibrary/util/Util.java +++ b/src/me/staartvin/plugins/pluginlibrary/util/Util.java @@ -6,8 +6,8 @@ /** * Util class *

- * Date created: 17:38:32 - * 12 aug. 2015 + * Date created: 17:38:32 12 aug. 2015 + * * @author Staartvin * */ @@ -16,12 +16,14 @@ public class Util { /** * Get the name of this food item. * - * @param item ItemStack to get the name of. + * @param item + * ItemStack to get the name of. * @return Name of food, or null if not a valid food item. */ public static String getFoodName(ItemStack item) { // Returns null if not a valid food item - // Got Materials from https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html + // Got Materials from + // https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html if (item == null) return null;