mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Heh, API functions shouldn't be static...
This commit is contained in:
parent
7de19f8087
commit
f547523c3e
@ -14,7 +14,7 @@ public class ExperienceAPI {
|
||||
* @param player The player to check
|
||||
* @param skillType The skill to check
|
||||
*/
|
||||
private static void checkXP(Player player, SkillType skillType) {
|
||||
private void checkXP(Player player, SkillType skillType) {
|
||||
if (skillType.equals(SkillType.ALL)) {
|
||||
Skills.XpCheckAll(player);
|
||||
}
|
||||
@ -32,7 +32,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*/
|
||||
public static void addRawXP(Player player, SkillType skillType, int XP) {
|
||||
public void addRawXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getProfile(player).addXPOverride(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
@ -46,7 +46,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*/
|
||||
public static void addMultipliedXP(Player player, SkillType skillType, int XP) {
|
||||
public void addMultipliedXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getProfile(player).addXPOverrideBonus(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
@ -60,7 +60,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*/
|
||||
public static void addXP(Player player, SkillType skillType, int XP) {
|
||||
public void addXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getProfile(player).addXP(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
*/
|
||||
public static int getXP(Player player, SkillType skillType) {
|
||||
public int getXP(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillXpLevel(skillType);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ public class ExperienceAPI {
|
||||
* @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, SkillType skillType) {
|
||||
public int getXPToNextLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getXpToLevel(skillType);
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ public class ExperienceAPI {
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
*/
|
||||
public static void addLevel(Player player, SkillType skillType, int levels) {
|
||||
public void addLevel(Player player, SkillType skillType, int levels) {
|
||||
Users.getProfile(player).addLevels(skillType, levels);
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to get the level for
|
||||
* @return the level of a given skill
|
||||
*/
|
||||
public static int getLevel(Player player, SkillType skillType) {
|
||||
public int getLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillLevel(skillType);
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ public class ExperienceAPI {
|
||||
* @param player The player to get the power level for
|
||||
* @return the power level of the player
|
||||
*/
|
||||
public static int getPowerLevel(Player player) {
|
||||
public int getPowerLevel(Player player) {
|
||||
return Users.getProfile(player).getPowerLevel();
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class PartyAPI {
|
||||
* @param player The player to check the party name of
|
||||
* @return the name of the player's party
|
||||
*/
|
||||
public static String getPartyName(Player player) {
|
||||
public String getPartyName(Player player) {
|
||||
return Users.getProfile(player).getParty();
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ public class PartyAPI {
|
||||
* @param player The player to check
|
||||
* @return true if the player is in a party, false otherwise
|
||||
*/
|
||||
public static boolean inParty(Player player) {
|
||||
public boolean inParty(Player player) {
|
||||
return Users.getProfile(player).inParty();
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class PartyAPI {
|
||||
* @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) {
|
||||
public boolean inSameParty(Player playera, Player playerb) {
|
||||
return Party.getInstance().inSameParty(playera, playerb);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class PartyAPI {
|
||||
*
|
||||
* @return the list of parties.
|
||||
*/
|
||||
public static ArrayList<String> getParties() {
|
||||
public ArrayList<String> getParties() {
|
||||
String location = "plugins/mcMMO/mcmmo.users";
|
||||
ArrayList<String> parties = new ArrayList<String>();
|
||||
|
||||
@ -96,7 +96,7 @@ public class PartyAPI {
|
||||
* @param player The player to check
|
||||
* @return all the players in the player's party
|
||||
*/
|
||||
public static ArrayList<Player> getPartyMembers(Player player) {
|
||||
public ArrayList<Player> getPartyMembers(Player player) {
|
||||
return Party.getInstance().getPartyMembers(player);
|
||||
}
|
||||
|
||||
|
@ -6,96 +6,114 @@ import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
|
||||
public enum SkillType
|
||||
{
|
||||
ACROBATICS(LoadProperties.levelCapAcrobatics, LoadProperties.acrobaticsxpmodifier),
|
||||
ALL, //This one is just for convenience
|
||||
ARCHERY(LoadProperties.levelCapArchery, LoadProperties.archeryxpmodifier),
|
||||
AXES(AbilityType.SKULL_SPLIITER, LoadProperties.levelCapAxes, ToolType.AXE, LoadProperties.axesxpmodifier),
|
||||
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, LoadProperties.levelCapExcavation, ToolType.SHOVEL, LoadProperties.excavationxpmodifier),
|
||||
FISHING(LoadProperties.levelCapFishing, LoadProperties.fishingxpmodifier),
|
||||
HERBALISM(AbilityType.GREEN_TERRA, LoadProperties.levelCapHerbalism, ToolType.HOE, LoadProperties.herbalismxpmodifier),
|
||||
MINING(AbilityType.SUPER_BREAKER, LoadProperties.levelCapMining, ToolType.PICKAXE, LoadProperties.miningxpmodifier),
|
||||
REPAIR(LoadProperties.levelCapRepair, LoadProperties.repairxpmodifier),
|
||||
SWORDS(AbilityType.SERRATED_STRIKES, LoadProperties.levelCapSwords, ToolType.SWORD, LoadProperties.swordsxpmodifier),
|
||||
TAMING(LoadProperties.levelCapTaming, LoadProperties.tamingxpmodifier),
|
||||
UNARMED(AbilityType.BERSERK, LoadProperties.levelCapUnarmed, ToolType.FISTS, LoadProperties.unarmedxpmodifier),
|
||||
WOODCUTTING(AbilityType.TREE_FELLER, LoadProperties.levelCapWoodcutting, ToolType.AXE, LoadProperties.woodcuttingxpmodifier);
|
||||
|
||||
private AbilityType ability;
|
||||
private int maxLevel;
|
||||
private ToolType tool;
|
||||
private double xpModifier;
|
||||
|
||||
private SkillType()
|
||||
{
|
||||
this.ability = null;
|
||||
this.maxLevel = 0;
|
||||
this.tool = null;
|
||||
this.xpModifier = 0;
|
||||
}
|
||||
|
||||
private SkillType(AbilityType ability, int maxLevel, ToolType tool, double xpModifier)
|
||||
{
|
||||
this.ability = ability;
|
||||
this.maxLevel = maxLevel;
|
||||
this.tool = tool;
|
||||
this.xpModifier = xpModifier;
|
||||
}
|
||||
|
||||
private SkillType(int maxLevel, double xpModifier)
|
||||
{
|
||||
this(null, maxLevel, null, xpModifier);
|
||||
}
|
||||
|
||||
public AbilityType getAbility()
|
||||
{
|
||||
return this.ability;
|
||||
}
|
||||
|
||||
public int getMaxLevel()
|
||||
{
|
||||
if(maxLevel > 0)
|
||||
return maxLevel;
|
||||
else
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public ToolType getTool() {
|
||||
return tool;
|
||||
}
|
||||
|
||||
public boolean getPermissions(Player player)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case ACROBATICS:
|
||||
return mcPermissions.getInstance().acrobatics(player);
|
||||
case ARCHERY:
|
||||
return mcPermissions.getInstance().archery(player);
|
||||
case AXES:
|
||||
return mcPermissions.getInstance().axes(player);
|
||||
case EXCAVATION:
|
||||
return mcPermissions.getInstance().excavation(player);
|
||||
case FISHING:
|
||||
return mcPermissions.getInstance().fishing(player);
|
||||
case HERBALISM:
|
||||
return mcPermissions.getInstance().herbalism(player);
|
||||
case MINING:
|
||||
return mcPermissions.getInstance().mining(player);
|
||||
case REPAIR:
|
||||
return mcPermissions.getInstance().repair(player);
|
||||
case SWORDS:
|
||||
return mcPermissions.getInstance().swords(player);
|
||||
case TAMING:
|
||||
return mcPermissions.getInstance().taming(player);
|
||||
case UNARMED:
|
||||
return mcPermissions.getInstance().unarmed(player);
|
||||
case WOODCUTTING:
|
||||
return mcPermissions.getInstance().woodcutting(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public enum SkillType {
|
||||
ACROBATICS(LoadProperties.levelCapAcrobatics, LoadProperties.acrobaticsxpmodifier),
|
||||
ALL, //This one is just for convenience
|
||||
ARCHERY(LoadProperties.levelCapArchery, LoadProperties.archeryxpmodifier),
|
||||
AXES(AbilityType.SKULL_SPLIITER, LoadProperties.levelCapAxes, ToolType.AXE, LoadProperties.axesxpmodifier),
|
||||
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, LoadProperties.levelCapExcavation, ToolType.SHOVEL, LoadProperties.excavationxpmodifier),
|
||||
FISHING(LoadProperties.levelCapFishing, LoadProperties.fishingxpmodifier),
|
||||
HERBALISM(AbilityType.GREEN_TERRA, LoadProperties.levelCapHerbalism, ToolType.HOE, LoadProperties.herbalismxpmodifier),
|
||||
MINING(AbilityType.SUPER_BREAKER, LoadProperties.levelCapMining, ToolType.PICKAXE, LoadProperties.miningxpmodifier),
|
||||
REPAIR(LoadProperties.levelCapRepair, LoadProperties.repairxpmodifier),
|
||||
SWORDS(AbilityType.SERRATED_STRIKES, LoadProperties.levelCapSwords, ToolType.SWORD, LoadProperties.swordsxpmodifier),
|
||||
TAMING(LoadProperties.levelCapTaming, LoadProperties.tamingxpmodifier),
|
||||
UNARMED(AbilityType.BERSERK, LoadProperties.levelCapUnarmed, ToolType.FISTS, LoadProperties.unarmedxpmodifier),
|
||||
WOODCUTTING(AbilityType.TREE_FELLER, LoadProperties.levelCapWoodcutting, ToolType.AXE, LoadProperties.woodcuttingxpmodifier);
|
||||
|
||||
private AbilityType ability;
|
||||
private int maxLevel;
|
||||
private ToolType tool;
|
||||
private double xpModifier;
|
||||
|
||||
private SkillType() {
|
||||
this.ability = null;
|
||||
this.maxLevel = 0;
|
||||
this.tool = null;
|
||||
this.xpModifier = 0;
|
||||
}
|
||||
|
||||
private SkillType(AbilityType ability, int maxLevel, ToolType tool, double xpModifier) {
|
||||
this.ability = ability;
|
||||
this.maxLevel = maxLevel;
|
||||
this.tool = tool;
|
||||
this.xpModifier = xpModifier;
|
||||
}
|
||||
|
||||
private SkillType(int maxLevel, double xpModifier) {
|
||||
this(null, maxLevel, null, xpModifier);
|
||||
}
|
||||
|
||||
public AbilityType getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the max level of this skill.
|
||||
*
|
||||
* @return the max level of this skill
|
||||
*/
|
||||
public int getMaxLevel() {
|
||||
if (maxLevel > 0) {
|
||||
return maxLevel;
|
||||
}
|
||||
else {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public ToolType getTool() {
|
||||
return tool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base permissions associated with this skill.
|
||||
*
|
||||
* @param player The player to check the permissions for
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case ACROBATICS:
|
||||
return mcPermissions.getInstance().acrobatics(player);
|
||||
|
||||
case ARCHERY:
|
||||
return mcPermissions.getInstance().archery(player);
|
||||
|
||||
case AXES:
|
||||
return mcPermissions.getInstance().axes(player);
|
||||
|
||||
case EXCAVATION:
|
||||
return mcPermissions.getInstance().excavation(player);
|
||||
|
||||
case FISHING:
|
||||
return mcPermissions.getInstance().fishing(player);
|
||||
|
||||
case HERBALISM:
|
||||
return mcPermissions.getInstance().herbalism(player);
|
||||
|
||||
case MINING:
|
||||
return mcPermissions.getInstance().mining(player);
|
||||
|
||||
case REPAIR:
|
||||
return mcPermissions.getInstance().repair(player);
|
||||
|
||||
case SWORDS:
|
||||
return mcPermissions.getInstance().swords(player);
|
||||
|
||||
case TAMING:
|
||||
return mcPermissions.getInstance().taming(player);
|
||||
|
||||
case UNARMED:
|
||||
return mcPermissions.getInstance().unarmed(player);
|
||||
|
||||
case WOODCUTTING:
|
||||
return mcPermissions.getInstance().woodcutting(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public double getXpModifier() {
|
||||
return xpModifier;
|
||||
|
@ -163,7 +163,7 @@ public class mcMMO extends JavaPlugin {
|
||||
* @param player Player whose profile to get
|
||||
* @return the PlayerProfile object
|
||||
*/
|
||||
public static PlayerProfile getPlayerProfile(Player player) {
|
||||
public PlayerProfile getPlayerProfile(Player player) {
|
||||
return Users.getProfile(player);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user