2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.api;
|
|
|
|
|
2018-12-29 14:24:55 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
2014-05-02 19:41:44 +02:00
|
|
|
import org.bukkit.entity.LivingEntity;
|
2013-03-01 06:52:01 +01:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2013-03-03 17:06:05 +01:00
|
|
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
2014-05-02 19:41:44 +02:00
|
|
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.util.player.UserManager;
|
|
|
|
|
|
|
|
public final class AbilityAPI {
|
|
|
|
private AbilityAPI() {}
|
|
|
|
|
|
|
|
public static boolean berserkEnabled(Player player) {
|
2018-12-29 14:24:55 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.BERSERK);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean gigaDrillBreakerEnabled(Player player) {
|
2018-12-29 14:24:55 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.GIGA_DRILL_BREAKER);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean greenTerraEnabled(Player player) {
|
2018-12-29 14:24:55 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.GREEN_TERRA);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean serratedStrikesEnabled(Player player) {
|
2018-12-29 14:24:55 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.SERRATED_STRIKES);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean skullSplitterEnabled(Player player) {
|
2018-12-29 14:24:55 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.SKULL_SPLITTER);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean superBreakerEnabled(Player player) {
|
2018-12-29 14:24:55 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.SUPER_BREAKER);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean treeFellerEnabled(Player player) {
|
2018-12-29 14:24:55 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.TREE_FELLER);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isAnyAbilityEnabled(Player player) {
|
2013-03-03 17:06:05 +01:00
|
|
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2018-12-29 14:24:55 +01:00
|
|
|
for (SuperAbility ability : SuperAbility.values()) {
|
2013-03-03 17:06:05 +01:00
|
|
|
if (mcMMOPlayer.getAbilityMode(ability)) {
|
2013-03-01 06:52:01 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2013-04-26 03:47:41 +02:00
|
|
|
|
|
|
|
public static void resetCooldowns(Player player) {
|
2013-10-29 16:02:57 +01:00
|
|
|
UserManager.getPlayer(player).resetCooldowns();
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setBerserkCooldown(Player player, long cooldown) {
|
2018-12-29 14:24:55 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.BERSERK, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setGigaDrillBreakerCooldown(Player player, long cooldown) {
|
2018-12-29 14:24:55 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.GIGA_DRILL_BREAKER, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setGreenTerraCooldown(Player player, long cooldown) {
|
2018-12-29 14:24:55 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.GREEN_TERRA, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setSerratedStrikesCooldown(Player player, long cooldown) {
|
2018-12-29 14:24:55 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.SERRATED_STRIKES, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setSkullSplitterCooldown(Player player, long cooldown) {
|
2018-12-29 14:24:55 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.SKULL_SPLITTER, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setSuperBreakerCooldown(Player player, long cooldown) {
|
2018-12-29 14:24:55 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.SUPER_BREAKER, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setTreeFellerCooldown(Player player, long cooldown) {
|
2018-12-29 14:24:55 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.TREE_FELLER, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
2014-05-02 19:41:44 +02:00
|
|
|
|
|
|
|
public static boolean isBleeding(LivingEntity entity) {
|
|
|
|
return BleedTimerTask.isBleeding(entity);
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|