Skip to content

Commit

Permalink
Fixed #8. /torch aoe will spawn the particles at the y height of the …
Browse files Browse the repository at this point in the history
…torch, below and above (Compared to only above normally) when in the nether
  • Loading branch information
Tobias de Bruijn committed May 13, 2021
1 parent 4ff0dac commit 23388c2
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
Expand Down Expand Up @@ -43,7 +44,12 @@ public static boolean aoe(CommandSender sender, HaroTorch plugin) {
final int x = (int) (cx + (radius * Math.cos(rad)));
final int z = (int) (cz + (radius * Math.sin(rad)));

final int y = w.getHighestBlockAt(x, z).getY() + 1;
int y;
if(w.getEnvironment() == Environment.NETHER) {
y = l.getBlockY();
} else {
y = w.getHighestBlockAt(x, z).getY() + 1;
}

blocksOnTorchRadius.add(new Location(w, x, y, z));
}
Expand Down Expand Up @@ -71,6 +77,12 @@ public void run() {
for(int i = 0; i < HaroTorch.getConfigHandler().torchAoeParticleHeight; i++) {
torchLoc.getWorld().spawnParticle(Particle.REDSTONE, l.getX() + 0.5D, l.getY() + 0.5D + i, l.getZ() + 0.5D, 5, 0D, 0D, 0D, 0.005, new Particle.DustOptions(torchParticle.getTorchParticleColor(), 1));
}

if(torchLoc.getWorld().getEnvironment() == Environment.NETHER) {
for(int i = 1; i < HaroTorch.getConfigHandler().torchAoeParticleHeight -1; i++) {
torchLoc.getWorld().spawnParticle(Particle.REDSTONE, l.getX() + 0.5D, l.getY() + 0.5D - i, l.getZ() + 0.5D, 5, 0D, 0D, 0D, 0.005, new Particle.DustOptions(torchParticle.getTorchParticleColor(), 1));
}
}
}
}
}
Expand Down

0 comments on commit 23388c2

Please sign in to comment.