discord: don't throw NPE when checking timeout on training states
This commit is contained in:
@@ -29,6 +29,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
@@ -285,15 +286,26 @@ enum DiscordGameEventType
|
||||
FROM_VARBITS = fromVarbitsBuilder.build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String imageKey;
|
||||
|
||||
@Nullable
|
||||
private String state;
|
||||
|
||||
@Nullable
|
||||
private String details;
|
||||
|
||||
private int priority;
|
||||
private boolean shouldClear;
|
||||
private boolean shouldTimeout;
|
||||
|
||||
@Nullable
|
||||
private DiscordAreaType discordAreaType;
|
||||
|
||||
@Nullable
|
||||
private Varbits varbits;
|
||||
|
||||
@Nullable
|
||||
private int[] regionIds;
|
||||
|
||||
DiscordGameEventType(Skill skill)
|
||||
@@ -306,7 +318,6 @@ enum DiscordGameEventType
|
||||
this.details = training(skill);
|
||||
this.priority = priority;
|
||||
this.imageKey = imageKeyOf(skill);
|
||||
this.priority = priority;
|
||||
this.shouldTimeout = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +212,8 @@ class DiscordState
|
||||
|
||||
events.removeIf(event -> event.getType().isShouldTimeout() && now.isAfter(event.getUpdated().plus(actionTimeout)));
|
||||
|
||||
if (eventWithTime.getType().getState().equals(DiscordGameEventType.IN_MENU.getState()) && now.isAfter(eventWithTime.getStart().plus(actionTimeout)))
|
||||
assert DiscordGameEventType.IN_MENU.getState() != null;
|
||||
if (DiscordGameEventType.IN_MENU.getState().equals(eventWithTime.getType().getState()) && now.isAfter(eventWithTime.getStart().plus(actionTimeout)))
|
||||
{
|
||||
final DiscordPresence presence = lastPresence
|
||||
.toBuilder()
|
||||
|
||||
Reference in New Issue
Block a user