Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {
}

group = 'com.collectionlogmaster'
version = '1.3.0'
version = '1.3.1'

repositories {
mavenLocal()
Expand Down Expand Up @@ -82,7 +82,6 @@ processResources {
}
}

// avoids requiring to whitelist spotless in plugin hub
if (gradle.startParameter.taskNames.any { it.contains('spotless') }) {
apply plugin: 'com.diffplug.spotless'
spotless {
Expand Down Expand Up @@ -116,7 +115,7 @@ if (gradle.startParameter.taskNames.any { it.contains('spotless') }) {

json {
target 'src/**/*.json'
targetExclude 'src/main/resources/com/collectionlogmaster/task-list.json'
targetExclude 'src/main/resources/**/task-list.json'
gson()
}
}
Expand Down
175 changes: 88 additions & 87 deletions src/main/java/com/collectionlogmaster/CollectionLogMasterConfig.java
Original file line number Diff line number Diff line change
@@ -1,106 +1,107 @@
package com.collectionlogmaster;

import static com.collectionlogmaster.CollectionLogMasterConfig.CONFIG_GROUP;

import com.collectionlogmaster.domain.DynamicTaskImages;
import com.collectionlogmaster.domain.TaskTier;
import net.runelite.client.config.*;

import static com.collectionlogmaster.CollectionLogMasterConfig.CONFIG_GROUP;

@ConfigGroup(CONFIG_GROUP)
public interface CollectionLogMasterConfig extends Config
{
String CONFIG_GROUP = "collection-log-master";
String CONFIG_GROUP = "collection-log-master";

String PLUGIN_VERSION_KEY = "plugin-version";
String IS_COMMAND_ENABLED_KEY = "isCommandEnabled";
String PLUGIN_VERSION_KEY = "plugin-version";
String IS_LMS_ENABLED_KEY = "isLMSEnabled";
String IS_COMMAND_ENABLED_KEY = "isCommandEnabled";

@Range(
min = 1000,
max = 10000
)
@Units(Units.MILLISECONDS)
@ConfigItem(
keyName = "rollTime",
name = "Roll Time",
description = "How long new tasks will take to roll",
position = 1
)
default int rollTime()
{
return 5000;
}
@Range(
min = 1000,
max = 10000
)
@Units(Units.MILLISECONDS)
@ConfigItem(
keyName = "rollTime",
name = "Roll Time",
description = "How long new tasks will take to roll",
position = 1
)
default int rollTime()
{
return 5000;
}

@ConfigItem(
keyName = "rollPastCompleted",
name = "Roll past completed",
description = "When rolling tasks, include those you've already completed in the roll animation. Helpful when you're getting to the end of a tier!",
position = 2
)
default boolean rollPastCompleted()
{
return false;
}
@ConfigItem(
keyName = "rollPastCompleted",
name = "Roll past completed",
description = "When rolling tasks, include those you've already completed in the roll animation. Helpful when you're getting to the end of a tier!",
position = 2
)
default boolean rollPastCompleted()
{
return false;
}

@ConfigItem(
keyName = "hideBelow",
name = "Hide Tasks Below",
description = "Disabled the showing up/assigning of tasks at or below the specified tier",
position = 3
)
default TaskTier hideBelow()
{
return TaskTier.EASY;
}
@ConfigItem(
keyName = "hideBelow",
name = "Hide Tasks Below",
description = "Disabled the showing up/assigning of tasks at or below the specified tier",
position = 3
)
default TaskTier hideBelow()
{
return TaskTier.EASY;
}

@ConfigItem(
keyName = "displayCurrentTaskOverlay",
name = "Display current task overlay",
description = "Enable an overlay showing the currently assigned task (when one exists)",
position = 5
)
default boolean displayCurrentTaskOverlay()
{
return true;
}
@ConfigItem(
keyName = "displayCurrentTaskOverlay",
name = "Display current task overlay",
description = "Enable an overlay showing the currently assigned task (when one exists)",
position = 5
)
default boolean displayCurrentTaskOverlay()
{
return true;
}

@ConfigItem(
keyName = "dynamicTaskImages",
name = "Dynamic task images",
description = "Display dynamic task images based on required/acquired items",
position = 6
)
default DynamicTaskImages dynamicTaskImages()
{
return DynamicTaskImages.COMPLETE;
}
@ConfigItem(
keyName = "dynamicTaskImages",
name = "Dynamic task images",
description = "Display dynamic task images based on required/acquired items",
position = 6
)
default DynamicTaskImages dynamicTaskImages()
{
return DynamicTaskImages.COMPLETE;
}

@ConfigItem(
keyName = "isLMSEnabled",
name = "Enable LMS tasks",
description = "Whether to include LMS tasks in the list.",
position = 7
)
default boolean isLMSEnabled()
{
return true;
}
@ConfigItem(
keyName = IS_LMS_ENABLED_KEY,
name = "Enable LMS tasks",
description = "Whether to include LMS tasks in the list.",
position = 7
)
default boolean isLMSEnabled()
{
return true;
}

@ConfigSection(
name = "!taskman Command",
description = "Configuration options for the !taskman command",
position = 8
)
String command = "command";
@ConfigSection(
name = "!taskman Command",
description = "Configuration options for the !taskman command",
position = 8
)
String command = "command";

@ConfigItem(
keyName = IS_COMMAND_ENABLED_KEY,
name = "Enable command",
description = "When you or others type !taskman in the chat, it will be replaced by your current task status",
section = command,
position = 0
)
default boolean isCommandEnabled()
{
return true;
}
@ConfigItem(
keyName = IS_COMMAND_ENABLED_KEY,
name = "Enable command",
description = "When you or others type !taskman in the chat, it will be replaced by your current task status",
section = command,
position = 0
)
default boolean isCommandEnabled()
{
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
public class PluginUpdateNotifier extends EventBusSubscriber {
private static final String[] UPDATE_MESSAGES = {
"<colHIGHLIGHT>Collection Log Master updated to v" + getPluginVersion(),
"<colHIGHLIGHT>- Rewritten entire interface code; now supports resource packs",
"<colHIGHLIGHT>- Fixed issue with disabling LMS tasks while a LMS task is active",
"<colHIGHLIGHT>- Fixed issue overlay not being shown under some circumstances",
};

@Inject
Expand Down
35 changes: 19 additions & 16 deletions src/main/java/com/collectionlogmaster/domain/Task.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
package com.collectionlogmaster.domain;

import com.collectionlogmaster.domain.verification.Verification;
import lombok.Data;

import javax.annotation.Nullable;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nullable;
import lombok.Data;

@Data
public class Task {
private String id;
private String name;
private String tip;
private String wikiLink;
private int displayItemId;
private Set<Tag> tags;
private String id;
private String name;
private String tip;
private String wikiLink;
private int displayItemId;
private Set<Tag> tags;

private @Nullable Verification verification;

private @Nullable Verification verification;
public Set<Tag> getTags() {
if (tags == null) {
tags = new HashSet<>();
}

public Set<Tag> getTags() {
if (tags == null) {
tags = new HashSet<>();
}
return tags;
}

return tags;
}
public boolean isLMS() {
return getTags().contains(Tag.LMS);
}
}
29 changes: 27 additions & 2 deletions src/main/java/com/collectionlogmaster/task/TaskService.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import javax.inject.Singleton;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import org.jetbrains.annotations.Range;

@Singleton
Expand Down Expand Up @@ -49,6 +51,25 @@ public void shutDown() {
saveDataStorage.shutDown();
}

@Subscribe
public void onConfigChanged(ConfigChanged e) {
if (!e.getGroup().equals(CollectionLogMasterConfig.CONFIG_GROUP)) {
return;
}

if (!e.getKey().equals(CollectionLogMasterConfig.IS_LMS_ENABLED_KEY)) {
return;
}

if (!config.isLMSEnabled()) {
Task activeTask = getActiveTask();
if (activeTask != null && activeTask.isLMS()) {
saveDataStorage.get().setActiveTaskId(null);
saveDataStorage.save();
}
}
}

public Task getActiveTask() {
String activeTaskId = saveDataStorage.get().getActiveTaskId();

Expand All @@ -58,7 +79,7 @@ public Task getActiveTask() {
// we might want to build a cache map in the future
public Task getTaskById(String taskId) {
for (TaskTier t : TaskTier.values()) {
List<Task> tasks = getTierTasks(t);
List<Task> tasks = getTierTasks(t, true);
for (Task task : tasks) {
if (task.getId().equals(taskId)) {
return task;
Expand All @@ -83,9 +104,13 @@ public List<Task> getTierTasks() {
}

public List<Task> getTierTasks(TaskTier tier) {
return getTierTasks(tier, false);
}

public List<Task> getTierTasks(TaskTier tier, boolean skipLMSCheck) {
List<Task> tierTasks = taskListStorage.get().getForTier(tier);

if (!config.isLMSEnabled()) {
if (!skipLMSCheck && !config.isLMSEnabled()) {
return filterTag(tierTasks, Tag.LMS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.collectionlogmaster.ui.component.MenuManager;
import com.collectionlogmaster.ui.component.TaskInfo;
import com.collectionlogmaster.ui.sprites.SpriteManager;
import com.collectionlogmaster.ui.state.StateStore;
import com.collectionlogmaster.util.EventBusSubscriber;
import javax.inject.Inject;
import javax.inject.Singleton;
Expand Down Expand Up @@ -33,6 +34,9 @@ public class InterfaceManager extends EventBusSubscriber {
@Inject
private MenuManager menuManager;

@Inject
private StateStore stateStore;

private MainTabbedContainer container = null;

private TaskInfo taskInfo = null;
Expand Down Expand Up @@ -146,5 +150,7 @@ public void close() {
taskInfo.close();
}
taskInfo = null;

stateStore.setDashboardEnabled(false);
}
}