mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-17 01:54:21 +02:00
Fix #495
This commit is contained in:
parent
dd37eb25d3
commit
44e1ea4af6
@ -47,13 +47,16 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
|
|||||||
Collections.sort(nearby, new Comparator<Entity>() {
|
Collections.sort(nearby, new Comparator<Entity>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Entity o1, Entity o2) {
|
public int compare(Entity o1, Entity o2) {
|
||||||
|
if (npcLocation.getWorld() != o1.getLocation().getWorld() || npcLocation.getWorld() != o2.getLocation().getWorld()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
double d1 = o1.getLocation().distanceSquared(npcLocation);
|
double d1 = o1.getLocation().distanceSquared(npcLocation);
|
||||||
double d2 = o2.getLocation().distanceSquared(npcLocation);
|
double d2 = o2.getLocation().distanceSquared(npcLocation);
|
||||||
return Double.compare(d1, d2);
|
return Double.compare(d1, d2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for (Entity entity : nearby) {
|
for (Entity entity : nearby) {
|
||||||
if (entity.getType() != EntityType.PLAYER)
|
if (entity.getType() != EntityType.PLAYER || entity.getLocation().getWorld() != npcLocation.getWorld())
|
||||||
continue;
|
continue;
|
||||||
if (CitizensAPI.getNPCRegistry().getNPC(entity) != null)
|
if (CitizensAPI.getNPCRegistry().getNPC(entity) != null)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user