Give some form of feedback when trying to applyedits no changes instead of no feedback at all (#1136)

This commit is contained in:
Luck 2018-08-08 08:58:58 +01:00
parent 486ddb3d42
commit 553da9baf6
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 11 additions and 2 deletions

View File

@ -76,13 +76,21 @@ public class ApplyEditsCommand extends SingleCommand {
return CommandResult.FAILURE;
}
boolean success = false;
if (data.has("tabs") && data.get("tabs").isJsonArray()) {
JsonArray rows = data.get("tabs").getAsJsonArray();
for (JsonElement row : rows) {
read(row.getAsJsonObject(), sender, plugin);
if (read(row.getAsJsonObject(), sender, plugin)) {
success = true;
}
}
} else {
read(data, sender, plugin);
success = read(data, sender, plugin);
}
if (!success) {
Message.APPLY_EDITS_TARGET_NO_CHANGES_PRESENT.send(sender);
}
return CommandResult.SUCCESS;

View File

@ -155,6 +155,7 @@ public enum Message {
APPLY_EDITS_TARGET_USER_NOT_UUID("&cTarget user &4{}&c is not a valid uuid.", true),
APPLY_EDITS_TARGET_USER_UNABLE_TO_LOAD("&cUnable to load target user &4{}&c.", true),
APPLY_EDITS_TARGET_UNKNOWN("&cInvalid target. &7({})", true),
APPLY_EDITS_TARGET_NO_CHANGES_PRESENT("&aNo changes were applied from the web editor. The returned data didn't contain any edits.", true),
APPLY_EDITS_SUCCESS("&aWeb editor data was applied to &b{}&a successfully.", true),
APPLY_EDITS_SUCCESS_SUMMARY("&7(&a{} &7{} and &c{} &7{})", true),
APPLY_EDITS_DIFF_ADDED("&a+ &f{}", false),