- * Date created: 14:12:35 12 aug. 2015 - * - * @author Staartvin - * - */ -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()); - - private String pluginName; - private LibraryHook hook; - - Library(String pluginName, LibraryHook hook) { - this.pluginName = pluginName; - this.hook = hook; - } - - public String getPluginName() { - return pluginName; - } - - public LibraryHook getHook() { - return hook; - } - - /** - * 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) { - for (Library e : Library.values()) { - if (e.getPluginName().equalsIgnoreCase(value)) - return e; - } - - throw new IllegalArgumentException("There is no library called '" + value + "'!"); - } -} +package me.staartvin.plugins.pluginlibrary; + +import me.staartvin.plugins.pluginlibrary.hooks.AFKTerminatorHook; +import me.staartvin.plugins.pluginlibrary.hooks.AutorankHook; +import me.staartvin.plugins.pluginlibrary.hooks.FactionsHook; +import me.staartvin.plugins.pluginlibrary.hooks.LibraryHook; +import me.staartvin.plugins.pluginlibrary.hooks.McMMOHook; +import me.staartvin.plugins.pluginlibrary.hooks.OnTimeHook; +import me.staartvin.plugins.pluginlibrary.hooks.RoyalCommandsHook; +import me.staartvin.plugins.pluginlibrary.hooks.StatsHook; +import me.staartvin.plugins.pluginlibrary.hooks.UltimateCoreHook; + +/** + * This class holds all libraries PluginLibrary has. + *
+ * Date created: 14:12:35 12 aug. 2015 + * + * @author Staartvin + * + */ +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()); + + private String pluginName; + private LibraryHook hook; + + Library(String pluginName, LibraryHook hook) { + this.pluginName = pluginName; + this.hook = hook; + } + + public String getPluginName() { + return pluginName; + } + + public LibraryHook getHook() { + return hook; + } + + /** + * 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) { + for (Library e : Library.values()) { + if (e.getPluginName().equalsIgnoreCase(value)) + return e; + } + + throw new IllegalArgumentException("There is no library called '" + value + "'!"); + } +} diff --git a/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java b/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java index 3331c43..c45d866 100644 --- a/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java +++ b/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java @@ -29,7 +29,6 @@ public void onEnable() { loadedLibraries.clear(); //this is a test - // I'm just one below yours logMessage(ChatColor.GOLD + "***== Loading libraries ==***"); logMessage(ChatColor.GOLD + "***== Loaded " + ChatColor.WHITE + loadLibraries() + ChatColor.GOLD + " libraries! ==***"); diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/AFKTerminatorHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/AFKTerminatorHook.java index 71a319f..2c70508 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/AFKTerminatorHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/AFKTerminatorHook.java @@ -1,88 +1,88 @@ -package me.staartvin.plugins.pluginlibrary.hooks; - -import java.util.UUID; - -import me.edge209.afkTerminator.AfkDetect; -import me.edge209.afkTerminator.AfkDetect.AFKMACHINES; -import me.staartvin.plugins.pluginlibrary.Library; - -/** - * afkTerminator library, link. - *
- * Date created: 16:26:41 14 aug. 2015
- *
- * @author Staartvin
- *
- */
-public class AFKTerminatorHook extends LibraryHook {
-
- /* (non-Javadoc)
- * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable()
- */
- @Override
- public boolean isAvailable() {
- return this.getPlugin().getServer().getPluginManager()
- .isPluginEnabled(Library.AFKTERMINATOR.getPluginName());
- }
-
- /* (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.
- // 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.
- */
- 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.
- */
- 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.
- */
- 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.
- * @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;
-
- return type.toString();
- }
-
-
-
-}
+package me.staartvin.plugins.pluginlibrary.hooks;
+
+import java.util.UUID;
+
+import me.edge209.afkTerminator.AfkDetect;
+import me.edge209.afkTerminator.AfkDetect.AFKMACHINES;
+import me.staartvin.plugins.pluginlibrary.Library;
+
+/**
+ * afkTerminator library, link.
+ *
+ * Date created: 16:26:41 14 aug. 2015
+ *
+ * @author Staartvin
+ *
+ */
+public class AFKTerminatorHook extends LibraryHook {
+
+ /* (non-Javadoc)
+ * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable()
+ */
+ @Override
+ public boolean isAvailable() {
+ return this.getPlugin().getServer().getPluginManager()
+ .isPluginEnabled(Library.AFKTERMINATOR.getPluginName());
+ }
+
+ /* (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.
+ // 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ * @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;
+
+ return type.toString();
+ }
+
+
+
+}
diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/FactionsHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/FactionsHook.java
index ce80d85..0b1d005 100644
--- a/src/me/staartvin/plugins/pluginlibrary/hooks/FactionsHook.java
+++ b/src/me/staartvin/plugins/pluginlibrary/hooks/FactionsHook.java
@@ -1,235 +1,235 @@
-package me.staartvin.plugins.pluginlibrary.hooks;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import me.staartvin.plugins.pluginlibrary.Library;
-import me.staartvin.plugins.pluginlibrary.hooks.factions.Faction;
-
-import org.bukkit.Location;
-
-import com.massivecraft.factions.Factions;
-import com.massivecraft.factions.entity.BoardColl;
-import com.massivecraft.factions.entity.FactionColl;
-import com.massivecraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.ps.PS;
-
-/**
- * Factions, link.
- *
- * Date created: 20:22:17 12 aug. 2015
- *
- * @author Staartvin
- *
- */
-public class FactionsHook extends LibraryHook {
-
- private Factions factions;
-
- /* (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.FACTIONS.getPluginName());
- }
-
- /* (non-Javadoc)
- * @see me.staartvin.plugins.pluginlibrary.LibraryHook#hook()
- */
- @Override
- public boolean hook() {
- // TODO Auto-generated method stub
-
- if (!isAvailable())
- return false;
-
- factions = (Factions) this.getPlugin().getServer().getPluginManager()
- .getPlugin(Library.FACTIONS.getPluginName());
-
- return factions != null;
- }
-
- /* Util methods */
-
- private MPlayer getMPlayer(UUID uuid) {
- return MPlayer.get(uuid);
- }
-
- /* Faction vars */
-
- /**
- * Gets the faction by its name. Use the comparison name, see
- * {@link me.staartvin.plugins.pluginlibrary.hooks.factions.Faction#getComparisonName()}
- * .
- *
- * @param factionName Name of the faction. Without colour codes!
- * @return {@link Faction} or null if no faction found.
- */
- public Faction getFactionByName(String factionName) {
- if (factionName == null)
- return null;
-
- com.massivecraft.factions.entity.Faction fac = FactionColl.get()
- .getByName(factionName);
-
- if (fac == null)
- return null;
-
- return new Faction(fac);
- }
-
- /**
- * Gets the faction a player is in.
- *
- * @param uuid UUID of the player.
- * @return {@link Faction}, null if the player doesn't exist or is not in a
- * faction.
- */
- public Faction getFactionByUUID(UUID uuid) {
- if (uuid == null)
- return null;
-
- MPlayer mPlayer = getMPlayer(uuid);
-
- if (mPlayer == null)
- return null;
-
- com.massivecraft.factions.entity.Faction fac = mPlayer.getFaction();
-
- if (fac == null)
- return null;
-
- return new Faction(fac);
- }
-
- /**
- * Gets a faction by its internal Factions id.
- *
- * @param factionId Id of the faction
- * @return {@link Faction} or null if id is invalid.
- */
- public Faction getFactionById(String factionId) {
- if (factionId == null)
- return null;
-
- if (FactionColl.get().containsId(factionId)) {
- com.massivecraft.factions.entity.Faction fac = FactionColl.get()
- .get(factionId);
-
- if (fac == null)
- return null;
-
- return new Faction(fac);
- }
-
- return null;
- }
-
- /**
- * Gets a list of all factions that currently exist.
- *
- * @return a list of all factions.
- */
- public List
+ * Date created: 20:22:17 12 aug. 2015
+ *
+ * @author Staartvin
+ *
+ */
+public class FactionsHook extends LibraryHook {
+
+ private Factions factions;
+
+ /* (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.FACTIONS.getPluginName());
+ }
+
+ /* (non-Javadoc)
+ * @see me.staartvin.plugins.pluginlibrary.LibraryHook#hook()
+ */
+ @Override
+ public boolean hook() {
+ // TODO Auto-generated method stub
+
+ if (!isAvailable())
+ return false;
+
+ factions = (Factions) this.getPlugin().getServer().getPluginManager()
+ .getPlugin(Library.FACTIONS.getPluginName());
+
+ return factions != null;
+ }
+
+ /* Util methods */
+
+ private MPlayer getMPlayer(UUID uuid) {
+ return MPlayer.get(uuid);
+ }
+
+ /* Faction vars */
+
+ /**
+ * Gets the faction by its name. Use the comparison name, see
+ * {@link me.staartvin.plugins.pluginlibrary.hooks.factions.Faction#getComparisonName()}
+ * .
+ *
+ * @param factionName Name of the faction. Without colour codes!
+ * @return {@link Faction} or null if no faction found.
+ */
+ public Faction getFactionByName(String factionName) {
+ if (factionName == null)
+ return null;
+
+ com.massivecraft.factions.entity.Faction fac = FactionColl.get()
+ .getByName(factionName);
+
+ if (fac == null)
+ return null;
+
+ return new Faction(fac);
+ }
+
+ /**
+ * Gets the faction a player is in.
+ *
+ * @param uuid UUID of the player.
+ * @return {@link Faction}, null if the player doesn't exist or is not in a
+ * faction.
+ */
+ public Faction getFactionByUUID(UUID uuid) {
+ if (uuid == null)
+ return null;
+
+ MPlayer mPlayer = getMPlayer(uuid);
+
+ if (mPlayer == null)
+ return null;
+
+ com.massivecraft.factions.entity.Faction fac = mPlayer.getFaction();
+
+ if (fac == null)
+ return null;
+
+ return new Faction(fac);
+ }
+
+ /**
+ * Gets a faction by its internal Factions id.
+ *
+ * @param factionId Id of the faction
+ * @return {@link Faction} or null if id is invalid.
+ */
+ public Faction getFactionById(String factionId) {
+ if (factionId == null)
+ return null;
+
+ if (FactionColl.get().containsId(factionId)) {
+ com.massivecraft.factions.entity.Faction fac = FactionColl.get()
+ .get(factionId);
+
+ if (fac == null)
+ return null;
+
+ return new Faction(fac);
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets a list of all factions that currently exist.
+ *
+ * @return a list of all factions.
+ */
+ public List
- * Date created: 14:13:45
- * 12 aug. 2015
- * @author Staartvin
- *
- */
-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();
-}
+package me.staartvin.plugins.pluginlibrary.hooks;
+
+import me.staartvin.plugins.pluginlibrary.PluginLibrary;
+
+import org.bukkit.Bukkit;
+
+/**
+ * Represents a hook to another plugin
+ *
+ * Date created: 14:13:45
+ * 12 aug. 2015
+ * @author Staartvin
+ *
+ */
+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 5ee4718..10c0d6d 100644
--- a/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java
+++ b/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java
@@ -1,1184 +1,1184 @@
-package me.staartvin.plugins.pluginlibrary.hooks;
-
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.UUID;
-
-import me.staartvin.plugins.pluginlibrary.Library;
-
-import org.bukkit.OfflinePlayer;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.Plugin;
-
-import com.gmail.nossr50.mcMMO;
-import com.gmail.nossr50.api.AbilityAPI;
-import com.gmail.nossr50.api.ChatAPI;
-import com.gmail.nossr50.api.ExperienceAPI;
-import com.gmail.nossr50.api.PartyAPI;
-import com.gmail.nossr50.api.SkillAPI;
-import com.gmail.nossr50.api.exceptions.InvalidFormulaTypeException;
-import com.gmail.nossr50.api.exceptions.InvalidPlayerException;
-import com.gmail.nossr50.api.exceptions.InvalidSkillException;
-import com.gmail.nossr50.api.exceptions.InvalidXPGainReasonException;
-import com.gmail.nossr50.datatypes.party.Party;
-
-/**
- * mcMMO library, link.
- *
- * Date created: 18:25:13 12 aug. 2015
- *
- * @author Staartvin
- *
- */
-public class McMMOHook extends LibraryHook {
-
- private mcMMO api;
-
- /* (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());
- }
-
- /* (non-Javadoc)
- * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook()
- */
- @Override
- public boolean hook() {
- // TODO Auto-generated method stub
-
- if (!isAvailable())
- return false;
-
- api = (mcMMO) this.getPlugin().getServer().getPluginManager()
- .getPlugin(Library.MCMMO.getPluginName());
-
- return api != null;
- }
-
- /* ExperienceAPI below */
-
- /**
- * Checks whether given string is a valid type of skill suitable for the
- * other API calls in mcMMO.
- *
- *
- * @param skillType String to check.
- * @return true if this is a valid mcMMO skill.
- */
- public boolean isValidSkillType(String skillType) {
- return ExperienceAPI.isValidSkillType(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).)
- *
- *
- * @param skillType the skill to check
- * @return true if this is a valid, non-child mcMMO skill
- */
- public boolean isNonChildSkill(String skillType) {
- return ExperienceAPI.isNonChildSkill(skillType);
- }
-
- /**
- * 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
- *
- * @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) {
- ExperienceAPI.addRawXP(player, skillType, XP, xpGainReason, isUnshared);
- }
-
- /**
- * 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
- *
- * @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) {
- ExperienceAPI.addRawXPOffline(uuid, skillType, XP);
- }
-
- /**
- * 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
- *
- * @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);
- }
-
- /**
- * 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.
- *
- * @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) {
- ExperienceAPI.addMultipliedXP(player, skillType, XP, xpGainReason);
- }
-
- /**
- * 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
- *
- * @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) {
- ExperienceAPI.addMultipliedXPOffline(playerName, skillType, XP);
- }
-
- /**
- * 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
- *
- * @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) {
- ExperienceAPI.addModifiedXPOffline(playerName, skillType, 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) {
- ExperienceAPI.addXP(player, skillType, XP, xpGainReason, isUnshared);
- }
-
- /**
- * 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
- * @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
- */
- 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.
- *
- *
- * @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
- */
- 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.
- *
- *
- * @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
- */
- 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.
- *
- *
- * @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
- */
- public float getOfflineXPRaw(UUID uuid, String skillType) {
- return ExperienceAPI.getOfflineXPRaw(uuid, skillType);
- }
-
- /**
- * 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
- * @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
- */
- public int getXPToNextLevel(Player player, String skillType) {
- return ExperienceAPI.getXPToNextLevel(player, skillType);
- }
-
- /**
- * Get the total amount of XP an offline player needs to reach the next
- * level.
- *
- *
- * @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
- */
- public int getOfflineXPToNextLevel(UUID uuid, String skillType) {
- return ExperienceAPI.getOfflineXPToNextLevel(uuid, skillType);
- }
-
- /**
- * 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
- * @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
- */
- 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.
- *
- *
- * @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
- */
- public float getOfflineXPRemaining(UUID uuid, String skillType) {
- return ExperienceAPI.getOfflineXPRemaining(uuid, skillType);
- }
-
- /**
- * 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
- *
- * @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.
- * .
- *
- * @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
- */
- public void addLevelOffline(UUID uuid, String skillType, int levels) {
- ExperienceAPI.addLevelOffline(uuid, skillType, levels);
- }
-
- /**
- * 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
- * @return the level of a given skill
- *
- * @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.
- *
- *
- * @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
- */
- public int getLevelOffline(UUID uuid, String skillType) {
- return ExperienceAPI.getLevelOffline(uuid, skillType);
- }
-
- /**
- * Gets the power level of a player.
- *
- *
- * @param player The player to get the power level for
- * @return the power level of the player
- */
- public int getPowerLevel(Player player) {
- return ExperienceAPI.getPowerLevel(player);
- }
-
- /**
- * Gets the power level of an offline player.
- *
- *
- * @param uuid The player to get the power level for
- * @return the power level of the player
- *
- * @throws InvalidPlayerException if the given player does not exist in the
- * database
- */
- public int getPowerLevelOffline(UUID uuid) {
- return ExperienceAPI.getPowerLevelOffline(uuid);
- }
-
- /**
- * Get the level cap of a specific skill.
- *
- *
- * @param skillType The skill to get the level cap for
- * @return the level cap of a given skill
- *
- * @throws InvalidSkillException if the given skill is not valid
- */
- public int getLevelCap(String skillType) {
- return ExperienceAPI.getLevelCap(skillType);
- }
-
- /**
- * Get the power level cap.
- *
- *
- * @return the overall power level cap
- */
- public int getPowerLevelCap() {
- return ExperienceAPI.getPowerLevelCap();
- }
-
- /**
- * Get the position on the leaderboard of a player.
- *
- *
- * @param uuid The name of the player to check
- * @param skillType The skill to check
- *
- * @throws InvalidSkillException if the given skill is not valid
- * @throws InvalidPlayerException if the given player does not exist in the
- * database
- * @throws UnsupportedOperationException if the given skill is a child skill
- *
- * @return the position on the leaderboard
- */
- public int getPlayerRankSkill(UUID uuid, String skillType) {
- return ExperienceAPI.getPlayerRankSkill(uuid, skillType);
- }
-
- /**
- * Get the position on the power level leaderboard of a player.
- *
- *
- * @param uuid The name of the player to check
- *
- * @throws InvalidPlayerException if the given player does not exist in the
- * database
- *
- * @return the position on the power level leaderboard
- */
- public int getPlayerRankOverall(UUID uuid) {
- return ExperienceAPI.getPlayerRankOverall(uuid);
- }
-
- /**
- * 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
- *
- * @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.
- *
- *
- * @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
- */
- 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.
- *
- *
- * @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
- */
- 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.
- *
- *
- * @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
- */
- public void setXPOffline(UUID uuid, String skillType, int newValue) {
- ExperienceAPI.setXPOffline(uuid, skillType, newValue);
- }
-
- /**
- * 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
- *
- * @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.
- *
- *
- * @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
- */
- public void removeXPOffline(UUID uuid, String skillType, int xp) {
- ExperienceAPI.removeXPOffline(uuid, skillType, xp);
- }
-
- /**
- * Check how much XP is needed for a specific level with the selected level
- * curve.
- *
- *
- * @param level The level to get the amount of XP for
- *
- * @throws InvalidFormulaTypeException if the given formulaType is not valid
- */
- public int getXpNeededToLevel(int level) {
- return ExperienceAPI.getXpNeededToLevel(level);
- }
-
- /**
- * Check how much XP is needed for a specific level with the provided level
- * curve.
- *
- *
- * @param level The level to get the amount of XP for
- * @param formulaType The formula type to get the amount of XP for
- *
- * @throws InvalidFormulaTypeException if the given formulaType is not valid
- */
- public int getXpNeededToLevel(int level, String formulaType) {
- return ExperienceAPI.getXpNeededToLevel(level, formulaType);
- }
-
- /* AbilityAPI below */
-
- /**
- * Checks whether Berserk is enabled for a specific player.
- *
- * @param player Player to check for
- * @return true if enabled; false otherwise.
- */
- public boolean berserkEnabled(Player player) {
- return AbilityAPI.berserkEnabled(player);
- }
-
- /**
- * Checks whether GigaDrill Breaker is enabled for a specific player.
- *
- * @param player Player to check for
- * @return true if enabled; false otherwise.
- */
- public boolean gigaDrillBreakerEnabled(Player player) {
- return AbilityAPI.gigaDrillBreakerEnabled(player);
- }
-
- /**
- * Checks whether Green Terra is enabled for a specific player.
- *
- * @param player Player to check for
- * @return true if enabled; false otherwise.
- */
- public boolean greenTerraEnabled(Player player) {
- return AbilityAPI.greenTerraEnabled(player);
- }
-
- /**
- * Checks whether Serrated Strikes is enabled for a specific player.
- *
- * @param player Player to check for
- * @return true if enabled; false otherwise.
- */
- public boolean serratedStrikesEnabled(Player player) {
- return AbilityAPI.serratedStrikesEnabled(player);
- }
-
- /**
- * Checks whether Skull Splitter is enabled for a specific player.
- *
- * @param player Player to check for
- * @return true if enabled; false otherwise.
- */
- public boolean skullSplitterEnabled(Player player) {
- return AbilityAPI.skullSplitterEnabled(player);
- }
-
- /**
- * Checks whether Super Breaker is enabled for a specific player.
- *
- * @param player Player to check for
- * @return true if enabled; false otherwise.
- */
- public boolean superBreakerEnabled(Player player) {
- return AbilityAPI.superBreakerEnabled(player);
- }
-
- /**
- * Checks whether Tree Feller is enabled for a specific player.
- *
- * @param player Player to check for
- * @return true if enabled; false otherwise.
- */
- public boolean treeFellerEnabled(Player player) {
- return AbilityAPI.treeFellerEnabled(player);
- }
-
- /**
- * Checks whether any special ability is enabled for a specific player.
- *
- * @param player Player to check for
- * @return true if enabled; false otherwise.
- */
- public boolean isAnyAbilityEnabled(Player player) {
- return AbilityAPI.isAnyAbilityEnabled(player);
- }
-
- /**
- * Resets all ability cooldowns for a player so he/she can use it again
- * immediately.
- *
- * @param player Player to reset cooldowns for.
- */
- public void resetCooldowns(Player player) {
- AbilityAPI.resetCooldowns(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.
- */
- public void setBerserkCooldown(Player player, long cooldown) {
- AbilityAPI.setBerserkCooldown(player, 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.
- */
- public void setGigaDrillBreakerCooldown(Player player, long cooldown) {
- AbilityAPI.setGigaDrillBreakerCooldown(player, 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.
- */
- public void setGreenTerraCooldown(Player player, long cooldown) {
- AbilityAPI.setGreenTerraCooldown(player, 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.
- */
- public void setSerratedStrikesCooldown(Player player, long cooldown) {
- AbilityAPI.setSerratedStrikesCooldown(player, 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.
- */
- public void setSkullSplitterCooldown(Player player, long cooldown) {
- AbilityAPI.setSkullSplitterCooldown(player, 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.
- */
- public void setSuperBreakerCooldown(Player player, long cooldown) {
- AbilityAPI.setSuperBreakerCooldown(player, 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.
- */
- public void setTreeFellerCooldown(Player player, long cooldown) {
- AbilityAPI.setTreeFellerCooldown(player, cooldown);
- }
-
- /**
- * Checks whether the given entity is bleeding.
- *
- * @param entity Entity to check.
- * @return true if bleeding; false otherwise.
- */
- public boolean isBleeding(LivingEntity entity) {
- return AbilityAPI.isBleeding(entity);
- }
-
- /* ChatAPI below */
-
- /**
- * 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
- */
- 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
- *
- *
- *
- * @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) {
- ChatAPI.sendPartyChat(plugin, sender, party, message);
- }
-
- /**
- * 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
- */
- public void sendAdminChat(Plugin plugin, String sender, String displayName,
- String message) {
- ChatAPI.sendAdminChat(plugin, sender, displayName, message);
- }
-
- /**
- * 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
- */
- public void sendAdminChat(Plugin plugin, String sender, String message) {
- ChatAPI.sendAdminChat(plugin, sender, message);
- }
-
- /**
- * Check if a player is currently talking in party chat.
- *
- * @param player The player to check
- * @return true if the player is using party chat, false otherwise
- */
- public boolean isUsingPartyChat(Player player) {
- return ChatAPI.isUsingPartyChat(player);
- }
-
- /**
- * Check if a player is currently talking in party chat.
- *
- * @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) {
- return ChatAPI.isUsingPartyChat(playerName);
- }
-
- /**
- * Check if a player is currently talking in admin chat.
- *
- * @param player The player to check
- * @return true if the player is using admin chat, false otherwise
- */
- public boolean isUsingAdminChat(Player player) {
- return ChatAPI.isUsingAdminChat(player);
- }
-
- /**
- * Check if a player is currently talking in admin chat.
- *
- * @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) {
- return ChatAPI.isUsingAdminChat(playerName);
- }
-
- /**
- * Toggle the party chat mode of a player.
- *
- * @param player The player to toggle party chat on.
- */
- public void togglePartyChat(Player player) {
- ChatAPI.togglePartyChat(player);
- }
-
- /**
- * Toggle the party chat mode of a player.
- *
- * @param playerName The name of the player to toggle party chat on.
- */
- public void togglePartyChat(String playerName) {
- ChatAPI.togglePartyChat(playerName);
- }
-
- /**
- * Toggle the admin chat mode of a player.
- *
- * @param player The player to toggle admin chat on.
- */
- public void toggleAdminChat(Player player) {
- ChatAPI.toggleAdminChat(player);
- }
-
- /**
- * Toggle the admin chat mode of a player.
- *
- * @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
+ * Date created: 18:25:13 12 aug. 2015
+ *
+ * @author Staartvin
+ *
+ */
+public class McMMOHook extends LibraryHook {
+
+ private mcMMO api;
+
+ /* (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());
+ }
+
+ /* (non-Javadoc)
+ * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook()
+ */
+ @Override
+ public boolean hook() {
+ // TODO Auto-generated method stub
+
+ if (!isAvailable())
+ return false;
+
+ api = (mcMMO) this.getPlugin().getServer().getPluginManager()
+ .getPlugin(Library.MCMMO.getPluginName());
+
+ return api != null;
+ }
+
+ /* ExperienceAPI below */
+
+ /**
+ * Checks whether given string is a valid type of skill suitable for the
+ * other API calls in mcMMO.
+ *
+ *
+ * @param skillType String to check.
+ * @return true if this is a valid mcMMO skill.
+ */
+ public boolean isValidSkillType(String skillType) {
+ return ExperienceAPI.isValidSkillType(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).)
+ *
+ *
+ * @param skillType the skill to check
+ * @return true if this is a valid, non-child mcMMO skill
+ */
+ public boolean isNonChildSkill(String skillType) {
+ return ExperienceAPI.isNonChildSkill(skillType);
+ }
+
+ /**
+ * 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
+ *
+ * @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) {
+ ExperienceAPI.addRawXP(player, skillType, XP, xpGainReason, isUnshared);
+ }
+
+ /**
+ * 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
+ *
+ * @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) {
+ ExperienceAPI.addRawXPOffline(uuid, skillType, XP);
+ }
+
+ /**
+ * 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
+ *
+ * @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);
+ }
+
+ /**
+ * 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.
+ *
+ * @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) {
+ ExperienceAPI.addMultipliedXP(player, skillType, XP, xpGainReason);
+ }
+
+ /**
+ * 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
+ *
+ * @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) {
+ ExperienceAPI.addMultipliedXPOffline(playerName, skillType, XP);
+ }
+
+ /**
+ * 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
+ *
+ * @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) {
+ ExperienceAPI.addModifiedXPOffline(playerName, skillType, 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) {
+ ExperienceAPI.addXP(player, skillType, XP, xpGainReason, isUnshared);
+ }
+
+ /**
+ * 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
+ * @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
+ */
+ 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.
+ *
+ *
+ * @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
+ */
+ 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.
+ *
+ *
+ * @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
+ */
+ 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.
+ *
+ *
+ * @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
+ */
+ public float getOfflineXPRaw(UUID uuid, String skillType) {
+ return ExperienceAPI.getOfflineXPRaw(uuid, skillType);
+ }
+
+ /**
+ * 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
+ * @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
+ */
+ public int getXPToNextLevel(Player player, String skillType) {
+ return ExperienceAPI.getXPToNextLevel(player, skillType);
+ }
+
+ /**
+ * Get the total amount of XP an offline player needs to reach the next
+ * level.
+ *
+ *
+ * @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
+ */
+ public int getOfflineXPToNextLevel(UUID uuid, String skillType) {
+ return ExperienceAPI.getOfflineXPToNextLevel(uuid, skillType);
+ }
+
+ /**
+ * 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
+ * @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
+ */
+ 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.
+ *
+ *
+ * @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
+ */
+ public float getOfflineXPRemaining(UUID uuid, String skillType) {
+ return ExperienceAPI.getOfflineXPRemaining(uuid, skillType);
+ }
+
+ /**
+ * 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
+ *
+ * @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.
+ * .
+ *
+ * @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
+ */
+ public void addLevelOffline(UUID uuid, String skillType, int levels) {
+ ExperienceAPI.addLevelOffline(uuid, skillType, levels);
+ }
+
+ /**
+ * 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
+ * @return the level of a given skill
+ *
+ * @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.
+ *
+ *
+ * @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
+ */
+ public int getLevelOffline(UUID uuid, String skillType) {
+ return ExperienceAPI.getLevelOffline(uuid, skillType);
+ }
+
+ /**
+ * Gets the power level of a player.
+ *
+ *
+ * @param player The player to get the power level for
+ * @return the power level of the player
+ */
+ public int getPowerLevel(Player player) {
+ return ExperienceAPI.getPowerLevel(player);
+ }
+
+ /**
+ * Gets the power level of an offline player.
+ *
+ *
+ * @param uuid The player to get the power level for
+ * @return the power level of the player
+ *
+ * @throws InvalidPlayerException if the given player does not exist in the
+ * database
+ */
+ public int getPowerLevelOffline(UUID uuid) {
+ return ExperienceAPI.getPowerLevelOffline(uuid);
+ }
+
+ /**
+ * Get the level cap of a specific skill.
+ *
+ *
+ * @param skillType The skill to get the level cap for
+ * @return the level cap of a given skill
+ *
+ * @throws InvalidSkillException if the given skill is not valid
+ */
+ public int getLevelCap(String skillType) {
+ return ExperienceAPI.getLevelCap(skillType);
+ }
+
+ /**
+ * Get the power level cap.
+ *
+ *
+ * @return the overall power level cap
+ */
+ public int getPowerLevelCap() {
+ return ExperienceAPI.getPowerLevelCap();
+ }
+
+ /**
+ * Get the position on the leaderboard of a player.
+ *
+ *
+ * @param uuid The name of the player to check
+ * @param skillType The skill to check
+ *
+ * @throws InvalidSkillException if the given skill is not valid
+ * @throws InvalidPlayerException if the given player does not exist in the
+ * database
+ * @throws UnsupportedOperationException if the given skill is a child skill
+ *
+ * @return the position on the leaderboard
+ */
+ public int getPlayerRankSkill(UUID uuid, String skillType) {
+ return ExperienceAPI.getPlayerRankSkill(uuid, skillType);
+ }
+
+ /**
+ * Get the position on the power level leaderboard of a player.
+ *
+ *
+ * @param uuid The name of the player to check
+ *
+ * @throws InvalidPlayerException if the given player does not exist in the
+ * database
+ *
+ * @return the position on the power level leaderboard
+ */
+ public int getPlayerRankOverall(UUID uuid) {
+ return ExperienceAPI.getPlayerRankOverall(uuid);
+ }
+
+ /**
+ * 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
+ *
+ * @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.
+ *
+ *
+ * @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
+ */
+ 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.
+ *
+ *
+ * @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
+ */
+ 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.
+ *
+ *
+ * @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
+ */
+ public void setXPOffline(UUID uuid, String skillType, int newValue) {
+ ExperienceAPI.setXPOffline(uuid, skillType, newValue);
+ }
+
+ /**
+ * 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
+ *
+ * @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.
+ *
+ *
+ * @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
+ */
+ public void removeXPOffline(UUID uuid, String skillType, int xp) {
+ ExperienceAPI.removeXPOffline(uuid, skillType, xp);
+ }
+
+ /**
+ * Check how much XP is needed for a specific level with the selected level
+ * curve.
+ *
+ *
+ * @param level The level to get the amount of XP for
+ *
+ * @throws InvalidFormulaTypeException if the given formulaType is not valid
+ */
+ public int getXpNeededToLevel(int level) {
+ return ExperienceAPI.getXpNeededToLevel(level);
+ }
+
+ /**
+ * Check how much XP is needed for a specific level with the provided level
+ * curve.
+ *
+ *
+ * @param level The level to get the amount of XP for
+ * @param formulaType The formula type to get the amount of XP for
+ *
+ * @throws InvalidFormulaTypeException if the given formulaType is not valid
+ */
+ public int getXpNeededToLevel(int level, String formulaType) {
+ return ExperienceAPI.getXpNeededToLevel(level, formulaType);
+ }
+
+ /* AbilityAPI below */
+
+ /**
+ * Checks whether Berserk is enabled for a specific player.
+ *
+ * @param player Player to check for
+ * @return true if enabled; false otherwise.
+ */
+ public boolean berserkEnabled(Player player) {
+ return AbilityAPI.berserkEnabled(player);
+ }
+
+ /**
+ * Checks whether GigaDrill Breaker is enabled for a specific player.
+ *
+ * @param player Player to check for
+ * @return true if enabled; false otherwise.
+ */
+ public boolean gigaDrillBreakerEnabled(Player player) {
+ return AbilityAPI.gigaDrillBreakerEnabled(player);
+ }
+
+ /**
+ * Checks whether Green Terra is enabled for a specific player.
+ *
+ * @param player Player to check for
+ * @return true if enabled; false otherwise.
+ */
+ public boolean greenTerraEnabled(Player player) {
+ return AbilityAPI.greenTerraEnabled(player);
+ }
+
+ /**
+ * Checks whether Serrated Strikes is enabled for a specific player.
+ *
+ * @param player Player to check for
+ * @return true if enabled; false otherwise.
+ */
+ public boolean serratedStrikesEnabled(Player player) {
+ return AbilityAPI.serratedStrikesEnabled(player);
+ }
+
+ /**
+ * Checks whether Skull Splitter is enabled for a specific player.
+ *
+ * @param player Player to check for
+ * @return true if enabled; false otherwise.
+ */
+ public boolean skullSplitterEnabled(Player player) {
+ return AbilityAPI.skullSplitterEnabled(player);
+ }
+
+ /**
+ * Checks whether Super Breaker is enabled for a specific player.
+ *
+ * @param player Player to check for
+ * @return true if enabled; false otherwise.
+ */
+ public boolean superBreakerEnabled(Player player) {
+ return AbilityAPI.superBreakerEnabled(player);
+ }
+
+ /**
+ * Checks whether Tree Feller is enabled for a specific player.
+ *
+ * @param player Player to check for
+ * @return true if enabled; false otherwise.
+ */
+ public boolean treeFellerEnabled(Player player) {
+ return AbilityAPI.treeFellerEnabled(player);
+ }
+
+ /**
+ * Checks whether any special ability is enabled for a specific player.
+ *
+ * @param player Player to check for
+ * @return true if enabled; false otherwise.
+ */
+ public boolean isAnyAbilityEnabled(Player player) {
+ return AbilityAPI.isAnyAbilityEnabled(player);
+ }
+
+ /**
+ * Resets all ability cooldowns for a player so he/she can use it again
+ * immediately.
+ *
+ * @param player Player to reset cooldowns for.
+ */
+ public void resetCooldowns(Player player) {
+ AbilityAPI.resetCooldowns(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.
+ */
+ public void setBerserkCooldown(Player player, long cooldown) {
+ AbilityAPI.setBerserkCooldown(player, 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.
+ */
+ public void setGigaDrillBreakerCooldown(Player player, long cooldown) {
+ AbilityAPI.setGigaDrillBreakerCooldown(player, 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.
+ */
+ public void setGreenTerraCooldown(Player player, long cooldown) {
+ AbilityAPI.setGreenTerraCooldown(player, 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.
+ */
+ public void setSerratedStrikesCooldown(Player player, long cooldown) {
+ AbilityAPI.setSerratedStrikesCooldown(player, 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.
+ */
+ public void setSkullSplitterCooldown(Player player, long cooldown) {
+ AbilityAPI.setSkullSplitterCooldown(player, 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.
+ */
+ public void setSuperBreakerCooldown(Player player, long cooldown) {
+ AbilityAPI.setSuperBreakerCooldown(player, 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.
+ */
+ public void setTreeFellerCooldown(Player player, long cooldown) {
+ AbilityAPI.setTreeFellerCooldown(player, cooldown);
+ }
+
+ /**
+ * Checks whether the given entity is bleeding.
+ *
+ * @param entity Entity to check.
+ * @return true if bleeding; false otherwise.
+ */
+ public boolean isBleeding(LivingEntity entity) {
+ return AbilityAPI.isBleeding(entity);
+ }
+
+ /* ChatAPI below */
+
+ /**
+ * 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
+ */
+ 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
+ *
+ *
+ *
+ * @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) {
+ ChatAPI.sendPartyChat(plugin, sender, party, message);
+ }
+
+ /**
+ * 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
+ */
+ public void sendAdminChat(Plugin plugin, String sender, String displayName,
+ String message) {
+ ChatAPI.sendAdminChat(plugin, sender, displayName, message);
+ }
+
+ /**
+ * 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
+ */
+ public void sendAdminChat(Plugin plugin, String sender, String message) {
+ ChatAPI.sendAdminChat(plugin, sender, message);
+ }
+
+ /**
+ * Check if a player is currently talking in party chat.
+ *
+ * @param player The player to check
+ * @return true if the player is using party chat, false otherwise
+ */
+ public boolean isUsingPartyChat(Player player) {
+ return ChatAPI.isUsingPartyChat(player);
+ }
+
+ /**
+ * Check if a player is currently talking in party chat.
+ *
+ * @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) {
+ return ChatAPI.isUsingPartyChat(playerName);
+ }
+
+ /**
+ * Check if a player is currently talking in admin chat.
+ *
+ * @param player The player to check
+ * @return true if the player is using admin chat, false otherwise
+ */
+ public boolean isUsingAdminChat(Player player) {
+ return ChatAPI.isUsingAdminChat(player);
+ }
+
+ /**
+ * Check if a player is currently talking in admin chat.
+ *
+ * @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) {
+ return ChatAPI.isUsingAdminChat(playerName);
+ }
+
+ /**
+ * Toggle the party chat mode of a player.
+ *
+ * @param player The player to toggle party chat on.
+ */
+ public void togglePartyChat(Player player) {
+ ChatAPI.togglePartyChat(player);
+ }
+
+ /**
+ * Toggle the party chat mode of a player.
+ *
+ * @param playerName The name of the player to toggle party chat on.
+ */
+ public void togglePartyChat(String playerName) {
+ ChatAPI.togglePartyChat(playerName);
+ }
+
+ /**
+ * Toggle the admin chat mode of a player.
+ *
+ * @param player The player to toggle admin chat on.
+ */
+ public void toggleAdminChat(Player player) {
+ ChatAPI.toggleAdminChat(player);
+ }
+
+ /**
+ * Toggle the admin chat mode of a player.
+ *
+ * @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
- * Date created: 15:35:44 14 aug. 2015
- *
- * @author Staartvin
- *
- */
-public class OnTimeHook extends LibraryHook {
-
- /* (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());
- }
-
- /* (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.
- // We only check if the plugin is available.
- return isAvailable();
- }
-
- /**
- * Whether or not the given player is stored by OnTime.
- *
- * @param playerName Name of the player to check.
- * @return true if the player is stored; false otherwise.
- */
- public boolean isPlayerStored(String playerName) {
- return PlayingTime.playerHasOnTimeRecord(playerName);
- }
-
- /**
- * Gets a specific data piece of the given player.
- * TOTALPLAY: Total play time (OnTime) a player has spent on your
- * server. The returned value is in milliseconds.
- *
- * TODAYPLAY: The time a player has spent on your server since
- * midnight of the current day. The returned value is in milliseconds.
- *
- * WEEKPLAY: The time a player has spent on your server since
- * midnight of the first day of the current week. The first day of the week
- * is set in the OnTime/config.yml. The returned value is in milliseconds.
- *
- * MONTHPLAY: The time a player has spent on your server since
- * midnight of the first day of the current month. The first day of the
- * month is set in the OnTime/config.yml. The returned value is in
- * milliseconds.
- *
- * LASTLOGIN: The time stamp (date and time) of the player's last
- * login (join) event. The returned value is in milliseconds, and is the
- * number of milliseconds that have passed since the JAVA epoch date of
- * January 1, 1970.
- *
- * LASTVOTE: The time stamp (date and time) of the player's last
- * received vote for the server. The returned value is in milliseconds, and
- * is the number of milliseconds that have passed since the JAVA epoch date
- * of January 1, 1970.
- *
- * TOTALVOTE: Number of votes coast by the player for all time.
- *
- * TODAYVOTE: Number of votes cast by the player in the current day.
- *
- * WEEKVOTE: Number of votes cast by the player in the current week.
- *
- * MONTHVOTE: Number of votes cast by the player in the current
- * month.
- *
- * TOTALREFER: Number of referrals made by the player for all time.
- *
- * TODAYREFER: Number of referrals made by the player in the current
- * day.
- *
- * WEEKREFER: Number of referrals made by the player in the current
- * week.
- *
- * 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.
- * @return long value corresponding to the data type, -1 if no data was
- * found or the player was invalid.
- */
- public long getPlayerData(String playerName, String dataType) {
- if (playerName == null || dataType == null)
- return -1;
-
- OnTimeAPI.data data = OnTimeAPI.data.valueOf(dataType.toUpperCase());
-
- if (data == null) {
- return -1;
- }
-
- return DataIO.getPlayerTimeData(playerName, data);
- }
-
- /**
- * Gets a leaderboard-like map containing all top scores of players for the given data type.
- *
+ * Date created: 15:35:44 14 aug. 2015
+ *
+ * @author Staartvin
+ *
+ */
+public class OnTimeHook extends LibraryHook {
+
+ /* (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());
+ }
+
+ /* (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.
+ // We only check if the plugin is available.
+ return isAvailable();
+ }
+
+ /**
+ * Whether or not the given player is stored by OnTime.
+ *
+ * @param playerName Name of the player to check.
+ * @return true if the player is stored; false otherwise.
+ */
+ public boolean isPlayerStored(String playerName) {
+ return PlayingTime.playerHasOnTimeRecord(playerName);
+ }
+
+ /**
+ * Gets a specific data piece of the given player.
+ * TOTALPLAY: Total play time (OnTime) a player has spent on your
+ * server. The returned value is in milliseconds.
+ *
+ * TODAYPLAY: The time a player has spent on your server since
+ * midnight of the current day. The returned value is in milliseconds.
+ *
+ * WEEKPLAY: The time a player has spent on your server since
+ * midnight of the first day of the current week. The first day of the week
+ * is set in the OnTime/config.yml. The returned value is in milliseconds.
+ *
+ * MONTHPLAY: The time a player has spent on your server since
+ * midnight of the first day of the current month. The first day of the
+ * month is set in the OnTime/config.yml. The returned value is in
+ * milliseconds.
+ *
+ * LASTLOGIN: The time stamp (date and time) of the player's last
+ * login (join) event. The returned value is in milliseconds, and is the
+ * number of milliseconds that have passed since the JAVA epoch date of
+ * January 1, 1970.
+ *
+ * LASTVOTE: The time stamp (date and time) of the player's last
+ * received vote for the server. The returned value is in milliseconds, and
+ * is the number of milliseconds that have passed since the JAVA epoch date
+ * of January 1, 1970.
+ *
+ * TOTALVOTE: Number of votes coast by the player for all time.
+ *
+ * TODAYVOTE: Number of votes cast by the player in the current day.
+ *
+ * WEEKVOTE: Number of votes cast by the player in the current week.
+ *
+ * MONTHVOTE: Number of votes cast by the player in the current
+ * month.
+ *
+ * TOTALREFER: Number of referrals made by the player for all time.
+ *
+ * TODAYREFER: Number of referrals made by the player in the current
+ * day.
+ *
+ * WEEKREFER: Number of referrals made by the player in the current
+ * week.
+ *
+ * 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.
+ * @return long value corresponding to the data type, -1 if no data was
+ * found or the player was invalid.
+ */
+ public long getPlayerData(String playerName, String dataType) {
+ if (playerName == null || dataType == null)
+ return -1;
+
+ OnTimeAPI.data data = OnTimeAPI.data.valueOf(dataType.toUpperCase());
+
+ if (data == null) {
+ return -1;
+ }
+
+ return DataIO.getPlayerTimeData(playerName, data);
+ }
+
+ /**
+ * Gets a leaderboard-like map containing all top scores of players for the given data type.
+ *
- * Date created: 16:46:20 14 aug. 2015
- *
- * @author Staartvin
- *
- */
-public class RoyalCommandsHook extends LibraryHook {
-
- private RoyalCommands api;
-
- /* (non-Javadoc)
- * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable()
- */
- @Override
- public boolean isAvailable() {
- return this.getPlugin().getServer().getPluginManager()
- .isPluginEnabled(Library.ROYALCOMMANDS.getPluginName());
- }
-
- /* (non-Javadoc)
- * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook()
- */
- @Override
- public boolean hook() {
- if (!isAvailable())
- return false;
-
- api = (RoyalCommands) this.getPlugin().getServer().getPluginManager()
- .getPlugin(Library.ROYALCOMMANDS.getPluginName());
-
- return api != null;
- }
-
- public void doSOmething() {
-
- }
-
- /**
- * Whether or not the given player is afk according to RoyalCommands.
- * @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.
- */
- 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.
- */
- 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.
- */
- public Inventory getOfflineEnderInventory(OfflinePlayer player, String worldName) {
- return WorldManager.il.getOfflinePlayerEnderInventory(player, worldName);
- }
-
-}
+package me.staartvin.plugins.pluginlibrary.hooks;
+
+import me.staartvin.plugins.pluginlibrary.Library;
+
+import org.bukkit.OfflinePlayer;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.Inventory;
+import org.royaldev.royalcommands.RoyalCommands;
+import org.royaldev.royalcommands.WorldManager;
+
+/**
+ * RoyalCommands library, link.
+ *
+ * Date created: 16:46:20 14 aug. 2015
+ *
+ * @author Staartvin
+ *
+ */
+public class RoyalCommandsHook extends LibraryHook {
+
+ private RoyalCommands api;
+
+ /* (non-Javadoc)
+ * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#isAvailable()
+ */
+ @Override
+ public boolean isAvailable() {
+ return this.getPlugin().getServer().getPluginManager()
+ .isPluginEnabled(Library.ROYALCOMMANDS.getPluginName());
+ }
+
+ /* (non-Javadoc)
+ * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook()
+ */
+ @Override
+ public boolean hook() {
+ if (!isAvailable())
+ return false;
+
+ api = (RoyalCommands) this.getPlugin().getServer().getPluginManager()
+ .getPlugin(Library.ROYALCOMMANDS.getPluginName());
+
+ return api != null;
+ }
+
+ public void doSOmething() {
+
+ }
+
+ /**
+ * Whether or not the given player is afk according to RoyalCommands.
+ * @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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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 20e4dfa..af38202 100644
--- a/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java
+++ b/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java
@@ -1,516 +1,516 @@
-package me.staartvin.plugins.pluginlibrary.hooks;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Map;
-import java.util.UUID;
-
-import me.staartvin.plugins.pluginlibrary.Library;
-import me.staartvin.plugins.pluginlibrary.hooks.customstats.FoodEatenStat;
-import me.staartvin.plugins.pluginlibrary.hooks.customstats.MobKilledStat;
-import nl.lolmewn.stats.api.stat.Stat;
-import nl.lolmewn.stats.api.stat.StatEntry;
-import nl.lolmewn.stats.api.user.StatsHolder;
-import nl.lolmewn.stats.bukkit.BukkitMain;
-
-import org.bukkit.Material;
-import org.bukkit.entity.EntityType;
-
-/**
- * Stats library, link.
- *
- * Date created: 16:30:26 12 aug. 2015
- *
- * @author Staartvin
- *
- */
-public class StatsHook extends LibraryHook {
-
- private BukkitMain stats;
-
- /* (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());
- }
-
- /* (non-Javadoc)
- * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook()
- */
- @Override
- public boolean hook() {
- if (!isAvailable())
- return false;
-
- stats = (BukkitMain) this.getPlugin().getServer().getPluginManager()
- .getPlugin(Library.STATS.getPluginName());
-
- return stats != null;
- }
-
- /**
- * 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. 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) {
- if (!isAvailable())
- return 0;
-
- final String statName = "Move";
-
- final Collection 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) {
- if (!isAvailable())
- return 0;
-
- String statName = FoodEatenStat.statName;
-
- final Collection
+ * Date created: 16:30:26 12 aug. 2015
+ *
+ * @author Staartvin
+ *
+ */
+public class StatsHook extends LibraryHook {
+
+ private BukkitMain stats;
+
+ /* (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());
+ }
+
+ /* (non-Javadoc)
+ * @see me.staartvin.plugins.pluginlibrary.hooks.LibraryHook#hook()
+ */
+ @Override
+ public boolean hook() {
+ if (!isAvailable())
+ return false;
+
+ stats = (BukkitMain) this.getPlugin().getServer().getPluginManager()
+ .getPlugin(Library.STATS.getPluginName());
+
+ return stats != null;
+ }
+
+ /**
+ * 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. 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) {
+ if (!isAvailable())
+ return 0;
+
+ final String statName = "Move";
+
+ final Collection 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) {
+ if (!isAvailable())
+ return 0;
+
+ String statName = FoodEatenStat.statName;
+
+ final Collection
- * Date created: 15:00:27 15 jul. 2015
- *
- * @author Staartvin
- *
- */
-public class CustomStatsManager {
-
- private final PluginLibrary plugin;
-
- public CustomStatsManager(PluginLibrary instance) {
- this.plugin = 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.");*/
-
- hook.addStat(new FoodEatenStat());
- /*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);
- }
-}
+package me.staartvin.plugins.pluginlibrary.hooks.customstats;
+
+import me.staartvin.plugins.pluginlibrary.Library;
+import me.staartvin.plugins.pluginlibrary.PluginLibrary;
+import me.staartvin.plugins.pluginlibrary.hooks.StatsHook;
+import me.staartvin.plugins.pluginlibrary.listeners.PlayerEatsFoodListener;
+import me.staartvin.plugins.pluginlibrary.listeners.PlayerKillsMobListener;
+
+/**
+ * Manages all custom stats that Autorank creates with Stats.
+ *
+ * Date created: 15:00:27 15 jul. 2015
+ *
+ * @author Staartvin
+ *
+ */
+public class CustomStatsManager {
+
+ private final PluginLibrary plugin;
+
+ public CustomStatsManager(PluginLibrary instance) {
+ this.plugin = 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.");*/
+
+ hook.addStat(new FoodEatenStat());
+ /*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);
+ }
+}
diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/FoodEatenStat.java b/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/FoodEatenStat.java
index 2e6ce67..7c14727 100644
--- a/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/FoodEatenStat.java
+++ b/src/me/staartvin/plugins/pluginlibrary/hooks/customstats/FoodEatenStat.java
@@ -1,84 +1,84 @@
-package me.staartvin.plugins.pluginlibrary.hooks.customstats;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import nl.lolmewn.stats.api.stat.Stat;
-import nl.lolmewn.stats.api.stat.StatEntry;
-import nl.lolmewn.stats.api.storage.DataType;
-
-/**
- * Stat that tracks what kind of food is eaten by a player
- *
- * Date created: 15:59:38 27 jun. 2015
- *
- * @author Staartvin
- *
- */
-public class FoodEatenStat implements Stat {
-
- private final HashMap
+ * Date created: 15:59:38 27 jun. 2015
+ *
+ * @author Staartvin
+ *
+ */
+public class FoodEatenStat implements Stat {
+
+ private final HashMap
- * Date created: 15:59:38 27 jun. 2015
- *
- * @author Staartvin
- *
- */
-public class MobKilledStat implements Stat {
-
- private final HashMap
+ * Date created: 15:59:38 27 jun. 2015
+ *
+ * @author Staartvin
+ *
+ */
+public class MobKilledStat implements Stat {
+
+ private final HashMap
- * Date created: 23:56:42
- * 13 aug. 2015
- * @author Staartvin
- *
- */
-public class Faction {
- private final com.massivecraft.factions.entity.Faction faction;
-
- public Faction(com.massivecraft.factions.entity.Faction fac) {
- if (fac == null) {
- throw new NullPointerException("Faction is null!");
- }
- faction = fac;
- }
-
- /**
- * Gets the name of the faction.
- *
+ * Date created: 23:56:42
+ * 13 aug. 2015
+ * @author Staartvin
+ *
+ */
+public class Faction {
+ private final com.massivecraft.factions.entity.Faction faction;
+
+ public Faction(com.massivecraft.factions.entity.Faction fac) {
+ if (fac == null) {
+ throw new NullPointerException("Faction is null!");
+ }
+ faction = fac;
+ }
+
+ /**
+ * Gets the name of the faction.
+ *
- * Date created: 23:56:36
- * 13 aug. 2015
- * @author Staartvin
- *
- */
-public class MPlayer {
-
- private final com.massivecraft.factions.entity.MPlayer mPlayer;
-
- public MPlayer(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.
- *
+ * Date created: 23:56:36
+ * 13 aug. 2015
+ * @author Staartvin
+ *
+ */
+public class MPlayer {
+
+ private final com.massivecraft.factions.entity.MPlayer mPlayer;
+
+ public MPlayer(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.
+ *
- * Date created: 17:38:32
- * 12 aug. 2015
- * @author Staartvin
- *
- */
-public class Util {
-
- /**
- * Get the name of this food item.
- *
- * @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
-
- if (item == null)
- return null;
-
- switch (item.getType()) {
- case APPLE:
- return "APPLE";
- case BAKED_POTATO:
- return "BAKED_POTATO";
- case BREAD:
- return "BREAD";
- case CAKE_BLOCK: // not working atm
- return "CAKE_BLOCK";
- case CARROT_ITEM:
- return "CARROT_ITEM";
- case COOKED_CHICKEN:
- return "COOKED_CHICKEN";
- case COOKED_FISH: {
- if (item.getDurability() == (short) 1) {
- return "COOKED_SALMON";
- }
- return "COOKED_FISH";
- }
- case COOKED_MUTTON:
- return "COOKED_MUTTON";
- case GRILLED_PORK:
- return "GRILLED_PORK";
- case COOKED_RABBIT:
- return "COOKED_RABBIT";
- case COOKIE:
- return "COOKIE";
- case GOLDEN_APPLE: {
- if (item.getDurability() == (short) 1) {
- return "ENCHANTED_GOLDEN_APPLE";
- }
- return "GOLDEN_APPLE";
- }
- case GOLDEN_CARROT:
- return "GOLDEN_CARROT";
- case MELON:
- return "MELON";
- case MUSHROOM_SOUP:
- return "MUSHROOM_SOUP";
- case RABBIT_STEW:
- return "RABBIT_STEW";
- case RAW_BEEF:
- return "RAW_BEEF";
- case RAW_CHICKEN:
- return "RAW_CHICKEN";
- case RAW_FISH: {
- if (item.getDurability() == (short) 1) {
- return "RAW_SALMON";
- } else if (item.getDurability() == (short) 2) {
- return "CLOWNFISH";
- } else if (item.getDurability() == (short) 3) {
- return "PUFFERFISH";
- }
- return "RAW_FISH";
- }
- case POISONOUS_POTATO:
- return "POISONOUS_POTATO";
- case POTATO:
- return "POTATO";
- case PUMPKIN_PIE:
- return "PUMPKIN_PIE";
- case MUTTON:
- return "MUTTON"; // raw
- case COOKED_BEEF:
- return "COOKED_BEEF";
- case RABBIT:
- return "RABBIT";
- case ROTTEN_FLESH:
- return "ROTTEN_FLESH";
- case SPIDER_EYE:
- return "SPIDER_EYE";
- default:
- return null;
- }
- }
-
- @SuppressWarnings("deprecation")
- public static ItemStack getFoodItemFromName(String name) {
- // Cannot use switch, is only supported in Java 1.7+
-
- if (name == null)
- return null;
-
- name = name.toUpperCase();
- name = name.replace(" ", "_");
-
- if (name.equals("APPLE")) {
- return new ItemStack(Material.APPLE, 1);
- } else if (name.equals("BAKED_POTATO")) {
- return new ItemStack(Material.BAKED_POTATO, 1);
- } else if (name.equals("BREAD")) {
- return new ItemStack(Material.BREAD, 1);
- } else if (name.equals("CAKE_BLOCK")) {
- return new ItemStack(Material.CAKE_BLOCK, 1);
- } else if (name.equals("CARROT_ITEM")) {
- return new ItemStack(Material.CARROT_ITEM, 1);
- } else if (name.equals("COOKED_CHICKEN")) {
- return new ItemStack(Material.COOKED_CHICKEN, 1);
- } else if (name.equals("COOKED_FISH")) {
- return new ItemStack(Material.COOKED_FISH, 1);
- } else if (name.equals("COOKED_SALMON")) {
- return new ItemStack(Material.COOKED_FISH.getId(), 1, (short) 1);
- } else if (name.equals("COOKED_MUTTON")) {
- return new ItemStack(Material.COOKED_MUTTON, 1);
- } else if (name.equals("GRILLED_PORK")) {
- return new ItemStack(Material.GRILLED_PORK, 1);
- } else if (name.equals("COOKED_RABBIT")) {
- return new ItemStack(Material.COOKED_RABBIT, 1);
- } else if (name.equals("COOKIE")) {
- return new ItemStack(Material.COOKIE, 1);
- } else if (name.equals("GOLDEN_APPLE")) {
- return new ItemStack(Material.GOLDEN_APPLE, 1);
- } else if (name.equals("ENCHANTED_GOLDEN_APPLE")) {
- return new ItemStack(Material.GOLDEN_APPLE.getId(), 1, (short) 1);
- } else if (name.equals("GOLDEN_CARROT")) {
- return new ItemStack(Material.GOLDEN_CARROT, 1);
- } else if (name.equals("MELON")) {
- return new ItemStack(Material.MELON, 1);
- } else if (name.equals("MUSHROOM_SOUP")) {
- return new ItemStack(Material.MUSHROOM_SOUP, 1);
- } else if (name.equals("RABBIT_STEW")) {
- return new ItemStack(Material.RABBIT_STEW, 1);
- } else if (name.equals("RAW_BEEF")) {
- return new ItemStack(Material.RAW_BEEF, 1);
- } else if (name.equals("RAW_CHICKEN")) {
- return new ItemStack(Material.RAW_CHICKEN, 1);
- } else if (name.equals("RAW_FISH")) {
- return new ItemStack(Material.RAW_FISH, 1);
- } else if (name.equals("RAW_SALMON")) {
- return new ItemStack(Material.RAW_FISH.getId(), 1, (short) 1);
- } else if (name.equals("CLOWNFISH")) {
- return new ItemStack(Material.RAW_FISH.getId(), 1, (short) 2);
- } else if (name.equals("PUFFERFISH")) {
- return new ItemStack(Material.RAW_FISH.getId(), 1, (short) 3);
- } else if (name.equals("POISONOUS_POTATO")) {
- return new ItemStack(Material.POISONOUS_POTATO, 1);
- } else if (name.equals("POTATO")) {
- return new ItemStack(Material.POTATO, 1);
- } else if (name.equals("PUMPKIN_PIE")) {
- return new ItemStack(Material.PUMPKIN_PIE, 1);
- } else if (name.equals("MUTTON")) {
- return new ItemStack(Material.MUTTON, 1);
- } else if (name.equals("COOKED_BEEF")) {
- return new ItemStack(Material.COOKED_BEEF, 1);
- } else if (name.equals("RABBIT")) {
- return new ItemStack(Material.RABBIT, 1);
- } else if (name.equals("ROTTEN_FLESH")) {
- return new ItemStack(Material.ROTTEN_FLESH, 1);
- } else if (name.equals("SPIDER_EYE")) {
- return new ItemStack(Material.SPIDER_EYE, 1);
- } else
- return null;
- }
-}
+package me.staartvin.plugins.pluginlibrary.util;
+
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
+
+/**
+ * Util class
+ *
+ * Date created: 17:38:32
+ * 12 aug. 2015
+ * @author Staartvin
+ *
+ */
+public class Util {
+
+ /**
+ * Get the name of this food item.
+ *
+ * @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
+
+ if (item == null)
+ return null;
+
+ switch (item.getType()) {
+ case APPLE:
+ return "APPLE";
+ case BAKED_POTATO:
+ return "BAKED_POTATO";
+ case BREAD:
+ return "BREAD";
+ case CAKE_BLOCK: // not working atm
+ return "CAKE_BLOCK";
+ case CARROT_ITEM:
+ return "CARROT_ITEM";
+ case COOKED_CHICKEN:
+ return "COOKED_CHICKEN";
+ case COOKED_FISH: {
+ if (item.getDurability() == (short) 1) {
+ return "COOKED_SALMON";
+ }
+ return "COOKED_FISH";
+ }
+ case COOKED_MUTTON:
+ return "COOKED_MUTTON";
+ case GRILLED_PORK:
+ return "GRILLED_PORK";
+ case COOKED_RABBIT:
+ return "COOKED_RABBIT";
+ case COOKIE:
+ return "COOKIE";
+ case GOLDEN_APPLE: {
+ if (item.getDurability() == (short) 1) {
+ return "ENCHANTED_GOLDEN_APPLE";
+ }
+ return "GOLDEN_APPLE";
+ }
+ case GOLDEN_CARROT:
+ return "GOLDEN_CARROT";
+ case MELON:
+ return "MELON";
+ case MUSHROOM_SOUP:
+ return "MUSHROOM_SOUP";
+ case RABBIT_STEW:
+ return "RABBIT_STEW";
+ case RAW_BEEF:
+ return "RAW_BEEF";
+ case RAW_CHICKEN:
+ return "RAW_CHICKEN";
+ case RAW_FISH: {
+ if (item.getDurability() == (short) 1) {
+ return "RAW_SALMON";
+ } else if (item.getDurability() == (short) 2) {
+ return "CLOWNFISH";
+ } else if (item.getDurability() == (short) 3) {
+ return "PUFFERFISH";
+ }
+ return "RAW_FISH";
+ }
+ case POISONOUS_POTATO:
+ return "POISONOUS_POTATO";
+ case POTATO:
+ return "POTATO";
+ case PUMPKIN_PIE:
+ return "PUMPKIN_PIE";
+ case MUTTON:
+ return "MUTTON"; // raw
+ case COOKED_BEEF:
+ return "COOKED_BEEF";
+ case RABBIT:
+ return "RABBIT";
+ case ROTTEN_FLESH:
+ return "ROTTEN_FLESH";
+ case SPIDER_EYE:
+ return "SPIDER_EYE";
+ default:
+ return null;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public static ItemStack getFoodItemFromName(String name) {
+ // Cannot use switch, is only supported in Java 1.7+
+
+ if (name == null)
+ return null;
+
+ name = name.toUpperCase();
+ name = name.replace(" ", "_");
+
+ if (name.equals("APPLE")) {
+ return new ItemStack(Material.APPLE, 1);
+ } else if (name.equals("BAKED_POTATO")) {
+ return new ItemStack(Material.BAKED_POTATO, 1);
+ } else if (name.equals("BREAD")) {
+ return new ItemStack(Material.BREAD, 1);
+ } else if (name.equals("CAKE_BLOCK")) {
+ return new ItemStack(Material.CAKE_BLOCK, 1);
+ } else if (name.equals("CARROT_ITEM")) {
+ return new ItemStack(Material.CARROT_ITEM, 1);
+ } else if (name.equals("COOKED_CHICKEN")) {
+ return new ItemStack(Material.COOKED_CHICKEN, 1);
+ } else if (name.equals("COOKED_FISH")) {
+ return new ItemStack(Material.COOKED_FISH, 1);
+ } else if (name.equals("COOKED_SALMON")) {
+ return new ItemStack(Material.COOKED_FISH.getId(), 1, (short) 1);
+ } else if (name.equals("COOKED_MUTTON")) {
+ return new ItemStack(Material.COOKED_MUTTON, 1);
+ } else if (name.equals("GRILLED_PORK")) {
+ return new ItemStack(Material.GRILLED_PORK, 1);
+ } else if (name.equals("COOKED_RABBIT")) {
+ return new ItemStack(Material.COOKED_RABBIT, 1);
+ } else if (name.equals("COOKIE")) {
+ return new ItemStack(Material.COOKIE, 1);
+ } else if (name.equals("GOLDEN_APPLE")) {
+ return new ItemStack(Material.GOLDEN_APPLE, 1);
+ } else if (name.equals("ENCHANTED_GOLDEN_APPLE")) {
+ return new ItemStack(Material.GOLDEN_APPLE.getId(), 1, (short) 1);
+ } else if (name.equals("GOLDEN_CARROT")) {
+ return new ItemStack(Material.GOLDEN_CARROT, 1);
+ } else if (name.equals("MELON")) {
+ return new ItemStack(Material.MELON, 1);
+ } else if (name.equals("MUSHROOM_SOUP")) {
+ return new ItemStack(Material.MUSHROOM_SOUP, 1);
+ } else if (name.equals("RABBIT_STEW")) {
+ return new ItemStack(Material.RABBIT_STEW, 1);
+ } else if (name.equals("RAW_BEEF")) {
+ return new ItemStack(Material.RAW_BEEF, 1);
+ } else if (name.equals("RAW_CHICKEN")) {
+ return new ItemStack(Material.RAW_CHICKEN, 1);
+ } else if (name.equals("RAW_FISH")) {
+ return new ItemStack(Material.RAW_FISH, 1);
+ } else if (name.equals("RAW_SALMON")) {
+ return new ItemStack(Material.RAW_FISH.getId(), 1, (short) 1);
+ } else if (name.equals("CLOWNFISH")) {
+ return new ItemStack(Material.RAW_FISH.getId(), 1, (short) 2);
+ } else if (name.equals("PUFFERFISH")) {
+ return new ItemStack(Material.RAW_FISH.getId(), 1, (short) 3);
+ } else if (name.equals("POISONOUS_POTATO")) {
+ return new ItemStack(Material.POISONOUS_POTATO, 1);
+ } else if (name.equals("POTATO")) {
+ return new ItemStack(Material.POTATO, 1);
+ } else if (name.equals("PUMPKIN_PIE")) {
+ return new ItemStack(Material.PUMPKIN_PIE, 1);
+ } else if (name.equals("MUTTON")) {
+ return new ItemStack(Material.MUTTON, 1);
+ } else if (name.equals("COOKED_BEEF")) {
+ return new ItemStack(Material.COOKED_BEEF, 1);
+ } else if (name.equals("RABBIT")) {
+ return new ItemStack(Material.RABBIT, 1);
+ } else if (name.equals("ROTTEN_FLESH")) {
+ return new ItemStack(Material.ROTTEN_FLESH, 1);
+ } else if (name.equals("SPIDER_EYE")) {
+ return new ItemStack(Material.SPIDER_EYE, 1);
+ } else
+ return null;
+ }
+}
diff --git a/src/plugin.yml b/src/plugin.yml
index b0f754b..4f90abe 100644
--- a/src/plugin.yml
+++ b/src/plugin.yml
@@ -1,6 +1,6 @@
-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.
+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.
softdepend: [Autorank, Stats, mcMMO, Factions, afkTerminator, OnTime, RoyalCommands, UltimateCore]
\ No newline at end of file
- * There a few data types that can be used:
- *
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.
- */
- public Map
+ * There a few data types that can be used:
+ *
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.
+ */
+ public Map
- * 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.
- * @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) {
- if (!isAvailable())
- return 0;
-
- final Collection
- * 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.
- * @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) {
- if (!isAvailable())
- return 0;
-
- final Collection
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) {
- if (!isAvailable())
- return 0;
-
- final Collection
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) {
- if (!isAvailable())
- return 0;
-
- return this.getNormalStat(uuid, "Blocks broken", 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
- *
- *
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) {
- if (!isAvailable())
- return 0;
-
- return this.getNormalStat(uuid, "Blocks placed", 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.
- * @return The amount of mobs killed a player has killed.
- */
- public int getMobsKilled(final UUID uuid, final String mobName,
- final String worldName) {
- if (!isAvailable())
- return 0;
-
- final String statName = "Kill";
-
- // Mob type
- String type = null;
-
- if (mobName != null && !mobName.equals("")) {
-
- if (mobName.equalsIgnoreCase("wither_skeleton")) {
- return this.getSpecialMobsKilled(uuid, "WITHER SKELETON",
- worldName);
- } else if (mobName.equalsIgnoreCase("charged_creeper")) {
- return this.getSpecialMobsKilled(uuid, "POWERED CREEPER",
- worldName);
- } else if (mobName.equalsIgnoreCase("spider_jockey")) {
- return this.getSpecialMobsKilled(uuid, "SPIDER JOCKEY",
- worldName);
- } else if (mobName.equalsIgnoreCase("chicken_jockey")) {
- return this.getSpecialMobsKilled(uuid, "CHICKEN JOCKEY",
- worldName);
- } else if (mobName.equalsIgnoreCase("killer_rabbit")) {
- return this.getSpecialMobsKilled(uuid, "KILLER RABBIT",
- worldName);
- } else if (mobName.equalsIgnoreCase("elder_guardian")) {
- return this.getSpecialMobsKilled(uuid, "ELDER GUARDIAN",
- worldName);
- }
-
- type = EntityType.valueOf(
- mobName.toUpperCase().replaceAll(" ", "_")).toString();
- }
-
- final Collection
If you only want to know about the total amount of food eaten, use {@link #getNormalStat(UUID, String, String)} with statName as 'Omnomnom' instead.
- *
+ * 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.
+ * @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) {
+ if (!isAvailable())
+ return 0;
+
+ final Collection
+ * 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.
+ * @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) {
+ if (!isAvailable())
+ return 0;
+
+ final Collection
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) {
+ if (!isAvailable())
+ return 0;
+
+ final Collection
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) {
+ if (!isAvailable())
+ return 0;
+
+ return this.getNormalStat(uuid, "Blocks broken", 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
+ *
+ *
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) {
+ if (!isAvailable())
+ return 0;
+
+ return this.getNormalStat(uuid, "Blocks placed", 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.
+ * @return The amount of mobs killed a player has killed.
+ */
+ public int getMobsKilled(final UUID uuid, final String mobName,
+ final String worldName) {
+ if (!isAvailable())
+ return 0;
+
+ final String statName = "Kill";
+
+ // Mob type
+ String type = null;
+
+ if (mobName != null && !mobName.equals("")) {
+
+ if (mobName.equalsIgnoreCase("wither_skeleton")) {
+ return this.getSpecialMobsKilled(uuid, "WITHER SKELETON",
+ worldName);
+ } else if (mobName.equalsIgnoreCase("charged_creeper")) {
+ return this.getSpecialMobsKilled(uuid, "POWERED CREEPER",
+ worldName);
+ } else if (mobName.equalsIgnoreCase("spider_jockey")) {
+ return this.getSpecialMobsKilled(uuid, "SPIDER JOCKEY",
+ worldName);
+ } else if (mobName.equalsIgnoreCase("chicken_jockey")) {
+ return this.getSpecialMobsKilled(uuid, "CHICKEN JOCKEY",
+ worldName);
+ } else if (mobName.equalsIgnoreCase("killer_rabbit")) {
+ return this.getSpecialMobsKilled(uuid, "KILLER RABBIT",
+ worldName);
+ } else if (mobName.equalsIgnoreCase("elder_guardian")) {
+ return this.getSpecialMobsKilled(uuid, "ELDER GUARDIAN",
+ worldName);
+ }
+
+ type = EntityType.valueOf(
+ mobName.toUpperCase().replaceAll(" ", "_")).toString();
+ }
+
+ final Collection
If you only want to know about the total amount of food eaten, use {@link #getNormalStat(UUID, String, String)} with statName as 'Omnomnom' instead.
+ *
This class mirroring is used so developers don't have to import the API of Factions.
- *
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.
- */
- public String getName() {
- return faction.getName();
- }
-
- /**
- * Gets the description of the faction.
- *
- * @return description including colour codes or null if non-existent.
- */
- public String getDescription() {
- return faction.getDescription();
- }
-
- /**
- * Gets the MOTD of the faction.
- *
- * @return String containting the MOTD, null if faction doesn't exist or has
- * no MOTD.
- */
- public String getMotd() {
- return faction.getMotd();
- }
-
- /**
- * Gets the time (from UNIX timestamp) when the faction was created.
- *
- * @return time in milliseconds of creation (UNIX)
- */
- public long getCreatedAt() {
- return faction.getCreatedAtMillis();
- }
-
- /**
- * Gets the location of the home of a faction.
- *
- * @return A {@link Location} or null if faction is non-existent or the home
- * is not set.
- */
- public Location getHomeLocation() {
- if (faction.getHome() == null)
- return null;
-
- return faction.getHome().asBukkitLocation();
- }
-
- /**
- * Gets the powerboost of the faction.
- *
- * @return the powerboost of the faction or null if 0.
- */
- public Double getPowerBoost() {
- return faction.getPowerBoost();
- }
-
- /**
- * Sets the name of the faction.
- *
- * @param name New name for the faction.
- */
- public void setName(String name) {
- faction.setName(name);
- }
-
- /**
- * Sets the description of the faction.
- *
- * @param description Description to set.
- */
- public void setDescription(String description) {
- faction.setDescription(getDescription());
- }
-
- /**
- * Sets the MOTD of a faction.
- *
- * @param motd MOTD to set to.
- */
- public void setMotd(String motd) {
- faction.setMotd(motd);
- }
-
- /**
- * Sets the time the faction was created at.
- *
- * @param time Time (in milliseconds) in UNIX timestamp.
- */
- public void setCreatedAt(long time) {
- faction.setCreatedAtMillis(time);
- }
-
- /**
- * Sets the location of the home of a faction.
- *
- * @param location Location to set the home to.
- */
- public void setHomeLocation(Location location) {
- faction.setHome(PS.valueOf(location));
- }
-
- /**
- * Sets the powerboost of the faction.
- *
- * @param powerBoost Powerboost to set it to.
- */
- public void setPowerBoost(Double powerBoost) {
- faction.setPowerBoost(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,
- * 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.
- */
- public boolean getFlagValue(String flagId) {
- // throw new NullPointerException("flagId");
- return faction.getFlag(flagId);
- }
-
- /**
- * Sets the value of the given flag for a faction.
- *
- * @param flagId Name of the flag. For a list of flags, see
- * {@link #getFactionFlag(String, String)}.
- * @param value Value to set the flag to.
- */
- public void setFlagValue(String flagId, boolean value) {
- // throw new NullPointerException("flagId");
- faction.setFlag(flagId, value);
- }
-
- /**
- * Gets a list of UUIDs that are invited to this faction.
- *
- * @return a list of UUIDs corresponding to players.
- */
- public Set
- * Will return a relationship type. This can be ALLY, TRUCE, NEUTRAL and
- * ENEMY.
- *
- * @param otherFaction Other faction.
- * @return A relationship type or null if the other faction was not found.
- */
- public String getRelationWish(Faction otherFaction) {
- com.massivecraft.factions.entity.Faction otherFac = FactionColl.get()
- .get(otherFaction.getId());
-
- if (otherFac == null)
- return null;
-
- Rel rel = faction.getRelationWish(otherFac);
-
- if (rel == null)
- return null;
-
- return rel.toString();
- }
-
- /**
- * Sets the relation wish of this faction to another faction.
- * For a list of relation types, see {@link #getRelationWish(Faction)}
- *
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.
- */
- public void setRelationWish(Faction otherFaction, String relation) {
- com.massivecraft.factions.entity.Faction otherFac = FactionColl.get()
- .get(otherFaction.getId());
-
- if (otherFac == null)
- return;
-
- Rel rel = Rel.valueOf(relation.toUpperCase());
-
- if (rel == null)
- return;
-
- faction.setRelationWish(otherFac, rel);
- }
-
- /**
- * Gets the relation of this faction to another faction.
- * Will return a relationship type. This can be ALLY, TRUCE, NEUTRAL and
- * ENEMY.
- *
- * @param otherFaction Other faction.
- * @return A relationship type or null if the other faction was not found.
- */
- public String getRelationTo(Faction otherFaction) {
- com.massivecraft.factions.entity.Faction otherFac = FactionColl.get()
- .get(otherFaction.getId());
-
- if (otherFac == null)
- return null;
-
- Rel rel = faction.getRelationTo(otherFac);
-
- if (rel == null)
- return null;
-
- return rel.toString();
- }
-
- /**
- * Gets a list of online players that are member of this faction.
- *
- * @return a list containing all online-member players.
- */
- public List
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.
- * @return Unique name of Faction without colour codes.
- */
- public String getComparisonName() {
- return faction.getComparisonName();
- }
+package me.staartvin.plugins.pluginlibrary.hooks.factions;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.bukkit.Chunk;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+import com.massivecraft.factions.Rel;
+import com.massivecraft.factions.entity.BoardColl;
+import com.massivecraft.factions.entity.FactionColl;
+import com.massivecraft.factions.entity.MFlag;
+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.
+ *
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.
+ */
+ public String getName() {
+ return faction.getName();
+ }
+
+ /**
+ * Gets the description of the faction.
+ *
+ * @return description including colour codes or null if non-existent.
+ */
+ public String getDescription() {
+ return faction.getDescription();
+ }
+
+ /**
+ * Gets the MOTD of the faction.
+ *
+ * @return String containting the MOTD, null if faction doesn't exist or has
+ * no MOTD.
+ */
+ public String getMotd() {
+ return faction.getMotd();
+ }
+
+ /**
+ * Gets the time (from UNIX timestamp) when the faction was created.
+ *
+ * @return time in milliseconds of creation (UNIX)
+ */
+ public long getCreatedAt() {
+ return faction.getCreatedAtMillis();
+ }
+
+ /**
+ * Gets the location of the home of a faction.
+ *
+ * @return A {@link Location} or null if faction is non-existent or the home
+ * is not set.
+ */
+ public Location getHomeLocation() {
+ if (faction.getHome() == null)
+ return null;
+
+ return faction.getHome().asBukkitLocation();
+ }
+
+ /**
+ * Gets the powerboost of the faction.
+ *
+ * @return the powerboost of the faction or null if 0.
+ */
+ public Double getPowerBoost() {
+ return faction.getPowerBoost();
+ }
+
+ /**
+ * Sets the name of the faction.
+ *
+ * @param name New name for the faction.
+ */
+ public void setName(String name) {
+ faction.setName(name);
+ }
+
+ /**
+ * Sets the description of the faction.
+ *
+ * @param description Description to set.
+ */
+ public void setDescription(String description) {
+ faction.setDescription(getDescription());
+ }
+
+ /**
+ * Sets the MOTD of a faction.
+ *
+ * @param motd MOTD to set to.
+ */
+ public void setMotd(String motd) {
+ faction.setMotd(motd);
+ }
+
+ /**
+ * Sets the time the faction was created at.
+ *
+ * @param time Time (in milliseconds) in UNIX timestamp.
+ */
+ public void setCreatedAt(long time) {
+ faction.setCreatedAtMillis(time);
+ }
+
+ /**
+ * Sets the location of the home of a faction.
+ *
+ * @param location Location to set the home to.
+ */
+ public void setHomeLocation(Location location) {
+ faction.setHome(PS.valueOf(location));
+ }
+
+ /**
+ * Sets the powerboost of the faction.
+ *
+ * @param powerBoost Powerboost to set it to.
+ */
+ public void setPowerBoost(Double powerBoost) {
+ faction.setPowerBoost(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,
+ * 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.
+ */
+ public boolean getFlagValue(String flagId) {
+ // throw new NullPointerException("flagId");
+ return faction.getFlag(flagId);
+ }
+
+ /**
+ * Sets the value of the given flag for a faction.
+ *
+ * @param flagId Name of the flag. For a list of flags, see
+ * {@link #getFactionFlag(String, String)}.
+ * @param value Value to set the flag to.
+ */
+ public void setFlagValue(String flagId, boolean value) {
+ // throw new NullPointerException("flagId");
+ faction.setFlag(flagId, value);
+ }
+
+ /**
+ * Gets a list of UUIDs that are invited to this faction.
+ *
+ * @return a list of UUIDs corresponding to players.
+ */
+ public Set
+ * Will return a relationship type. This can be ALLY, TRUCE, NEUTRAL and
+ * ENEMY.
+ *
+ * @param otherFaction Other faction.
+ * @return A relationship type or null if the other faction was not found.
+ */
+ public String getRelationWish(Faction otherFaction) {
+ com.massivecraft.factions.entity.Faction otherFac = FactionColl.get()
+ .get(otherFaction.getId());
+
+ if (otherFac == null)
+ return null;
+
+ Rel rel = faction.getRelationWish(otherFac);
+
+ if (rel == null)
+ return null;
+
+ return rel.toString();
+ }
+
+ /**
+ * Sets the relation wish of this faction to another faction.
+ * For a list of relation types, see {@link #getRelationWish(Faction)}
+ *
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.
+ */
+ public void setRelationWish(Faction otherFaction, String relation) {
+ com.massivecraft.factions.entity.Faction otherFac = FactionColl.get()
+ .get(otherFaction.getId());
+
+ if (otherFac == null)
+ return;
+
+ Rel rel = Rel.valueOf(relation.toUpperCase());
+
+ if (rel == null)
+ return;
+
+ faction.setRelationWish(otherFac, rel);
+ }
+
+ /**
+ * Gets the relation of this faction to another faction.
+ * Will return a relationship type. This can be ALLY, TRUCE, NEUTRAL and
+ * ENEMY.
+ *
+ * @param otherFaction Other faction.
+ * @return A relationship type or null if the other faction was not found.
+ */
+ public String getRelationTo(Faction otherFaction) {
+ com.massivecraft.factions.entity.Faction otherFac = FactionColl.get()
+ .get(otherFaction.getId());
+
+ if (otherFac == null)
+ return null;
+
+ Rel rel = faction.getRelationTo(otherFac);
+
+ if (rel == null)
+ return null;
+
+ return rel.toString();
+ }
+
+ /**
+ * Gets a list of online players that are member of this faction.
+ *
+ * @return a list containing all online-member players.
+ */
+ public List
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.
+ * @return Unique name of Faction without colour codes.
+ */
+ public String getComparisonName() {
+ return faction.getComparisonName();
+ }
}
\ No newline at end of file
diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/factions/MPlayer.java b/src/me/staartvin/plugins/pluginlibrary/hooks/factions/MPlayer.java
index 55e4528..5267f8f 100644
--- a/src/me/staartvin/plugins/pluginlibrary/hooks/factions/MPlayer.java
+++ b/src/me/staartvin/plugins/pluginlibrary/hooks/factions/MPlayer.java
@@ -1,279 +1,279 @@
-package me.staartvin.plugins.pluginlibrary.hooks.factions;
-
-import java.util.UUID;
-
-import com.massivecraft.factions.Rel;
-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()}.
- *
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.
- * @return The faction a player is part of.
- */
- public Faction getFaction() {
- return new Faction(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.
- * @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.
- */
- public void setRole(String role) {
- Rel rel = Rel.valueOf(role);
-
- 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.
- * @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.
- */
- 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.
- */
- public void setPowerBoost(double boost) {
- mPlayer.setPower(boost);
- }
-
- /**
- * Gets the maximum power this player can have.
- * @return Maximum power.
- */
- public double getPowerMax() {
- return mPlayer.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() {
- return mPlayer.getPowerMax();
- }
-
- /**
- * 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.
- */
- 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.
- */
- 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).
- * @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.
- * @return A relation type or null if the other player was not found.
- */
- public String getRelationTo(MPlayer otherPlayer) {
- 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;
-
- 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.
- * @return A relation type or null if the faction was not found.
- */
- public String getRelationTo(Faction faction) {
- if (faction == null) return null;
-
- Rel rel = mPlayer.getRelationTo(FactionColl.get().get(faction.getId()));
-
- 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.
- * @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.
- */
- 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();
- }
-
-}
+package me.staartvin.plugins.pluginlibrary.hooks.factions;
+
+import java.util.UUID;
+
+import com.massivecraft.factions.Rel;
+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()}.
+ *
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.
+ * @return The faction a player is part of.
+ */
+ public Faction getFaction() {
+ return new Faction(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.
+ * @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.
+ */
+ public void setRole(String role) {
+ Rel rel = Rel.valueOf(role);
+
+ 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.
+ * @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.
+ */
+ 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.
+ */
+ public void setPowerBoost(double boost) {
+ mPlayer.setPower(boost);
+ }
+
+ /**
+ * Gets the maximum power this player can have.
+ * @return Maximum power.
+ */
+ public double getPowerMax() {
+ return mPlayer.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() {
+ return mPlayer.getPowerMax();
+ }
+
+ /**
+ * 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.
+ */
+ 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.
+ */
+ 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).
+ * @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.
+ * @return A relation type or null if the other player was not found.
+ */
+ public String getRelationTo(MPlayer otherPlayer) {
+ 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;
+
+ 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.
+ * @return A relation type or null if the faction was not found.
+ */
+ public String getRelationTo(Faction faction) {
+ if (faction == null) return null;
+
+ Rel rel = mPlayer.getRelationTo(FactionColl.get().get(faction.getId()));
+
+ 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.
+ * @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.
+ */
+ 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 88d3e9e..14f94e1 100644
--- a/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerEatsFoodListener.java
+++ b/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerEatsFoodListener.java
@@ -1,61 +1,61 @@
-package me.staartvin.plugins.pluginlibrary.listeners;
-
-import me.staartvin.plugins.pluginlibrary.Library;
-import me.staartvin.plugins.pluginlibrary.PluginLibrary;
-import me.staartvin.plugins.pluginlibrary.hooks.StatsHook;
-import me.staartvin.plugins.pluginlibrary.hooks.customstats.FoodEatenStat;
-import me.staartvin.plugins.pluginlibrary.util.Util;
-import nl.lolmewn.stats.api.stat.Stat;
-import nl.lolmewn.stats.api.user.StatsHolder;
-import nl.lolmewn.stats.stat.DefaultStatEntry;
-import nl.lolmewn.stats.stat.MetadataPair;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerItemConsumeEvent;
-
-/**
- * This listener will listen to players eating food (for custom stat)
- *
- * @author Staartvin
- *
- */
-public class PlayerEatsFoodListener implements Listener {
-
- private final PluginLibrary plugin;
- private final StatsHook hook;
-
- public PlayerEatsFoodListener(final PluginLibrary instance) {
- plugin = instance;
- hook = (StatsHook) PluginLibrary.getLibrary(Library.STATS);
- }
-
- @EventHandler
- public void OnEat(final PlayerItemConsumeEvent event) {
-
- if (event.isCancelled())
- return;
-
- // Stats is not available
- if (!plugin.isLibraryLoaded(Library.STATS))
- return;
-
- Player p = event.getPlayer();
-
- String foodName = Util.getFoodName(event.getItem());
-
- if (foodName == null)
- return;
-
- Stat stat = hook.getStat(FoodEatenStat.statName);
-
- StatsHolder holder = hook.getStatsHolder(p.getUniqueId());
-
- holder.addEntry(stat, new DefaultStatEntry(1, new MetadataPair(
- "foodType", foodName), new MetadataPair("world", p.getWorld()
- .getName())));
-
- }
-
-}
+package me.staartvin.plugins.pluginlibrary.listeners;
+
+import me.staartvin.plugins.pluginlibrary.Library;
+import me.staartvin.plugins.pluginlibrary.PluginLibrary;
+import me.staartvin.plugins.pluginlibrary.hooks.StatsHook;
+import me.staartvin.plugins.pluginlibrary.hooks.customstats.FoodEatenStat;
+import me.staartvin.plugins.pluginlibrary.util.Util;
+import nl.lolmewn.stats.api.stat.Stat;
+import nl.lolmewn.stats.api.user.StatsHolder;
+import nl.lolmewn.stats.stat.DefaultStatEntry;
+import nl.lolmewn.stats.stat.MetadataPair;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerItemConsumeEvent;
+
+/**
+ * This listener will listen to players eating food (for custom stat)
+ *
+ * @author Staartvin
+ *
+ */
+public class PlayerEatsFoodListener implements Listener {
+
+ private final PluginLibrary plugin;
+ private final StatsHook hook;
+
+ public PlayerEatsFoodListener(final PluginLibrary instance) {
+ plugin = instance;
+ hook = (StatsHook) PluginLibrary.getLibrary(Library.STATS);
+ }
+
+ @EventHandler
+ public void OnEat(final PlayerItemConsumeEvent event) {
+
+ if (event.isCancelled())
+ return;
+
+ // Stats is not available
+ if (!plugin.isLibraryLoaded(Library.STATS))
+ return;
+
+ Player p = event.getPlayer();
+
+ String foodName = Util.getFoodName(event.getItem());
+
+ if (foodName == null)
+ return;
+
+ Stat stat = hook.getStat(FoodEatenStat.statName);
+
+ StatsHolder holder = hook.getStatsHolder(p.getUniqueId());
+
+ 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 112161e..2727b4f 100644
--- a/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerKillsMobListener.java
+++ b/src/me/staartvin/plugins/pluginlibrary/listeners/PlayerKillsMobListener.java
@@ -1,113 +1,113 @@
-package me.staartvin.plugins.pluginlibrary.listeners;
-
-import me.staartvin.plugins.pluginlibrary.Library;
-import me.staartvin.plugins.pluginlibrary.PluginLibrary;
-import me.staartvin.plugins.pluginlibrary.hooks.StatsHook;
-import me.staartvin.plugins.pluginlibrary.hooks.customstats.MobKilledStat;
-import nl.lolmewn.stats.api.stat.Stat;
-import nl.lolmewn.stats.api.user.StatsHolder;
-import nl.lolmewn.stats.stat.DefaultStatEntry;
-import nl.lolmewn.stats.stat.MetadataPair;
-
-import org.bukkit.entity.Chicken;
-import org.bukkit.entity.Creeper;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Guardian;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Rabbit;
-import org.bukkit.entity.Rabbit.Type;
-import org.bukkit.entity.Skeleton;
-import org.bukkit.entity.Skeleton.SkeletonType;
-import org.bukkit.entity.Spider;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDeathEvent;
-
-/**
- * This listener will listen to players killing mobs (for custom stat)
- *
- * @author Staartvin
- *
- */
-public class PlayerKillsMobListener implements Listener {
-
- private final PluginLibrary plugin;
- private final StatsHook hook;
-
- public PlayerKillsMobListener(final PluginLibrary instance) {
- plugin = instance;
- hook = (StatsHook) PluginLibrary.getLibrary(Library.STATS);
- }
-
- @EventHandler
- public void OnKill(final EntityDeathEvent event) {
-
- // Stats is not available
- if (!plugin.isLibraryLoaded(Library.STATS))
- return;
-
- final Entity e = event.getEntity();
- if (e.getLastDamageCause() instanceof EntityDamageByEntityEvent) {
- final EntityDamageByEntityEvent nEvent = (EntityDamageByEntityEvent) e
- .getLastDamageCause();
- if (nEvent.getDamager() instanceof Player) {
-
- String extraType = null;
-
- if (e instanceof Skeleton) {
- Skeleton ske = (Skeleton) e;
-
- if (ske.getSkeletonType() == SkeletonType.WITHER) {
- extraType = "WITHER";
- }
- } else if (e instanceof Creeper) {
- Creeper cre = (Creeper) e;
-
- if (cre.isPowered()) {
- extraType = "POWERED";
- }
- } else if (e instanceof Chicken) {
- Chicken mob = (Chicken) e;
-
- if (mob.getPassenger() != null) {
- extraType = "JOCKEY";
- }
- } else if (e instanceof Rabbit) {
- Rabbit mob = (Rabbit) e;
-
- if (mob.getRabbitType() == Type.THE_KILLER_BUNNY) {
- extraType = "KILLER";
- }
- } else if (e instanceof Spider) {
- Spider mob = (Spider) e;
-
- if (mob.getPassenger() != null) {
- extraType = "JOCKEY";
- }
- } else if (e instanceof Guardian) {
- Guardian mob = (Guardian) e;
-
- if (mob.isElder()) {
- extraType = "ELDER";
- }
- }
-
- if (extraType == null) {
- return;
- }
-
- Stat mobkilled = hook.getStat(MobKilledStat.statName);
-
- 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())));
- }
- }
- }
-}
+package me.staartvin.plugins.pluginlibrary.listeners;
+
+import me.staartvin.plugins.pluginlibrary.Library;
+import me.staartvin.plugins.pluginlibrary.PluginLibrary;
+import me.staartvin.plugins.pluginlibrary.hooks.StatsHook;
+import me.staartvin.plugins.pluginlibrary.hooks.customstats.MobKilledStat;
+import nl.lolmewn.stats.api.stat.Stat;
+import nl.lolmewn.stats.api.user.StatsHolder;
+import nl.lolmewn.stats.stat.DefaultStatEntry;
+import nl.lolmewn.stats.stat.MetadataPair;
+
+import org.bukkit.entity.Chicken;
+import org.bukkit.entity.Creeper;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Guardian;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Rabbit;
+import org.bukkit.entity.Rabbit.Type;
+import org.bukkit.entity.Skeleton;
+import org.bukkit.entity.Skeleton.SkeletonType;
+import org.bukkit.entity.Spider;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.EntityDeathEvent;
+
+/**
+ * This listener will listen to players killing mobs (for custom stat)
+ *
+ * @author Staartvin
+ *
+ */
+public class PlayerKillsMobListener implements Listener {
+
+ private final PluginLibrary plugin;
+ private final StatsHook hook;
+
+ public PlayerKillsMobListener(final PluginLibrary instance) {
+ plugin = instance;
+ hook = (StatsHook) PluginLibrary.getLibrary(Library.STATS);
+ }
+
+ @EventHandler
+ public void OnKill(final EntityDeathEvent event) {
+
+ // Stats is not available
+ if (!plugin.isLibraryLoaded(Library.STATS))
+ return;
+
+ final Entity e = event.getEntity();
+ if (e.getLastDamageCause() instanceof EntityDamageByEntityEvent) {
+ final EntityDamageByEntityEvent nEvent = (EntityDamageByEntityEvent) e
+ .getLastDamageCause();
+ if (nEvent.getDamager() instanceof Player) {
+
+ String extraType = null;
+
+ if (e instanceof Skeleton) {
+ Skeleton ske = (Skeleton) e;
+
+ if (ske.getSkeletonType() == SkeletonType.WITHER) {
+ extraType = "WITHER";
+ }
+ } else if (e instanceof Creeper) {
+ Creeper cre = (Creeper) e;
+
+ if (cre.isPowered()) {
+ extraType = "POWERED";
+ }
+ } else if (e instanceof Chicken) {
+ Chicken mob = (Chicken) e;
+
+ if (mob.getPassenger() != null) {
+ extraType = "JOCKEY";
+ }
+ } else if (e instanceof Rabbit) {
+ Rabbit mob = (Rabbit) e;
+
+ if (mob.getRabbitType() == Type.THE_KILLER_BUNNY) {
+ extraType = "KILLER";
+ }
+ } else if (e instanceof Spider) {
+ Spider mob = (Spider) e;
+
+ if (mob.getPassenger() != null) {
+ extraType = "JOCKEY";
+ }
+ } else if (e instanceof Guardian) {
+ Guardian mob = (Guardian) e;
+
+ if (mob.isElder()) {
+ extraType = "ELDER";
+ }
+ }
+
+ if (extraType == null) {
+ return;
+ }
+
+ Stat mobkilled = hook.getStat(MobKilledStat.statName);
+
+ 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())));
+ }
+ }
+ }
+}
diff --git a/src/me/staartvin/plugins/pluginlibrary/util/Util.java b/src/me/staartvin/plugins/pluginlibrary/util/Util.java
index 1892ee7..19ad2ed 100644
--- a/src/me/staartvin/plugins/pluginlibrary/util/Util.java
+++ b/src/me/staartvin/plugins/pluginlibrary/util/Util.java
@@ -1,182 +1,182 @@
-package me.staartvin.plugins.pluginlibrary.util;
-
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
-/**
- * Util class
- *