Skip to content

Commit

Permalink
Add edge case for different worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
snoh666 committed May 10, 2021
1 parent 5036295 commit c1780f7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/me/snoh666/manhunt/CompassTracker.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package me.snoh666.manhunt;

import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;

import java.util.Objects;
import java.util.UUID;

public class CompassTracker extends BukkitRunnable {
Expand Down Expand Up @@ -33,6 +35,9 @@ public void run() {
}

private UUID getClosestPlayer(Location loc, UUID exceptPlayerId) {
if (Objects.requireNonNull(loc.getWorld()).getEnvironment() != World.Environment.NORMAL) {
return null;
}
UUID closestPlayer = null;
double distanceToClosestPlayer = 0.0D;
double xLoc = loc.getX();
Expand Down

0 comments on commit c1780f7

Please # to comment.