Split synchronizing and uploading loot data into separate configs
This commit is contained in:
committed by
Tomas Slusny
parent
b236dd8fb4
commit
c8e85d07f7
@@ -51,11 +51,23 @@ public interface LootTrackerConfig extends Config
|
|||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "saveLoot",
|
keyName = "saveLoot",
|
||||||
name = "Save loot",
|
name = "Submit loot tracker data",
|
||||||
description = "Save loot between client sessions (requires being logged in)"
|
description = "Submit loot tracker data (requires being logged in)"
|
||||||
)
|
)
|
||||||
default boolean saveLoot()
|
default boolean saveLoot()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "syncPanel",
|
||||||
|
name = "Synchronize panel contents",
|
||||||
|
description = "Synchronize you local loot tracker with your online (requires being logged in). This means" +
|
||||||
|
" that panel is filled with portion of your remote data on startup and deleting data in panel deletes them" +
|
||||||
|
" also on server."
|
||||||
|
)
|
||||||
|
default boolean syncPanel()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -99,6 +99,7 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
|
|
||||||
private final ItemManager itemManager;
|
private final ItemManager itemManager;
|
||||||
private final LootTrackerPlugin plugin;
|
private final LootTrackerPlugin plugin;
|
||||||
|
private final LootTrackerConfig config;
|
||||||
|
|
||||||
private boolean groupLoot;
|
private boolean groupLoot;
|
||||||
private boolean hideIgnoredItems;
|
private boolean hideIgnoredItems;
|
||||||
@@ -130,10 +131,11 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
INVISIBLE_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -220));
|
INVISIBLE_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -220));
|
||||||
}
|
}
|
||||||
|
|
||||||
LootTrackerPanel(final LootTrackerPlugin plugin, final ItemManager itemManager)
|
LootTrackerPanel(final LootTrackerPlugin plugin, final ItemManager itemManager, final LootTrackerConfig config)
|
||||||
{
|
{
|
||||||
this.itemManager = itemManager;
|
this.itemManager = itemManager;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.config = config;
|
||||||
this.hideIgnoredItems = true;
|
this.hideIgnoredItems = true;
|
||||||
|
|
||||||
setBorder(new EmptyBorder(6, 6, 6, 6));
|
setBorder(new EmptyBorder(6, 6, 6, 6));
|
||||||
@@ -297,7 +299,7 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
|
|
||||||
// Delete all loot, or loot matching the current view
|
// Delete all loot, or loot matching the current view
|
||||||
LootTrackerClient client = plugin.getLootTrackerClient();
|
LootTrackerClient client = plugin.getLootTrackerClient();
|
||||||
if (client != null)
|
if (client != null && config.syncPanel())
|
||||||
{
|
{
|
||||||
client.delete(currentView);
|
client.delete(currentView);
|
||||||
}
|
}
|
||||||
@@ -472,7 +474,7 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
|
|
||||||
LootTrackerClient client = plugin.getLootTrackerClient();
|
LootTrackerClient client = plugin.getLootTrackerClient();
|
||||||
// Without loot being grouped we have no way to identify single kills to be deleted
|
// Without loot being grouped we have no way to identify single kills to be deleted
|
||||||
if (client != null && groupLoot)
|
if (client != null && groupLoot && config.syncPanel())
|
||||||
{
|
{
|
||||||
client.delete(box.getId());
|
client.delete(box.getId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
ignoredItems = Text.fromCSV(config.getIgnoredItems());
|
ignoredItems = Text.fromCSV(config.getIgnoredItems());
|
||||||
panel = new LootTrackerPanel(this, itemManager);
|
panel = new LootTrackerPanel(this, itemManager, config);
|
||||||
spriteManager.getSpriteAsync(SpriteID.TAB_INVENTORY, 0, panel::loadHeaderIcon);
|
spriteManager.getSpriteAsync(SpriteID.TAB_INVENTORY, 0, panel::loadHeaderIcon);
|
||||||
|
|
||||||
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png");
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png");
|
||||||
@@ -227,9 +227,8 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
Collection<LootRecord> lootRecords;
|
Collection<LootRecord> lootRecords;
|
||||||
|
|
||||||
if (!config.saveLoot())
|
if (!config.syncPanel())
|
||||||
{
|
{
|
||||||
// don't load loot if we're not saving loot
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user