-
Notifications
You must be signed in to change notification settings - Fork 13
XPBoostAPI
milkwalk edited this page Jan 9, 2019
·
15 revisions
Add XPBoost as dependency first through maven or directly as jar, then you are able to access XPBoostAPI. Most of the stuff is self-explanatory, but here are some notes anyways.
XPBoostAPI.hasBoost(Player player)XPBoostAPI.getBoost(Player player)Will return players XPBoost or null if player doesn't have any active boost
XPBoostAPI.setPlayerBoost(UUID id, double boost, int duration);Will set a boost for a player, if player already has a boost and you are setting boost with the same multiplier, then the lenght of the boost is just being extended.
Duration is in seconds.
Example
XPBoost boost = XPBoostAPI.setPlayerBoost(uuid, 2.0, 300);This is an example how to set MCMMO condition to false (disable mcmmo experience for this boost)
XPBoost boost = XPBoostAPI.getBoost(player);
boost.putCondition(Condition.MCMMO, false);TBA
More examples
public void customFunction(Player player){
UUID id = player.getUniqueId();
if(XPBoostAPI.hasBoost(id)){
XPBoost xpb = XPBoostAPI.getBoost(id);
System.out.println("Player boost: " + xpb.getBoost());
System.out.println("Player boost duration: " + xpb.getBoostTime());
System.out.println("Time remaining: (in seconds) " + xpb.getTimeRemaining());
System.out.println("Boost end time (in miliseconds): " + xpb.getEndTime());
///xpb.clear(); //Clears/Removes Boost
}
}