Squashed commit of the following:

commit cb3e057dee1f2b29838ab654a526baac1baab7d6
Author: NuclearW <incongruency@gmail.com>
Date:   Fri Mar 1 00:43:57 2013 -0500

    1.4.00 release

commit 4f9628d2e4cde31c8946e9a911ee6f10e1fb6b35
Author: NuclearW <incongruency@gmail.com>
Date:   Fri Mar 1 00:07:30 2013 -0500

    \r -> \n

commit b2ca22e0477c747143b0f08a28a096967ee6ffd7
Author: GJ <gjmcferrin@gmail.com>
Date:   Thu Feb 28 23:53:56 2013 -0500

    Commented-out code shouldn't be done like that.

commit 92f131712cc671e3e616c14a22e22769ef6d6d0b
Author: GJ <gjmcferrin@gmail.com>
Date:   Thu Feb 28 23:45:36 2013 -0500

    More things we missed.

commit 408b03766f6261a03a862a1ab7f5835772feda4a
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 23:20:13 2013 -0500

    Format: util through spout and backup lib

commit d6bd2c29bbb51bee3607247468cfe145d4f38c9e
Author: GJ <gjmcferrin@gmail.com>
Date:   Thu Feb 28 22:50:08 2013 -0500

    The things we missed the first time through...

commit 393f0b889aa1b7011ee81ee7b15413d8824b8cfb
Author: GJ <gjmcferrin@gmail.com>
Date:   Thu Feb 28 22:05:29 2013 -0500

    Formatting: Skills

commit c097a6e188a7b760dd1b4389ed81dca417146b16
Author: GJ <gjmcferrin@gmail.com>
Date:   Thu Feb 28 19:30:12 2013 -0500

    Organize imports.

commit 34c3e74be7eb5f983f21d969e30155c5d82c01c1
Author: GJ <gjmcferrin@gmail.com>
Date:   Thu Feb 28 19:09:45 2013 -0500

    Fixed a missing fallthrough comment from ChatCommand

commit b4a76c9f022a2fd98bdd8f083accfea03becfd71
Author: GJ <gjmcferrin@gmail.com>
Date:   Thu Feb 28 19:09:36 2013 -0500

    Formatting: datatypes.* through events.*

commit 3e57dd41d3265a7c8106c7eb026df926770a4d15
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 17:56:15 2013 -0500

    Fix issue with bad rebase

commit e8c8e06b2971555b7334e49128257e3af6f36892
Author: GJ <gjmcferrin@gmail.com>
Date:   Thu Feb 28 17:35:32 2013 -0500

    Formatting: DatabaseManager, LeaderboardManager, DatabaseUpdateType, and
    PlayerStat

commit 13ecf1cc41f377a12991e357ac10abdcda24d6de
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 17:31:43 2013 -0500

    Format: listeners.* through runnables.*

commit 71686e3c0d96c2dcf25442b91703fadda1ea3bb0
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 17:13:57 2013 -0500

    Format PartyLockCommand

commit d50abed10bf94e1a88df3dc5cc07c259aea920ea
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 16:54:08 2013 -0500

    Format: base through config.*

commit 7004823eeebbae5be7728bf9cafc3b04e57b64cf
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 15:21:40 2013 -0500

    Example of using spaces to align like things

commit 534190cfe2481e466fe459d65628550458cc2993
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 15:12:19 2013 -0500

    Capitalization

commit 5b61d3ba4c8d81e6f358b0cf4f460abfe9798414
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 15:07:43 2013 -0500

    Updated readme, added standards.md

commit 5ec0df70fb82c527420a2f437f27f31bd758f884
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 14:42:16 2013 -0500

    Markdown was here, Creole is a loser

commit 70d557c59d086b6a5fb5e0e63c0c1d8eb4c8d19c
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 13:46:24 2013 -0500

    Move MCStats shading to .metrics.mcstats

commit eb9d67e66b1659d6abd2397ecf403343cfeffdda
Author: GJ <gjmcferrin@gmail.com>
Date:   Thu Feb 28 13:37:37 2013 -0500

    Move ALL the packages!

