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

View File

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