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.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Firework;
|
import org.bukkit.entity.Firework;
|
||||||
@ -63,7 +64,9 @@ public final class ParticleEffectUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fireworkParticleShower(player, Color.GREEN);
|
if (hasHeadRoom(player)) {
|
||||||
|
fireworkParticleShower(player, Color.GREEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playAbilityDisabledEffect(Player player) {
|
public static void playAbilityDisabledEffect(Player player) {
|
||||||
@ -71,7 +74,9 @@ public final class ParticleEffectUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fireworkParticleShower(player, Color.RED);
|
if (hasHeadRoom(player)) {
|
||||||
|
fireworkParticleShower(player, Color.RED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runescapeModeCelebration(Player player, SkillType skill) {
|
public static void runescapeModeCelebration(Player player, SkillType skill) {
|
||||||
@ -91,4 +96,18 @@ public final class ParticleEffectUtils {
|
|||||||
fireworkMeta.setPower(0);
|
fireworkMeta.setPower(0);
|
||||||
firework.setFireworkMeta(fireworkMeta);
|
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