mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 20:55:44 +01:00
Don't add waypoint markers to the main registry
This commit is contained in:
parent
5f473ee4cd
commit
14cd243d6a
@ -125,6 +125,9 @@ public class CitizensNavigator implements Navigator, Runnable {
|
|||||||
if (root.keyExists("distancemargin")) {
|
if (root.keyExists("distancemargin")) {
|
||||||
defaultParams.distanceMargin(root.getDouble("distancemargin"));
|
defaultParams.distanceMargin(root.getDouble("distancemargin"));
|
||||||
}
|
}
|
||||||
|
if (root.keyExists("updatepathrate")) {
|
||||||
|
defaultParams.updatePathRate(root.getInt("updatepathrate"));
|
||||||
|
}
|
||||||
defaultParams.speedModifier((float) root.getDouble("speedmodifier", 1F));
|
defaultParams.speedModifier((float) root.getDouble("speedmodifier", 1F));
|
||||||
defaultParams.avoidWater(root.getBoolean("avoidwater"));
|
defaultParams.avoidWater(root.getBoolean("avoidwater"));
|
||||||
if (!root.getBoolean("usedefaultstuckaction") && defaultParams.stuckAction() == TeleportStuckAction.INSTANCE) {
|
if (!root.getBoolean("usedefaultstuckaction") && defaultParams.stuckAction() == TeleportStuckAction.INSTANCE) {
|
||||||
@ -178,12 +181,23 @@ public class CitizensNavigator implements Navigator, Runnable {
|
|||||||
public void save(DataKey root) {
|
public void save(DataKey root) {
|
||||||
if (defaultParams.range() != Setting.DEFAULT_PATHFINDING_RANGE.asFloat()) {
|
if (defaultParams.range() != Setting.DEFAULT_PATHFINDING_RANGE.asFloat()) {
|
||||||
root.setDouble("pathfindingrange", defaultParams.range());
|
root.setDouble("pathfindingrange", defaultParams.range());
|
||||||
|
} else {
|
||||||
|
root.removeKey("pathfindingrange");
|
||||||
}
|
}
|
||||||
if (defaultParams.stationaryTicks() != Setting.DEFAULT_STATIONARY_TICKS.asInt()) {
|
if (defaultParams.stationaryTicks() != Setting.DEFAULT_STATIONARY_TICKS.asInt()) {
|
||||||
root.setInt("stationaryticks", defaultParams.stationaryTicks());
|
root.setInt("stationaryticks", defaultParams.stationaryTicks());
|
||||||
|
} else {
|
||||||
|
root.removeKey("stationaryticks");
|
||||||
}
|
}
|
||||||
if (defaultParams.distanceMargin() != Setting.DEFAULT_DISTANCE_MARGIN.asDouble()) {
|
if (defaultParams.distanceMargin() != Setting.DEFAULT_DISTANCE_MARGIN.asDouble()) {
|
||||||
root.setDouble("distancemargin", defaultParams.distanceMargin());
|
root.setDouble("distancemargin", defaultParams.distanceMargin());
|
||||||
|
} else {
|
||||||
|
root.removeKey("distancemargin");
|
||||||
|
}
|
||||||
|
if (defaultParams.updatePathRate() != Setting.DEFAULT_PATHFINDER_UPDATE_PATH_RATE.asInt()) {
|
||||||
|
root.setInt("updatepathrate", defaultParams.updatePathRate());
|
||||||
|
} else {
|
||||||
|
root.removeKey("updatepathrate");
|
||||||
}
|
}
|
||||||
root.setDouble("speedmodifier", defaultParams.speedModifier());
|
root.setDouble("speedmodifier", defaultParams.speedModifier());
|
||||||
root.setBoolean("avoidwater", defaultParams.avoidWater());
|
root.setBoolean("avoidwater", defaultParams.avoidWater());
|
||||||
|
@ -2,10 +2,6 @@ package net.citizensnpcs.trait.waypoint;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
|
||||||
import net.citizensnpcs.util.NMS;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -13,6 +9,10 @@ import org.bukkit.entity.EntityType;
|
|||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
|
import net.citizensnpcs.api.npc.MemoryNPCDataStore;
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
|
||||||
public class WaypointMarkers {
|
public class WaypointMarkers {
|
||||||
private final Map<Waypoint, Entity> waypointMarkers = Maps.newHashMap();
|
private final Map<Waypoint, Entity> waypointMarkers = Maps.newHashMap();
|
||||||
private final World world;
|
private final World world;
|
||||||
@ -44,7 +44,8 @@ public class WaypointMarkers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Entity spawnMarker(World world, Location at) {
|
public Entity spawnMarker(World world, Location at) {
|
||||||
NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.ENDER_SIGNAL, "");
|
NPC npc = CitizensAPI.createAnonymousNPCRegistry(new MemoryNPCDataStore()).createNPC(EntityType.ENDER_SIGNAL,
|
||||||
|
"");
|
||||||
npc.spawn(at);
|
npc.spawn(at);
|
||||||
return npc.getEntity();
|
return npc.getEntity();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user