ground markers: Add import/export menu option toggle
This commit is contained in:
@@ -31,9 +31,12 @@ import net.runelite.client.config.Config;
|
|||||||
import net.runelite.client.config.ConfigGroup;
|
import net.runelite.client.config.ConfigGroup;
|
||||||
import net.runelite.client.config.ConfigItem;
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
|
||||||
@ConfigGroup("groundMarker")
|
@ConfigGroup(GroundMarkerConfig.GROUND_MARKER_CONFIG_GROUP)
|
||||||
public interface GroundMarkerConfig extends Config
|
public interface GroundMarkerConfig extends Config
|
||||||
{
|
{
|
||||||
|
String GROUND_MARKER_CONFIG_GROUP = "groundMarker";
|
||||||
|
String SHOW_IMPORT_EXPORT_KEY_NAME = "showImportExport";
|
||||||
|
|
||||||
@Alpha
|
@Alpha
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "markerColor",
|
keyName = "markerColor",
|
||||||
@@ -64,4 +67,14 @@ public interface GroundMarkerConfig extends Config
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = SHOW_IMPORT_EXPORT_KEY_NAME,
|
||||||
|
name = "Show Import/Export options",
|
||||||
|
description = "Show the Import/Export options on the minimap right-click menu"
|
||||||
|
)
|
||||||
|
default boolean showImportExport()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import net.runelite.api.events.MenuOptionClicked;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.events.ConfigChanged;
|
||||||
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
@@ -190,7 +191,10 @@ public class GroundMarkerPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
overlayManager.add(overlay);
|
overlayManager.add(overlay);
|
||||||
overlayManager.add(minimapOverlay);
|
overlayManager.add(minimapOverlay);
|
||||||
sharingManager.addMenuOptions();
|
if (config.showImportExport())
|
||||||
|
{
|
||||||
|
sharingManager.addImportExportMenuOptions();
|
||||||
|
}
|
||||||
loadPoints();
|
loadPoints();
|
||||||
eventBus.register(sharingManager);
|
eventBus.register(sharingManager);
|
||||||
}
|
}
|
||||||
@@ -280,6 +284,21 @@ public class GroundMarkerPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onConfigChanged(ConfigChanged event)
|
||||||
|
{
|
||||||
|
if (event.getGroup().equals(GroundMarkerConfig.GROUND_MARKER_CONFIG_GROUP)
|
||||||
|
&& event.getKey().equals(GroundMarkerConfig.SHOW_IMPORT_EXPORT_KEY_NAME))
|
||||||
|
{
|
||||||
|
sharingManager.removeMenuOptions();
|
||||||
|
|
||||||
|
if (config.showImportExport())
|
||||||
|
{
|
||||||
|
sharingManager.addImportExportMenuOptions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void markTile(LocalPoint localPoint)
|
private void markTile(LocalPoint localPoint)
|
||||||
{
|
{
|
||||||
if (localPoint == null)
|
if (localPoint == null)
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class GroundMarkerSharingManager
|
|||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addMenuOptions()
|
void addImportExportMenuOptions()
|
||||||
{
|
{
|
||||||
menuManager.addManagedCustomMenu(EXPORT_MARKERS_OPTION);
|
menuManager.addManagedCustomMenu(EXPORT_MARKERS_OPTION);
|
||||||
menuManager.addManagedCustomMenu(IMPORT_MARKERS_OPTION);
|
menuManager.addManagedCustomMenu(IMPORT_MARKERS_OPTION);
|
||||||
|
|||||||
Reference in New Issue
Block a user