timetracking: add option to hide farm contract infobox
This also cleans up the existing infobox add/removal code
This commit is contained in:
@@ -71,11 +71,22 @@ public interface TimeTrackingConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "farmingContractInfoBox",
|
||||
name = "Show farming contract infobox",
|
||||
description = "Show an infobox of your current farming contract when inside the farming guild",
|
||||
position = 4
|
||||
)
|
||||
default boolean farmingContractInfoBox()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "defaultTimerMinutes",
|
||||
name = "Default Time",
|
||||
description = "The default time for the timer in minutes",
|
||||
position = 4
|
||||
position = 5
|
||||
)
|
||||
@Units(Units.MINUTES)
|
||||
default int defaultTimerMinutes()
|
||||
@@ -87,7 +98,7 @@ public interface TimeTrackingConfig extends Config
|
||||
keyName = "sortOrder",
|
||||
name = "Sort Order",
|
||||
description = "The order in which to sort the timers",
|
||||
position = 5
|
||||
position = 6
|
||||
)
|
||||
default SortOrder sortOrder()
|
||||
{
|
||||
|
||||
@@ -107,4 +107,10 @@ class FarmingContractInfoBox extends InfoBox
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean render()
|
||||
{
|
||||
return config.farmingContractInfoBox();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,25 +161,19 @@ public class FarmingContractManager
|
||||
|
||||
private void handleInfoBox()
|
||||
{
|
||||
if (infoBox != null)
|
||||
if (contract != (infoBox == null ? null : infoBox.getContract()))
|
||||
{
|
||||
if (contract == null)
|
||||
if (infoBox != null)
|
||||
{
|
||||
infoBoxManager.removeInfoBox(infoBox);
|
||||
infoBox = null;
|
||||
}
|
||||
else if (infoBox.getContract() != contract)
|
||||
if (contract != null)
|
||||
{
|
||||
infoBoxManager.removeInfoBox(infoBox);
|
||||
infoBox = new FarmingContractInfoBox(itemManager.getImage(contract.getItemID()), plugin, contract, config, this);
|
||||
infoBoxManager.addInfoBox(infoBox);
|
||||
}
|
||||
}
|
||||
else if (contract != null)
|
||||
{
|
||||
infoBox = new FarmingContractInfoBox(itemManager.getImage(contract.getItemID()), plugin, contract, config, this);
|
||||
infoBoxManager.addInfoBox(infoBox);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleGuildmasterJaneWidgetDialog()
|
||||
|
||||
Reference in New Issue
Block a user