File tree Expand file tree Collapse file tree
plugin/src/main/java/at/helpch/chatchat/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ public static boolean isTargetWithinRadius(
5454 }
5555
5656 if (radius != -1 && source instanceof ChatUser ) {
57- final Location targetLocation = targetChatUser .player ().getLocation ();
57+ final Location sourceLocation = targetChatUser .player ().getLocation ();
5858 final Location targetLocation = ((ChatUser ) target ).player ().getLocation ();
5959
6060 final World sourceWorld = sourceLocation .getWorld ();
@@ -64,6 +64,9 @@ public static boolean isTargetWithinRadius(
6464 return false ;
6565 }
6666
67+ final int relativeX = targetLocation .getBlockX () - sourceLocation .getBlockX ();
68+ final int relativeZ = targetLocation .getBlockZ () - sourceLocation .getBlockZ ();
69+
6770 return relativeX *relativeX + relativeZ *relativeZ <= radius *radius ;
6871 }
6972
You can’t perform that action at this time.
0 commit comments