mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-27 09:42:37 +01:00
Fix up some messages with the waypoint editor
This commit is contained in:
parent
306a448a48
commit
de74b21dd7
@ -153,7 +153,6 @@ public class EventListen implements Listener {
|
||||
@Override
|
||||
public void run() {
|
||||
ChunkCoord coord = new ChunkCoord(event.getChunk());
|
||||
Messaging.debug("Respawning all NPCs at", coord, "due to chunk load");
|
||||
respawnAllFromCoord(coord, event);
|
||||
}
|
||||
};
|
||||
@ -642,9 +641,6 @@ public class EventListen implements Listener {
|
||||
for (ChunkCoord chunk : toRespawn.keySet()) {
|
||||
if (!chunk.worldUUID.equals(event.getWorld().getUID()) || !event.getWorld().isChunkLoaded(chunk.x, chunk.z))
|
||||
continue;
|
||||
if (Messaging.isDebugging()) {
|
||||
Messaging.debug("Respawning all NPCs at", chunk, "due to world load");
|
||||
}
|
||||
respawnAllFromCoord(chunk, event);
|
||||
}
|
||||
}
|
||||
@ -658,9 +654,6 @@ public class EventListen implements Listener {
|
||||
if (event.isCancelled() || !despawned) {
|
||||
for (ChunkCoord coord : toRespawn.keySet()) {
|
||||
if (event.getWorld().getUID().equals(coord.worldUUID)) {
|
||||
if (Messaging.isDebugging()) {
|
||||
Messaging.debug("Respawning all NPCs at", coord, "due to cancelled world unload");
|
||||
}
|
||||
respawnAllFromCoord(coord, event);
|
||||
}
|
||||
}
|
||||
@ -676,6 +669,9 @@ public class EventListen implements Listener {
|
||||
|
||||
private void respawnAllFromCoord(ChunkCoord coord, Event event) {
|
||||
List<NPC> ids = toRespawn.get(coord);
|
||||
if (ids.size() > 0) {
|
||||
Messaging.debug("Respawning all NPCs at", coord, "due to", event);
|
||||
}
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
NPC npc = ids.get(i);
|
||||
if (npc.getOwningRegistry().getById(npc.getId()) != npc) {
|
||||
|
@ -38,8 +38,7 @@ public class CitizensNPCRegistry implements NPCRegistry {
|
||||
private final Map<UUID, NPC> uniqueNPCs = Maps.newHashMap();
|
||||
|
||||
public CitizensNPCRegistry(NPCDataStore store) {
|
||||
saves = store;
|
||||
name = "";
|
||||
this(store, "");
|
||||
}
|
||||
|
||||
public CitizensNPCRegistry(NPCDataStore store, String registryName) {
|
||||
|
@ -178,7 +178,7 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
|
||||
EntityMarkers<Waypoint> markers;
|
||||
private final Player player;
|
||||
private Waypoint selectedWaypoint;
|
||||
private boolean showPath = true;
|
||||
private boolean showingMarkers = true;
|
||||
|
||||
private LinearWaypointEditor(Player player) {
|
||||
this.player = player;
|
||||
@ -212,7 +212,7 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
|
||||
}
|
||||
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_END);
|
||||
editing = false;
|
||||
if (!showPath)
|
||||
if (!showingMarkers)
|
||||
return;
|
||||
markers.destroyMarkers();
|
||||
}
|
||||
@ -285,6 +285,8 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
|
||||
@Override
|
||||
public void run() {
|
||||
cycle = !cycle;
|
||||
Messaging.sendTr(event.getPlayer(),
|
||||
cycle ? Messages.LINEAR_WAYPOINT_EDITOR_CYCLE_SET : Messages.LINEAR_WAYPOINT_EDITOR_CYCLE_UNSET);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -314,20 +316,18 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
|
||||
|
||||
Waypoint element = new Waypoint(at);
|
||||
waypoints.add(element);
|
||||
if (showPath) {
|
||||
if (showingMarkers) {
|
||||
markers.createMarker(element, element.getLocation().clone().add(0, 1, 0));
|
||||
}
|
||||
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_ADDED_WAYPOINT, formatLoc(at),
|
||||
waypoints.size());
|
||||
} else if (waypoints.size() > 0 && !event.getPlayer().isSneaking()) {
|
||||
event.setCancelled(true);
|
||||
Waypoint waypoint = waypoints.remove(waypoints.size() - 1);
|
||||
|
||||
Waypoint waypoint = removeWaypoint(waypoints.size() - 1);
|
||||
if (waypoint.equals(selectedWaypoint)) {
|
||||
selectedWaypoint = null;
|
||||
}
|
||||
if (showPath) {
|
||||
markers.removeMarker(waypoint);
|
||||
}
|
||||
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_REMOVED_WAYPOINT, waypoints.size());
|
||||
}
|
||||
onWaypointsModified();
|
||||
@ -335,7 +335,7 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
if (!player.equals(event.getPlayer()) || !showPath || Util.isOffHand(event))
|
||||
if (!player.equals(event.getPlayer()) || !showingMarkers || Util.isOffHand(event))
|
||||
return;
|
||||
int slot = -1;
|
||||
double minDistance = Double.MAX_VALUE;
|
||||
@ -350,8 +350,7 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
|
||||
if (slot == -1)
|
||||
return;
|
||||
if (selectedWaypoint != null && waypoints.get(slot) == selectedWaypoint) {
|
||||
waypoints.remove(slot);
|
||||
selectedWaypoint = null;
|
||||
removeWaypoint(slot);
|
||||
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_REMOVED_WAYPOINT, waypoints.size());
|
||||
return;
|
||||
}
|
||||
@ -369,9 +368,20 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private Waypoint removeWaypoint(int idx) {
|
||||
Waypoint waypoint = waypoints.remove(idx);
|
||||
if (showingMarkers) {
|
||||
markers.removeMarker(waypoint);
|
||||
}
|
||||
if (waypoint == selectedWaypoint) {
|
||||
selectedWaypoint = null;
|
||||
}
|
||||
return waypoint;
|
||||
}
|
||||
|
||||
private void togglePath() {
|
||||
showPath = !showPath;
|
||||
if (showPath) {
|
||||
showingMarkers = !showingMarkers;
|
||||
if (showingMarkers) {
|
||||
createWaypointMarkers();
|
||||
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_SHOWING_MARKERS);
|
||||
} else {
|
||||
|
@ -381,6 +381,8 @@ public class Messages {
|
||||
public static final String WANDER_WAYPOINTS_REGION_EDITING_START = "citizens.editors.waypoints.wander.editing-regions";
|
||||
public static final String WANDER_WAYPOINTS_REMOVED_REGION = "citizens.editors.waypoints.wander.removed-region";
|
||||
public static final String WAYPOINT_ADDED = "citizens.commands.waypoints.add.waypoint-added";
|
||||
public static final String LINEAR_WAYPOINT_EDITOR_CYCLE_SET = "citizens.editors.waypoints.linear.cycle-set";
|
||||
public static final String LINEAR_WAYPOINT_EDITOR_CYCLE_UNSET = "citizens.editors.waypoints.linear.cycle-unset";
|
||||
public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider";
|
||||
public static final String WAYPOINT_TELEPORTING_DISABLED = "citizens.commands.waypoints.disableteleporting.disabled";
|
||||
public static final String WAYPOINT_TRIGGER_ADD_PROMPT = "citizens.editors.waypoints.triggers.add.prompt";
|
||||
|
@ -331,15 +331,17 @@ citizens.editors.waypoints.guided.begin=<b>Entered the guided waypoint editor!<b
|
||||
citizens.editors.waypoints.guided.added-guide=Added a [[guide]] waypoint. This will guide NPCs to their destination.
|
||||
citizens.editors.waypoints.guided.added-available=Added a [[destination]] waypoint. This will be available for NPCs to path to.
|
||||
citizens.editors.waypoints.guided.already-taken=There is already a waypoint here.
|
||||
citizens.editors.waypoints.linear.added-waypoint=[[Added]] a waypoint at ({0}) ([[{1}]], [[{2}]]).
|
||||
citizens.editors.waypoints.linear.added-waypoint=[[Added]] a waypoint at ({0}) ([[{1}]] total).
|
||||
citizens.editors.waypoints.linear.begin=<b>=== <l>Linear Waypoint Editor ===<br> [[Left click]] to add a waypoint, [[right click]] to remove it.<br> You can right click while sneaking to select and remove specific points.<br> Type [[markers]] to hide waypoints,<br> [[triggers]] to enter the trigger editor,<br> [[clear]] to clear all waypoints,<br> [[cycle]] to make NPCs cycle through waypoints instead of looping.
|
||||
citizens.editors.waypoints.linear.selected-waypoint=Selected waypoint at {1}. Sneak + right click again to remove this waypoint.
|
||||
citizens.editors.waypoints.linear.selected-waypoint=Selected waypoint at {0}. Sneak + right click again to remove this waypoint.
|
||||
citizens.editors.waypoints.linear.end=Exited the linear waypoint editor.
|
||||
citizens.editors.waypoints.linear.not-showing-markers=[[Stopped]] showing waypoint markers.
|
||||
citizens.editors.waypoints.linear.range-exceeded=Previous waypoint is {0} blocks away but the distance limit is {1}.
|
||||
citizens.editors.waypoints.linear.removed-waypoint=[[Removed]] a waypoint ([[{0}]] remaining) ([[{1}]])
|
||||
citizens.editors.waypoints.linear.removed-waypoint=[[Removed]] a waypoint ([[{0}]] remaining)
|
||||
citizens.editors.waypoints.linear.showing-markers=[[Showing]] waypoint markers.
|
||||
citizens.editors.waypoints.linear.waypoints-cleared=Waypoints cleared.
|
||||
citizens.editors.waypoints.linear.cycle-set=Now [[cycling]] through waypoints.
|
||||
citizens.editors.waypoints.linear.cycle-unset=Now [[looping]] through waypoints.
|
||||
citizens.editors.waypoints.triggers.add.added=<b>Added waypoint trigger successfully ({0}).
|
||||
citizens.editors.waypoints.triggers.add.invalid-trigger=Couldn''t create a trigger by the name [[{0}]].
|
||||
citizens.editors.waypoints.triggers.add.prompt=Enter in a trigger name to add or type [[back]] to return to the edit prompt. Valid trigger names are {0}.
|
||||
|
Loading…
Reference in New Issue
Block a user