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;
|
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(
|
@ConfigItem(
|
||||||
keyName = "defaultTimerMinutes",
|
keyName = "defaultTimerMinutes",
|
||||||
name = "Default Time",
|
name = "Default Time",
|
||||||
description = "The default time for the timer in minutes",
|
description = "The default time for the timer in minutes",
|
||||||
position = 4
|
position = 5
|
||||||
)
|
)
|
||||||
@Units(Units.MINUTES)
|
@Units(Units.MINUTES)
|
||||||
default int defaultTimerMinutes()
|
default int defaultTimerMinutes()
|
||||||
@@ -87,7 +98,7 @@ public interface TimeTrackingConfig extends Config
|
|||||||
keyName = "sortOrder",
|
keyName = "sortOrder",
|
||||||
name = "Sort Order",
|
name = "Sort Order",
|
||||||
description = "The order in which to sort the timers",
|
description = "The order in which to sort the timers",
|
||||||
position = 5
|
position = 6
|
||||||
)
|
)
|
||||||
default SortOrder sortOrder()
|
default SortOrder sortOrder()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -107,4 +107,10 @@ class FarmingContractInfoBox extends InfoBox
|
|||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean render()
|
||||||
|
{
|
||||||
|
return config.farmingContractInfoBox();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,25 +161,19 @@ public class FarmingContractManager
|
|||||||
|
|
||||||
private void handleInfoBox()
|
private void handleInfoBox()
|
||||||
{
|
{
|
||||||
if (infoBox != null)
|
if (contract != (infoBox == null ? null : infoBox.getContract()))
|
||||||
{
|
{
|
||||||
if (contract == null)
|
if (infoBox != null)
|
||||||
{
|
{
|
||||||
infoBoxManager.removeInfoBox(infoBox);
|
infoBoxManager.removeInfoBox(infoBox);
|
||||||
infoBox = null;
|
infoBox = null;
|
||||||
}
|
}
|
||||||
else if (infoBox.getContract() != contract)
|
if (contract != null)
|
||||||
{
|
{
|
||||||
infoBoxManager.removeInfoBox(infoBox);
|
|
||||||
infoBox = new FarmingContractInfoBox(itemManager.getImage(contract.getItemID()), plugin, contract, config, this);
|
infoBox = new FarmingContractInfoBox(itemManager.getImage(contract.getItemID()), plugin, contract, config, this);
|
||||||
infoBoxManager.addInfoBox(infoBox);
|
infoBoxManager.addInfoBox(infoBox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (contract != null)
|
|
||||||
{
|
|
||||||
infoBox = new FarmingContractInfoBox(itemManager.getImage(contract.getItemID()), plugin, contract, config, this);
|
|
||||||
infoBoxManager.addInfoBox(infoBox);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleGuildmasterJaneWidgetDialog()
|
private void handleGuildmasterJaneWidgetDialog()
|
||||||
|
|||||||
Reference in New Issue
Block a user