Skip to content
Permalink
Browse files

fix range squaring for greetings

  • Loading branch information...
mcmonkey4eva committed Feb 3, 2019
1 parent d10b2da commit c9cf6002b06285c40e65537654645a6555c613cc
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/main/java/org/mcmonkey/sentinel/SentinelTrait.java
@@ -1319,7 +1319,7 @@ public void onPlayerMovesInRange(PlayerMoveEvent event) {
}
double dist = event.getTo().distanceSquared(getLivingEntity().getLocation());
boolean known = greetedAlready.contains(event.getPlayer().getUniqueId());
if (dist < greetRange && !known && targetingHelper.canSee(event.getPlayer())) {
if (dist < greetRange * greetRange && !known && targetingHelper.canSee(event.getPlayer())) {
greetedAlready.add(event.getPlayer().getUniqueId());
boolean enemy = targetingHelper.shouldTarget(event.getPlayer());
if (enemy && warningText != null && warningText.length() > 0) {
@@ -1329,7 +1329,7 @@ else if (!enemy && greetingText != null && greetingText.length() > 0) {
sayTo(event.getPlayer(), greetingText);
}
}
else if (dist >= greetRange + 1 && known) {
else if (dist >= greetRange * greetRange + 1 && known) {
greetedAlready.remove(event.getPlayer().getUniqueId());
// TODO: Farewell text perhaps?
}

0 comments on commit c9cf600

Please sign in to comment.
You can’t perform that action at this time.