2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.api;
|
|
|
|
|
2019-01-13 04:56:54 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
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) {
|
2019-01-13 04:56:54 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.BERSERK);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean gigaDrillBreakerEnabled(Player player) {
|
2019-01-13 04:56:54 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean greenTerraEnabled(Player player) {
|
2019-01-13 04:56:54 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.GREEN_TERRA);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean serratedStrikesEnabled(Player player) {
|
2019-01-13 04:56:54 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SERRATED_STRIKES);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean skullSplitterEnabled(Player player) {
|
2019-01-13 04:56:54 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SKULL_SPLITTER);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean superBreakerEnabled(Player player) {
|
2019-01-13 04:56:54 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.SUPER_BREAKER);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean treeFellerEnabled(Player player) {
|
2019-01-13 04:56:54 +01:00
|
|
|
return UserManager.getPlayer(player).getAbilityMode(SuperAbilityType.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
|
|
|
|
2019-01-13 04:56:54 +01:00
|
|
|
for (SuperAbilityType ability : SuperAbilityType.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) {
|
2019-01-13 04:56:54 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.BERSERK, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setGigaDrillBreakerCooldown(Player player, long cooldown) {
|
2019-01-13 04:56:54 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setGreenTerraCooldown(Player player, long cooldown) {
|
2019-01-13 04:56:54 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.GREEN_TERRA, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setSerratedStrikesCooldown(Player player, long cooldown) {
|
2019-01-13 04:56:54 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SERRATED_STRIKES, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setSkullSplitterCooldown(Player player, long cooldown) {
|
2019-01-13 04:56:54 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SKULL_SPLITTER, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setSuperBreakerCooldown(Player player, long cooldown) {
|
2019-01-13 04:56:54 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.SUPER_BREAKER, cooldown);
|
2013-04-26 03:47:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setTreeFellerCooldown(Player player, long cooldown) {
|
2019-01-13 04:56:54 +01:00
|
|
|
UserManager.getPlayer(player).setAbilityDATS(SuperAbilityType.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
|
|
|
}
|