commit 8ffa9e7b75417b6c7f158613d4b4ffb783dcf2d0
Author: NuclearW <incongruency@gmail.com>
Date:   Thu Feb 28 12:37:12 2013 -0500

    /r/n -> /n
This commit is contained in:
NuclearW
2013-03-01 00:52:01 -05:00
parent 13111a8d1b
commit a542d6cf3e
263 changed files with 24364 additions and 23982 deletions

View File

@ -1,51 +1,51 @@
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.skills.utilities.AbilityType;
import com.gmail.nossr50.util.Users;
public final class AbilityAPI {
private AbilityAPI() {}
public static boolean berserkEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.BERSERK);
}
public static boolean gigaDrillBreakerEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
}
public static boolean greenTerraEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.GREEN_TERRA);
}
public static boolean serratedStrikesEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SERRATED_STRIKES);
}
public static boolean skullSplitterEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER);
}
public static boolean superBreakerEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SUPER_BREAKER);
}
public static boolean treeFellerEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.TREE_FELLER);
}
public static boolean isAnyAbilityEnabled(Player player) {
PlayerProfile profile = Users.getPlayer(player).getProfile();
for (AbilityType ability : AbilityType.values()) {
if (profile.getAbilityMode(ability)) {
return true;
}
}
return false;
}
}
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.util.player.UserManager;
public final class AbilityAPI {
private AbilityAPI() {}
public static boolean berserkEnabled(Player player) {
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.BERSERK);
}
public static boolean gigaDrillBreakerEnabled(Player player) {
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
}
public static boolean greenTerraEnabled(Player player) {
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.GREEN_TERRA);
}
public static boolean serratedStrikesEnabled(Player player) {
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.SERRATED_STRIKES);
}
public static boolean skullSplitterEnabled(Player player) {
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER);
}
public static boolean superBreakerEnabled(Player player) {
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.SUPER_BREAKER);
}
public static boolean treeFellerEnabled(Player player) {
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.TREE_FELLER);
}
public static boolean isAnyAbilityEnabled(Player player) {
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
for (AbilityType ability : AbilityType.values()) {
if (profile.getAbilityMode(ability)) {
return true;
}
}
return false;
}
}

View File

