mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Only play ability effects if there's room above the player.
This commit is contained in:
parent
d34a0cca30
commit
76cf0ebb01
@ -7,6 +7,7 @@ import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Firework;
|
||||
@ -63,16 +64,20 @@ public final class ParticleEffectUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasHeadRoom(player)) {
|
||||
fireworkParticleShower(player, Color.GREEN);
|
||||
}
|
||||
}
|
||||
|
||||
public static void playAbilityDisabledEffect(Player player) {
|
||||
if (!Config.getInstance().getAbilityDeactivationEffectEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasHeadRoom(player)) {
|
||||
fireworkParticleShower(player, Color.RED);
|
||||
}
|
||||
}
|
||||
|
||||
public static void runescapeModeCelebration(Player player, SkillType skill) {
|
||||
fireworkParticleShower(player, skill.getRunescapeModeColor());
|
||||
@ -91,4 +96,18 @@ public final class ParticleEffectUtils {
|
||||
fireworkMeta.setPower(0);
|
||||
firework.setFireworkMeta(fireworkMeta);
|
||||
}
|
||||
|
||||
private static boolean hasHeadRoom(Player player) {
|
||||
boolean hasHeadRoom = true;
|
||||
Block headBlock = player.getEyeLocation().getBlock();
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (!headBlock.getRelative(BlockFace.UP, i).isEmpty()) {
|
||||
hasHeadRoom = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return hasHeadRoom;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user