mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 12:46:04 +01:00
Bugfix
This commit is contained in:
parent
17366cba20
commit
07edf17dae
2
pom.xml
2
pom.xml
@ -38,7 +38,7 @@
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>${vault.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
|
@ -232,21 +232,21 @@ public class LinearWaypointProvider implements WaypointProvider {
|
||||
public void run() {
|
||||
}
|
||||
|
||||
public void setPaused(boolean paused) {
|
||||
if (paused && currentDestination != null)
|
||||
public void setPaused(boolean pause) {
|
||||
if (pause && currentDestination != null)
|
||||
selector.finish();
|
||||
this.paused = paused;
|
||||
this.paused = pause;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute(GoalSelector selector) {
|
||||
if (paused || currentDestination != null || waypoints.size() == 0)
|
||||
if (paused || currentDestination != null || !npc.isSpawned() || waypoints.size() == 0)
|
||||
return false;
|
||||
if (waypoints.size() == 1) {
|
||||
// avoid repeatedly pathing to the same point and wasting
|
||||
// memory.
|
||||
Location dest = npc.getBukkitEntity().getLocation();
|
||||
if (waypoints.get(0).getLocation().distanceSquared(dest) < 1)
|
||||
if (waypoints.get(0).getLocation().distanceSquared(dest) < 3)
|
||||
return false;
|
||||
}
|
||||
ensureItr();
|
||||
|
@ -1,27 +0,0 @@
|
||||
package net.citizensnpcs.trait.waypoint;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class RandomPointFinder implements Iterator<Location> {
|
||||
|
||||
public Location find() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location next() {
|
||||
return find();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
@ -1,16 +1,12 @@
|
||||
package net.citizensnpcs.trait.waypoint;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
import net.citizensnpcs.editor.Editor;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class WanderingWaypointProvider implements WaypointProvider, Iterable<Location> {
|
||||
private final Iterator<Location> iterator = new RandomPointFinder();
|
||||
public class WanderingWaypointProvider implements WaypointProvider {
|
||||
private NPC npc;
|
||||
private boolean paused;
|
||||
|
||||
@ -36,11 +32,6 @@ public class WanderingWaypointProvider implements WaypointProvider, Iterable<Loc
|
||||
return paused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Location> iterator() {
|
||||
return iterator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(DataKey key) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user