@ -5,7 +5,7 @@ import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.player.UserManager;
public final class ChatAPI {
private ChatAPI() {}
@ -104,7 +104,7 @@ public final class ChatAPI {
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(Player player) {
return Users.getPlayer(player).getPartyChatMode();
return UserManager.getPlayer(player).getPartyChatMode();
}
/**
@ -114,7 +114,7 @@ public final class ChatAPI {
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(String playerName) {
return Users.getPlayer(playerName).getPartyChatMode();
return UserManager.getPlayer(playerName).getPartyChatMode();
}
/**
@ -124,7 +124,7 @@ public final class ChatAPI {
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(Player player) {
return Users.getPlayer(player).getAdminChatMode();
return UserManager.getPlayer(player).getAdminChatMode();
}
/**
@ -134,6 +134,6 @@ public final class ChatAPI {
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(String playerName) {
return Users.getPlayer(playerName).getAdminChatMode();
return UserManager.getPlayer(playerName).getAdminChatMode();
}
}

View File

@ -1,335 +1,335 @@
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.Users;
public final class ExperienceAPI {
private ExperienceAPI() {}
/**
* Check the XP of a player. This should be called after giving XP to process level-ups.
*
* @param player The player to check
* @param skillType The skill to check
* @deprecated Calling this function is no longer needed and should be avoided
*/
@Deprecated
private static void checkXP(Player player, SkillType skillType) {
SkillTools.xpCheckSkill(skillType, player, Users.getProfile(player));
}
/**
* Adds raw XP to the player.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @deprecated Use {@link #addRawXP(Player, String, int)} instead
*/
@Deprecated
public static void addRawXP(Player player, SkillType skillType, int XP) {
Users.getPlayer(player).applyXpGain(skillType, XP);
}
/**
* Adds raw XP to the player.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public static void addRawXP(Player player, String skillType, int XP) {
Users.getPlayer(player).applyXpGain(SkillType.getSkill(skillType), XP);
}
/**
* Adds XP to the player, calculates for XP Rate only.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @deprecated Use {@link #addMultipliedXP(Player, String, int)} instead
*/
@Deprecated
public static void addMultipliedXP(Player player, SkillType skillType, int XP) {
Users.getPlayer(player).applyXpGain(skillType, (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
* Adds XP to the player, calculates for XP Rate only.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public static void addMultipliedXP(Player player, String skillType, int XP) {
Users.getPlayer(player).applyXpGain(SkillType.getSkill(skillType), (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @deprecated Use {@link #addXP(Player, String, int)} instead
*/
@Deprecated
public static void addXP(Player player, SkillType skillType, int XP) {
Users.getPlayer(player).beginXpGain(skillType, XP);
}
/**
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public static void addXP(Player player, String skillType, int XP) {
Users.getPlayer(player).beginXpGain(SkillType.getSkill(skillType), XP);
}
/**
* Get the amount of XP a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @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
* @deprecated Use {@link #getXP(Player, String)} instead
*/
@Deprecated
public static int getXP(Player player, SkillType skillType) {
return Users.getPlayer(player).getProfile().getSkillXpLevel(skillType);
}
/**
* Get the amount of XP a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @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
*/
public static int getXP(Player player, String skillType) {
return Users.getPlayer(player).getProfile().getSkillXpLevel(SkillType.getSkill(skillType));
}
/**
* Get the amount of XP left before leveling up.
* </br>
* This function is designed for API usage.
*
* @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 left before leveling up a specifc skill
* @deprecated Use {@link #getXPToNextLevel(Player, String)} instead
*/
@Deprecated
public static int getXPToNextLevel(Player player, SkillType skillType) {
return Users.getPlayer(player).getProfile().getXpToLevel(skillType);
}
/**
* Get the amount of XP left before leveling up.
* </br>
* This function is designed for API usage.
*
* @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 left before leveling up a specifc skill
*/
public static int getXPToNextLevel(Player player, String skillType) {
return Users.getPlayer(player).getProfile().getXpToLevel(SkillType.getSkill(skillType));
}
/**
* Add levels to a skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
* @param notify Unused argument
* @deprecated Use addLevel(Player, SKillType, int) instead
*/
public static void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
Users.getProfile(player).addLevels(skillType, levels);
if (notify) {
checkXP(player, skillType);
}
}
/**
* Add levels to a skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
* @deprecated Use {@link #addLevel(Player, String, int)} instead
*/
@Deprecated
public static void addLevel(Player player, SkillType skillType, int levels) {
Users.getPlayer(player).getProfile().addLevels(skillType, levels);
}
/**
* Add levels to a skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
*/
public static void addLevel(Player player, String skillType, int levels) {
Users.getPlayer(player).getProfile().addLevels(SkillType.getSkill(skillType), levels);
}
/**
* Get the level a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @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
* @deprecated Use {@link #getLevel(Player, String)} instead
*/
@Deprecated
public static int getLevel(Player player, SkillType skillType) {
return Users.getPlayer(player).getProfile().getSkillLevel(skillType);
}
/**
* Get the level a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @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
*/
public static int getLevel(Player player, String skillType) {
return Users.getPlayer(player).getProfile().getSkillLevel(SkillType.getSkill(skillType));
}
/**
* Gets the power level of a player.
* </br>
* This function is designed for API usage.
*
* @param player The player to get the power level for
* @return the power level of the player
*/
public static int getPowerLevel(Player player) {
return Users.getPlayer(player).getPowerLevel();
}
/**
* Sets the level of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to set the level of
* @param skillType The skill to set the level for
* @param skillLevel The value to set the level to
* @deprecated Use {@link #setLevel(Player, String, int)} instead
*/
@Deprecated
public static void setLevel(Player player, SkillType skillType, int skillLevel) {
Users.getPlayer(player).getProfile().modifySkill(skillType, skillLevel);
}
/**
* Sets the level of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to set the level of
* @param skillType The skill to set the level for
* @param skillLevel The value to set the level to
*/
public static void setLevel(Player player, String skillType, int skillLevel) {
Users.getPlayer(player).getProfile().modifySkill(SkillType.getSkill(skillType), skillLevel);
}
/**
* Sets the XP of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @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
* @deprecated Use {@link #setXP(Player, String, int)} instead
*/
@Deprecated
public static void setXP(Player player, SkillType skillType, int newValue) {
Users.getPlayer(player).getProfile().setSkillXpLevel(skillType, newValue);
}
/**
* Sets the XP of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @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
*/
public static void setXP(Player player, String skillType, int newValue) {
Users.getPlayer(player).getProfile().setSkillXpLevel(SkillType.getSkill(skillType), newValue);
}
/**
* Removes XP from a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @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
* @deprecated Use {@link #removeXP(Player, String, int)} instead
*/
@Deprecated
public static void removeXP(Player player, SkillType skillType, int xp) {
Users.getPlayer(player).getProfile().removeXp(skillType, xp);
}
/**
* Removes XP from a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @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
*/
public static void removeXP(Player player, String skillType, int xp) {
Users.getPlayer(player).getProfile().removeXp(SkillType.getSkill(skillType), xp);
}
}
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
public final class ExperienceAPI {
private ExperienceAPI() {}
/**
* Adds raw XP to the player.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @deprecated Use {@link #addRawXP(Player, String, int)} instead
*/
@Deprecated
public static void addRawXP(Player player, SkillType skillType, int XP) {
UserManager.getPlayer(player).applyXpGain(skillType, XP);
}
/**
* Adds raw XP to the player.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public static void addRawXP(Player player, String skillType, int XP) {
UserManager.getPlayer(player).applyXpGain(SkillType.getSkill(skillType), XP);
}
/**
* Adds XP to the player, calculates for XP Rate only.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @deprecated Use {@link #addMultipliedXP(Player, String, int)} instead
*/
@Deprecated
public static void addMultipliedXP(Player player, SkillType skillType, int XP) {
UserManager.getPlayer(player).applyXpGain(skillType, (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
* Adds XP to the player, calculates for XP Rate only.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public static void addMultipliedXP(Player player, String skillType, int XP) {
UserManager.getPlayer(player).applyXpGain(SkillType.getSkill(skillType), (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @deprecated Use {@link #addXP(Player, String, int)} instead
*/
@Deprecated
public static void addXP(Player player, SkillType skillType, int XP) {
UserManager.getPlayer(player).beginXpGain(skillType, XP);
}
/**
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public static void addXP(Player player, String skillType, int XP) {
UserManager.getPlayer(player).beginXpGain(SkillType.getSkill(skillType), XP);
}
/**
* Get the amount of XP a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @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
* @deprecated Use {@link #getXP(Player, String)} instead
*/
@Deprecated
public static int getXP(Player player, SkillType skillType) {
return UserManager.getPlayer(player).getProfile().getSkillXpLevel(skillType);
}
/**
* Get the amount of XP a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @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
*/
public static int getXP(Player player, String skillType) {
return UserManager.getPlayer(player).getProfile().getSkillXpLevel(SkillType.getSkill(skillType));
}
/**
* Get the amount of XP left before leveling up.
* </br>
* This function is designed for API usage.
*
* @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 left before leveling up a specifc skill
* @deprecated Use {@link #getXPToNextLevel(Player, String)} instead
*/
@Deprecated
public static int getXPToNextLevel(Player player, SkillType skillType) {
return UserManager.getPlayer(player).getProfile().getXpToLevel(skillType);
}
/**
* Get the amount of XP left before leveling up.
* </br>
* This function is designed for API usage.
*
* @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 left before leveling up a specifc skill
*/
public static int getXPToNextLevel(Player player, String skillType) {
return UserManager.getPlayer(player).getProfile().getXpToLevel(SkillType.getSkill(skillType));
}
/**
* Add levels to a skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
* @param notify Unused argument
* @deprecated Use addLevel(Player, SKillType, int) instead
*/
public static void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
UserManager.getProfile(player).addLevels(skillType, levels);
if (notify) {
checkXP(player, skillType);
}
}
/**
* Add levels to a skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
* @deprecated Use {@link #addLevel(Player, String, int)} instead
*/
@Deprecated
public static void addLevel(Player player, SkillType skillType, int levels) {
UserManager.getPlayer(player).getProfile().addLevels(skillType, levels);
}
/**
* Add levels to a skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
*/
public static void addLevel(Player player, String skillType, int levels) {
UserManager.getPlayer(player).getProfile().addLevels(SkillType.getSkill(skillType), levels);
}
/**
* Get the level a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @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
* @deprecated Use {@link #getLevel(Player, String)} instead
*/
@Deprecated
public static int getLevel(Player player, SkillType skillType) {
return UserManager.getPlayer(player).getProfile().getSkillLevel(skillType);
}
/**
* Get the level a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @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
*/
public static int getLevel(Player player, String skillType) {
return UserManager.getPlayer(player).getProfile().getSkillLevel(SkillType.getSkill(skillType));
}
/**
* Gets the power level of a player.
* </br>
* This function is designed for API usage.
*
* @param player The player to get the power level for
* @return the power level of the player
*/
public static int getPowerLevel(Player player) {
return UserManager.getPlayer(player).getPowerLevel();
}
/**
* Sets the level of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to set the level of
* @param skillType The skill to set the level for
* @param skillLevel The value to set the level to
* @deprecated Use {@link #setLevel(Player, String, int)} instead
*/
@Deprecated
public static void setLevel(Player player, SkillType skillType, int skillLevel) {
UserManager.getPlayer(player).getProfile().modifySkill(skillType, skillLevel);
}
/**
* Sets the level of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to set the level of
* @param skillType The skill to set the level for
* @param skillLevel The value to set the level to
*/
public static void setLevel(Player player, String skillType, int skillLevel) {
UserManager.getPlayer(player).getProfile().modifySkill(SkillType.getSkill(skillType), skillLevel);
}
/**
* Sets the XP of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @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
* @deprecated Use {@link #setXP(Player, String, int)} instead
*/
@Deprecated
public static void setXP(Player player, SkillType skillType, int newValue) {
UserManager.getPlayer(player).getProfile().setSkillXpLevel(skillType, newValue);
}
/**
* Sets the XP of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @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
*/
public static void setXP(Player player, String skillType, int newValue) {
UserManager.getPlayer(player).getProfile().setSkillXpLevel(SkillType.getSkill(skillType), newValue);
}
/**
* Removes XP from a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @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
* @deprecated Use {@link #removeXP(Player, String, int)} instead
*/
@Deprecated
public static void removeXP(Player player, SkillType skillType, int xp) {
UserManager.getPlayer(player).getProfile().removeXp(skillType, xp);
}
/**
* Removes XP from a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @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
*/
public static void removeXP(Player player, String skillType, int xp) {
UserManager.getPlayer(player).getProfile().removeXp(SkillType.getSkill(skillType), xp);
}
/**
* Check the XP of a player. This should be called after giving XP to process level-ups.
*
* @param player The player to check
* @param skillType The skill to check
* @deprecated Calling this function is no longer needed and should be avoided
*/
@Deprecated
private static void checkXP(Player player, SkillType skillType) {
SkillUtils.xpCheckSkill(skillType, player, UserManager.getProfile(player));
}
}

View File

@ -1,174 +1,174 @@
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public final class PartyAPI {
private PartyAPI() {}
/**
* Get the name of the party a player is in.
* </br>
* This function is designed for API usage.
*
* @param player The player to check the party name of
* @return the name of the player's party
*/
public static String getPartyName(Player player) {
return Users.getPlayer(player).getParty().getName();
}
/**
* Checks if a player is in a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return true if the player is in a party, false otherwise
*/
public static boolean inParty(Player player) {
return Users.getPlayer(player).inParty();
}
/**
* Check if two players are in the same party.
* </br>
* This function is designed for API usage.
*
* @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 static boolean inSameParty(Player playera, Player playerb) {
return PartyManager.inSameParty(playera, playerb);
}
/**
* Get a list of all current parties.
* </br>
* This function is designed for API usage.
*
* @return the list of parties.
*/
public static List<Party> getParties() {
return PartyManager.getParties();
}
/**
* Add a player to a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to add to the party
* @param partyName The party to add the player to
*/
public static void addToParty(Player player, String partyName) {
Party party = PartyManager.getParty(partyName);
if (party == null) {
party = new Party();
party.setName(partyName);
party.setLeader(player.getName());
}
PartyManager.addToParty(player, Users.getPlayer(player), party);
}
/**
* Remove a player from a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to remove
*/
public static void removeFromParty(Player player) {
PartyManager.removeFromParty(player, Users.getPlayer(player).getParty());
}
/**
* Get the leader of a party.
* </br>
* This function is designed for API usage.
*
* @param partyName The party name
* @return the leader of the party
*/
public static String getPartyLeader(String partyName) {
return PartyManager.getPartyLeader(partyName);
}
/**
* Set the leader of a party.
* </br>
* This function is designed for API usage.
*
* @param partyName The name of the party to set the leader of
* @param player The player to set as leader
*/
public static void setPartyLeader(String partyName, String player) {
PartyManager.setPartyLeader(player, PartyManager.getParty(partyName));
}
/**
* Get a list of all players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all the players in the player's party
* @deprecated
*/
@Deprecated
public static List<String> getAllMembers(Player player) {
List<String> memberNames = new ArrayList<String>();
for (OfflinePlayer member : PartyManager.getAllMembers(player)) {
memberNames.add(member.getName());
}
return memberNames;
}
/**
* Get a list of all players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all the players in the player's party
*/
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
return PartyManager.getAllMembers(player);
}
/**
* Get a list of all online players in this party.
* </br>
* This function is designed for API usage.
*
* @param partyName The party to check
* @return all online players in this party
*/
public static List<Player> getOnlineMembers(String partyName) {
return PartyManager.getOnlineMembers(partyName);
}
/**
* Get a list of all online players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all online players in the player's party
*/
public static List<Player> getOnlineMembers(Player player) {
return PartyManager.getOnlineMembers(player);
}
}
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
public final class PartyAPI {
private PartyAPI() {}
/**
* Get the name of the party a player is in.
* </br>
* This function is designed for API usage.
*
* @param player The player to check the party name of
* @return the name of the player's party
*/
public static String getPartyName(Player player) {
return UserManager.getPlayer(player).getParty().getName();
}
/**
* Checks if a player is in a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return true if the player is in a party, false otherwise
*/
public static boolean inParty(Player player) {
return UserManager.getPlayer(player).inParty();
}
/**
* Check if two players are in the same party.
* </br>
* This function is designed for API usage.
*
* @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 static boolean inSameParty(Player playera, Player playerb) {
return PartyManager.inSameParty(playera, playerb);
}
/**
* Get a list of all current parties.
* </br>
* This function is designed for API usage.
*
* @return the list of parties.
*/
public static List<Party> getParties() {
return PartyManager.getParties();
}
/**
* Add a player to a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to add to the party
* @param partyName The party to add the player to
*/
public static void addToParty(Player player, String partyName) {
Party party = PartyManager.getParty(partyName);
if (party == null) {
party = new Party();
party.setName(partyName);
party.setLeader(player.getName());
}
PartyManager.addToParty(player, UserManager.getPlayer(player), party);
}
/**
* Remove a player from a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to remove
*/
public static void removeFromParty(Player player) {
PartyManager.removeFromParty(player, UserManager.getPlayer(player).getParty());
}
/**
* Get the leader of a party.
* </br>
* This function is designed for API usage.
*
* @param partyName The party name
* @return the leader of the party
*/
public static String getPartyLeader(String partyName) {
return PartyManager.getPartyLeader(partyName);
}
/**
* Set the leader of a party.
* </br>
* This function is designed for API usage.
*
* @param partyName The name of the party to set the leader of
* @param player The player to set as leader
*/
public static void setPartyLeader(String partyName, String player) {
PartyManager.setPartyLeader(player, PartyManager.getParty(partyName));
}
/**
* Get a list of all players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all the players in the player's party
* @deprecated
*/
@Deprecated
public static List<String> getAllMembers(Player player) {
List<String> memberNames = new ArrayList<String>();
for (OfflinePlayer member : PartyManager.getAllMembers(player)) {
memberNames.add(member.getName());
}
return memberNames;
}
/**
* Get a list of all players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all the players in the player's party
*/
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
return PartyManager.getAllMembers(player);
}
/**
* Get a list of all online players in this party.
* </br>
* This function is designed for API usage.
*
* @param partyName The party to check
* @return all online players in this party
*/
public static List<Player> getOnlineMembers(String partyName) {
return PartyManager.getOnlineMembers(partyName);
}
/**
* Get a list of all online players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all online players in the player's party
*/
public static List<Player> getOnlineMembers(Player player) {
return PartyManager.getOnlineMembers(player);
}
}

View File

@ -1,28 +1,29 @@
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.spout.SpoutConfig;
import com.gmail.nossr50.spout.huds.HudType;
import com.gmail.nossr50.util.Users;
public class SpoutHudAPI {
/**
* Disable the mcMMO XP bar for a player.
* </br>
* This function is designed for API usage.
*/
public static void disableXpBar(Player player) {
Users.getPlayer(player).getProfile().setHudType(HudType.DISABLED);
}
/**
* Disable the mcMMO XP bar for the server.
* </br>
* This function is designed for API usage.
*/
public static void disableXpBar() {
SpoutConfig.getInstance().setXPBarEnabled(false);
}
}
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.util.player.UserManager;
public class SpoutHudAPI {
private SpoutHudAPI() {}
/**
* Disable the mcMMO XP bar for a player.
* </br>
* This function is designed for API usage.
*/
public static void disableXpBar(Player player) {
UserManager.getPlayer(player).getProfile().setHudType(HudType.DISABLED);
}
/**
* Disable the mcMMO XP bar for the server.
* </br>
* This function is designed for API usage.
*/
public static void disableXpBar() {
SpoutConfig.getInstance().setXPBarEnabled(false);
}
}

View File

@ -1,53 +1,53 @@
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.skills.utilities.ToolType;
public final class SpoutToolsAPI {
public static final List<ItemStack> spoutSwords = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutAxes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutPickaxes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutHoes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutShovels = new ArrayList<ItemStack>();
private SpoutToolsAPI() {}
/**
* Add a custom Spout tool to mcMMO for XP gain & ability use.
* </br>
* This function is designed for API usage.
*
* @param spoutTool The tool to add
* @param type The type of tool to add
*/
public static void addCustomTool(ItemStack spoutTool, ToolType type) {
switch (type) {
case AXE:
spoutAxes.add(spoutTool);
break;
case HOE:
spoutHoes.add(spoutTool);
break;
case PICKAXE:
spoutPickaxes.add(spoutTool);
break;
case SHOVEL:
spoutShovels.add(spoutTool);
break;
case SWORD:
spoutSwords.add(spoutTool);
break;
default:
break;
}
}
}
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.datatypes.skills.ToolType;
public final class SpoutToolsAPI {
public static final List<ItemStack> spoutSwords = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutAxes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutPickaxes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutHoes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutShovels = new ArrayList<ItemStack>();
private SpoutToolsAPI() {}
/**
* Add a custom Spout tool to mcMMO for XP gain & ability use.
* </br>
* This function is designed for API usage.
*
* @param spoutTool The tool to add
* @param type The type of tool to add
*/
public static void addCustomTool(ItemStack spoutTool, ToolType type) {
switch (type) {
case AXE:
spoutAxes.add(spoutTool);
break;
case HOE:
spoutHoes.add(spoutTool);
break;
case PICKAXE:
spoutPickaxes.add(spoutTool);
break;
case SHOVEL:
spoutShovels.add(spoutTool);
break;
case SWORD:
spoutSwords.add(spoutTool);
break;
default:
break;
}
}
}