mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Fix comparator and ensure @Nonnull annotated methods never return null in LogEntry
This commit is contained in:
parent
ae8be97db7
commit
269aa39378
@ -48,8 +48,11 @@ public class LogEntry implements Comparable<LogEntry> {
|
|||||||
.thenComparing(LogEntry::getActor)
|
.thenComparing(LogEntry::getActor)
|
||||||
.thenComparing(LogEntry::getActorName, String.CASE_INSENSITIVE_ORDER)
|
.thenComparing(LogEntry::getActorName, String.CASE_INSENSITIVE_ORDER)
|
||||||
.thenComparing(LogEntry::getEntryType)
|
.thenComparing(LogEntry::getEntryType)
|
||||||
.thenComparing(Comparator.nullsFirst(Comparator.comparing(LogEntry::getActed)))
|
.thenComparing(e -> {
|
||||||
.thenComparing(LogEntry::getActorName, String.CASE_INSENSITIVE_ORDER)
|
UUID u = e.getActed();
|
||||||
|
return u == null ? "" : u.toString();
|
||||||
|
})
|
||||||
|
.thenComparing(LogEntry::getActedName, String.CASE_INSENSITIVE_ORDER)
|
||||||
.thenComparing(LogEntry::getAction);
|
.thenComparing(LogEntry::getAction);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -219,7 +222,7 @@ public class LogEntry implements Comparable<LogEntry> {
|
|||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public UUID getActor() {
|
public UUID getActor() {
|
||||||
return actor;
|
return Preconditions.checkNotNull(actor, "actor");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setActor(@Nonnull UUID actor) {
|
void setActor(@Nonnull UUID actor) {
|
||||||
@ -228,7 +231,7 @@ public class LogEntry implements Comparable<LogEntry> {
|
|||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public String getActorName() {
|
public String getActorName() {
|
||||||
return actorName;
|
return Preconditions.checkNotNull(actorName, "actorName");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setActorName(@Nonnull String actorName) {
|
void setActorName(@Nonnull String actorName) {
|
||||||
@ -243,7 +246,7 @@ public class LogEntry implements Comparable<LogEntry> {
|
|||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public Type getEntryType() {
|
public Type getEntryType() {
|
||||||
return type;
|
return Preconditions.checkNotNull(type, "type");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -264,7 +267,7 @@ public class LogEntry implements Comparable<LogEntry> {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public char getType() {
|
public char getType() {
|
||||||
return type.getCode();
|
return getEntryType().getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -289,7 +292,7 @@ public class LogEntry implements Comparable<LogEntry> {
|
|||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public String getActedName() {
|
public String getActedName() {
|
||||||
return actedName;
|
return Preconditions.checkNotNull(actedName, "actedName");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setActedName(@Nonnull String actedName) {
|
void setActedName(@Nonnull String actedName) {
|
||||||
@ -298,7 +301,7 @@ public class LogEntry implements Comparable<LogEntry> {
|
|||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public String getAction() {
|
public String getAction() {
|
||||||
return action;
|
return Preconditions.checkNotNull(action, "action");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAction(@Nonnull String action) {
|
void setAction(@Nonnull String action) {
|
||||||
|
@ -61,7 +61,7 @@ public abstract class AbstractMessagingService implements InternalMessagingServi
|
|||||||
private final Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final BufferedRequest<Void> updateBuffer = new BufferedRequest<Void>(10000L, r -> getPlugin().doAsync(r)) {
|
private final BufferedRequest<Void> updateBuffer = new BufferedRequest<Void>(3000L, r -> getPlugin().doAsync(r)) {
|
||||||
@Override
|
@Override
|
||||||
protected Void perform() {
|
protected Void perform() {
|
||||||
pushUpdate();
|
pushUpdate();
|
||||||
|
Loading…
Reference in New Issue
Block a user