Append waypoints in the waypoint editor

This commit is contained in:
fullwall 2020-10-12 20:44:11 +08:00
parent b2f841a40e
commit 1d314fba7a
3 changed files with 8 additions and 8 deletions

View File

@ -659,7 +659,7 @@ public class EventListen implements Listener {
return;
}
if (npc.isSpawned()) {
storeForRespawn(npc);
toRespawn.put(new ChunkCoord(npc.getEntity().getLocation()), npc);
Messaging.debug("Despawned", npc.getId() + "due to world unload at", event.getWorld().getName());
}
}
@ -715,8 +715,4 @@ public class EventListen implements Listener {
}
return npc.spawn(spawn, SpawnReason.CHUNK_LOAD);
}
private void storeForRespawn(NPC npc) {
toRespawn.put(new ChunkCoord(npc.getEntity().getLocation()), npc);
}
}

View File

@ -983,7 +983,7 @@ public class NPCCommands {
}
Paginator paginator = new Paginator().header("NPCs").console(sender instanceof ConsoleCommandSender);
paginator.addLine("<b>Key: <e>ID <a>Name");
paginator.addLine("<e><o>ID <a><o>Name");
for (int i = 0; i < npcs.size(); i += 2) {
String line = "<e>" + npcs.get(i).getId() + "<a> " + npcs.get(i).getName();
if (npcs.size() >= i + 2)

View File

@ -324,14 +324,18 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
Waypoint element = new Waypoint(at);
normaliseEditingSlot();
waypoints.add(editingSlot, element);
if (editingSlot == waypoints.size()) {
waypoints.add(element);
} else {
waypoints.add(editingSlot, element);
}
if (showPath) {
markers.createMarker(element, element.getLocation().clone().add(0, 1, 0));
}
editingSlot = Math.min(editingSlot + 1, waypoints.size());
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_ADDED_WAYPOINT, formatLoc(at), editingSlot + 1,
waypoints.size());
} else if (waypoints.size() > 0) {
} else if (waypoints.size() > 0 && !event.getPlayer().isSneaking()) {
event.setCancelled(true);
normaliseEditingSlot();
Waypoint waypoint = waypoints.remove(editingSlot);