mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Added a few requested functions to the ExperienceAPI
This commit is contained in:
parent
dd94343d92
commit
3d9c03c0c8
@ -135,4 +135,43 @@ public final class ExperienceAPI {
|
||||
public static int getPowerLevel(Player player) {
|
||||
return Users.getProfile(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
|
||||
*/
|
||||
public static void setLevel(Player player, SkillType skillType, int skillLevel) {
|
||||
Users.getProfile(player).modifySkill(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
|
||||
*/
|
||||
public static void setXP(Player player, SkillType skillType, int newValue) {
|
||||
Users.getProfile(player).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 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, SkillType skillType, int xp) {
|
||||
Users.getProfile(player).removeXP(skillType, xp);
|
||||
}
|
||||
}
|
||||
|
@ -934,6 +934,10 @@ public class PlayerProfile {
|
||||
return skillsXp.get(skillType);
|
||||
}
|
||||
|
||||
public void setSkillXPLevel(SkillType skillType, int newValue) {
|
||||
skillsXp.put(skillType, newValue);
|
||||
}
|
||||
|
||||
public void skillUp(SkillType skillType, int newValue) {
|
||||
skills.put(skillType, skills.get(skillType) + newValue);
|
||||
}
|
||||
|
@ -181,6 +181,7 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||
System.out.println("ExplosionPrimeEvent fired!" + System.currentTimeMillis());
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (entity instanceof TNTPrimed) {
|
||||
@ -203,6 +204,7 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEnitityExplode(EntityExplodeEvent event) {
|
||||
System.out.println("ExplosionPrimeEvent fired!" + System.currentTimeMillis());
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (event.getEntity() instanceof TNTPrimed) {
|
||||
|
Loading…
Reference in New Issue
Block a user