Fixed stash list command regex, added IDs to CoordinateInfo (#844)

This commit is contained in:
wnuke 2020-05-17 03:49:17 +02:00 committed by GitHub
parent 6f0212e1cd
commit 3eec16e4ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -89,7 +89,7 @@ public class CoordsCommand extends Command {
} else {
sendChatMessage("List of logged stashes:");
}
String stashRegex = "(\\(.*chests, .* shulkers\\))";
String stashRegex = "(\\(.* chests, .* shulkers, .* droppers, .* dispensers\\))";
Objects.requireNonNull(coords).forEach(coord -> {
if (stashes) {
if (coord.name.matches(stashRegex)) {
@ -122,7 +122,7 @@ public class CoordsCommand extends Command {
}
}
private String format(CoordinateInfo coord, String searchterm) {
String message = " " + coord.name + " (" + coord.xyz.x + " " + coord.xyz.y + " " + coord.xyz.z + ")";
String message = " [" + coord.id + "] " + coord.name + " (" + coord.xyz.x + " " + coord.xyz.y + " " + coord.xyz.z + ")";
return message.replaceAll(searchterm, "&7" + searchterm + "&f");
}
private void confirm(String name, Coordinate xyz) {

View File

@ -16,17 +16,21 @@ public class CoordinateInfo {
public String time;
@SerializedName("date")
public String date;
@SerializedName("id")
public int id;
public CoordinateInfo(int x, int y, int z, String nameSet, String timeSet) {
xyz = new Coordinate(x, y, z);
name = nameSet;
time = timeSet;
id = CoordUtil.readCoords(CoordUtil.coordsLogFilename).size();
}
public CoordinateInfo(Coordinate pos, String nameSet, String timeSet) {
xyz = pos;
name = nameSet;
time = timeSet;
id = CoordUtil.readCoords(CoordUtil.coordsLogFilename).size();
}
public Coordinate getPos() {