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>
|
<artifactId>Vault</artifactId>
|
||||||
<version>${vault.version}</version>
|
<version>${vault.version}</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
|
@ -232,21 +232,21 @@ public class LinearWaypointProvider implements WaypointProvider {
|
|||||||
public void run() {
|
public void run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPaused(boolean paused) {
|
public void setPaused(boolean pause) {
|
||||||
if (paused && currentDestination != null)
|
if (pause && currentDestination != null)
|
||||||
selector.finish();
|
selector.finish();
|
||||||
this.paused = paused;
|
this.paused = pause;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldExecute(GoalSelector selector) {
|
public boolean shouldExecute(GoalSelector selector) {
|
||||||
if (paused || currentDestination != null || waypoints.size() == 0)
|
if (paused || currentDestination != null || !npc.isSpawned() || waypoints.size() == 0)
|
||||||
return false;
|
return false;
|
||||||
if (waypoints.size() == 1) {
|
if (waypoints.size() == 1) {
|
||||||
// avoid repeatedly pathing to the same point and wasting
|
// avoid repeatedly pathing to the same point and wasting
|
||||||
// memory.
|
// memory.
|
||||||
Location dest = npc.getBukkitEntity().getLocation();
|
Location dest = npc.getBukkitEntity().getLocation();
|
||||||
if (waypoints.get(0).getLocation().distanceSquared(dest) < 1)
|
if (waypoints.get(0).getLocation().distanceSquared(dest) < 3)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ensureItr();
|
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;
|
package net.citizensnpcs.trait.waypoint;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.api.util.DataKey;
|
import net.citizensnpcs.api.util.DataKey;
|
||||||
import net.citizensnpcs.editor.Editor;
|
import net.citizensnpcs.editor.Editor;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class WanderingWaypointProvider implements WaypointProvider, Iterable<Location> {
|
public class WanderingWaypointProvider implements WaypointProvider {
|
||||||
private final Iterator<Location> iterator = new RandomPointFinder();
|
|
||||||
private NPC npc;
|
private NPC npc;
|
||||||
private boolean paused;
|
private boolean paused;
|
||||||
|
|
||||||
@ -36,11 +32,6 @@ public class WanderingWaypointProvider implements WaypointProvider, Iterable<Loc
|
|||||||
return paused;
|
return paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<Location> iterator() {
|
|
||||||
return iterator;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(DataKey key) {
|
public void load(DataKey key) {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user