Преглед изворни кода

Fixed calculating party bonus XP when players are in different
worlds throwing errors.

GJ пре 13 година
родитељ
комит
6a858dace7
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      src/main/java/com/gmail/nossr50/m.java

+ 5 - 1
src/main/java/com/gmail/nossr50/m.java

@@ -157,7 +157,11 @@ public class m {
      * @return true if the distance between <code>first</code> and <code>second</code> is less than <code>maxDistance</code>, false otherwise
      */
     public static boolean isNear(Location first, Location second, double maxDistance) {
-        if (first.distance(second) < maxDistance) {
+        if (!first.getWorld().equals(second.getWorld())) {
+            return false;
+        }
+
+        if (first.distanceSquared(second) < (maxDistance * maxDistance)) {
             return true;
         }
         else {