explicit presence declaration
parent
91447b7b3c
commit
6707e813b2
|
@ -34,9 +34,7 @@ import java.util.concurrent.CompletableFuture;
|
||||||
public final class FileSuggestionProvider implements SuggestionProvider<ServerCommandSource> {
|
public final class FileSuggestionProvider implements SuggestionProvider<ServerCommandSource> {
|
||||||
private static final FileSuggestionProvider INSTANCE = new FileSuggestionProvider();
|
private static final FileSuggestionProvider INSTANCE = new FileSuggestionProvider();
|
||||||
|
|
||||||
public static FileSuggestionProvider Instance() {
|
public static FileSuggestionProvider Instance() { return INSTANCE; }
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Suggestions> getSuggestions(CommandContext<ServerCommandSource> ctx, SuggestionsBuilder builder) {
|
public CompletableFuture<Suggestions> getSuggestions(CommandContext<ServerCommandSource> ctx, SuggestionsBuilder builder) {
|
||||||
|
@ -47,14 +45,14 @@ public final class FileSuggestionProvider implements SuggestionProvider<ServerCo
|
||||||
|
|
||||||
if (formattedCreationTime.startsWith(remaining)) {
|
if (formattedCreationTime.startsWith(remaining)) {
|
||||||
if (Utilities.wasSentByPlayer(ctx.getSource())) { //was typed by player
|
if (Utilities.wasSentByPlayer(ctx.getSource())) { //was typed by player
|
||||||
if (file.getComment() != null) {
|
if (file.getComment().isPresent()) {
|
||||||
builder.suggest(formattedCreationTime, new LiteralMessage("Comment: " + file.getComment()));
|
builder.suggest(formattedCreationTime, new LiteralMessage("Comment: " + file.getComment().get()));
|
||||||
} else {
|
} else {
|
||||||
builder.suggest(formattedCreationTime);
|
builder.suggest(formattedCreationTime);
|
||||||
}
|
}
|
||||||
} else { //was typed from server console
|
} else { //was typed from server console
|
||||||
if (file.getComment() != null) {
|
if (file.getComment().isPresent()) {
|
||||||
builder.suggest(file.getCreationTime() + "#" + file.getComment());
|
builder.suggest(file.getCreationTime() + "#" + file.getComment().get());
|
||||||
} else {
|
} else {
|
||||||
builder.suggest(formattedCreationTime);
|
builder.suggest(formattedCreationTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class RestoreableFile implements Comparable<RestoreableFile> {
|
||||||
|
|
||||||
public LocalDateTime getCreationTime() { return creationTime; }
|
public LocalDateTime getCreationTime() { return creationTime; }
|
||||||
|
|
||||||
public String getComment() { return comment; }
|
public Optional<String> getComment() { return Optional.ofNullable(comment); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(@NotNull RestoreableFile o) { return creationTime.compareTo(o.creationTime); }
|
public int compareTo(@NotNull RestoreableFile o) { return creationTime.compareTo(o.creationTime); }
|
||||||
|
|
Loading…
Reference in New Issue