Fix json action serialization (#1843, #1844)

This commit is contained in:
electron 2019-12-04 14:18:37 +03:00 committed by Luck
parent a07f876c85
commit 31b57df567
2 changed files with 3 additions and 3 deletions

View File

@ -48,13 +48,13 @@ public final class ActionJsonSerializer {
.add("name", new JsonPrimitive(logEntry.getSource().getName())) .add("name", new JsonPrimitive(logEntry.getSource().getName()))
) )
.add("target", new JObject() .add("target", new JObject()
.add("type", new JsonPrimitive(logEntry.getTarget().getType().name()))) .add("type", new JsonPrimitive(logEntry.getTarget().getType().name()))
.consume(obj -> { .consume(obj -> {
if (logEntry.getTarget().getUniqueId().isPresent()) { if (logEntry.getTarget().getUniqueId().isPresent()) {
obj.add("uniqueId", new JsonPrimitive(logEntry.getTarget().getUniqueId().get().toString())); obj.add("uniqueId", new JsonPrimitive(logEntry.getTarget().getUniqueId().get().toString()));
} }
}) })
.add("name", new JsonPrimitive(logEntry.getTarget().getName()) .add("name", new JsonPrimitive(logEntry.getTarget().getName()))
) )
.add("description", new JsonPrimitive(logEntry.getDescription())) .add("description", new JsonPrimitive(logEntry.getDescription()))
.toJson(); .toJson();

View File

@ -158,7 +158,7 @@ public class LoggedAction implements Action {
if (!(o instanceof Action)) return false; if (!(o instanceof Action)) return false;
final Action that = (Action) o; final Action that = (Action) o;
return getTimestamp() == that.getTimestamp() && return getTimestamp().equals(that.getTimestamp()) &&
getSource().equals(that.getSource()) && getSource().equals(that.getSource()) &&
getTarget().equals(that.getTarget()) && getTarget().equals(that.getTarget()) &&
getDescription().equals(that.getDescription()); getDescription().equals(that.getDescription());