Skip to content

Commit

Permalink
Merge pull request #226 from M0diis/resolve-223
Browse files Browse the repository at this point in the history
Resolve #223
  • Loading branch information
BlitzOffline authored Feb 28, 2024
2 parents 189214f + aa99703 commit e8dda63
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import at.helpch.chatchat.api.user.User;
import at.helpch.chatchat.channel.ChatChannel;
import org.bukkit.Location;
import org.bukkit.World;
import org.jetbrains.annotations.NotNull;

import java.util.List;
Expand Down Expand Up @@ -53,6 +54,14 @@ public static boolean isTargetWithinRadius(
if (radius != -1 && source instanceof ChatUser) {
final Location sourceLocation = ((ChatUser) source).player().getLocation();
final Location targetLocation = ((ChatUser) target).player().getLocation();

final World sourceWorld = sourceLocation.getWorld();
final World targetWorld = targetLocation.getWorld();

if(sourceWorld != null && targetWorld != null && !sourceWorld.getUID().equals(targetWorld.getUID())) {
return false;
}

final int relativeX = targetLocation.getBlockX() - sourceLocation.getBlockX();
final int relativeZ = targetLocation.getBlockZ() - sourceLocation.getBlockZ();

Expand Down

0 comments on commit e8dda63

Please sign in to comment.