ge plugin: fix adding limit reset timer multiple times
The code was assuming anything added to the examine text was separated with <br>, however the reset timer doesn't do that.
This commit is contained in:
@@ -180,6 +180,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
|
||||
private Widget grandExchangeText;
|
||||
private Widget grandExchangeItem;
|
||||
private String grandExchangeExamine;
|
||||
|
||||
private int osbItem;
|
||||
private OSBGrandExchangeResult osbGrandExchangeResult;
|
||||
@@ -842,8 +843,13 @@ public class GrandExchangePlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
String[] lines = geText.getText().split("<br>");
|
||||
String text = lines[0]; // remove any limit or OSB ge values
|
||||
if (geText.getText() == grandExchangeExamine)
|
||||
{
|
||||
// if we've already set the text, don't set it again
|
||||
return;
|
||||
}
|
||||
|
||||
String text = geText.getText();
|
||||
|
||||
if (config.enableGELimits())
|
||||
{
|
||||
@@ -866,6 +872,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
grandExchangeExamine = text;
|
||||
geText.setText(text);
|
||||
|
||||
if (!config.enableOsbPrices())
|
||||
@@ -876,7 +883,8 @@ public class GrandExchangePlugin extends Plugin
|
||||
// If we already have the result, use it
|
||||
if (osbGrandExchangeResult != null && osbGrandExchangeResult.getItem_id() == itemId && osbGrandExchangeResult.getOverall_average() > 0)
|
||||
{
|
||||
geText.setText(text + OSB_GE_TEXT + QuantityFormatter.formatNumber(osbGrandExchangeResult.getOverall_average()));
|
||||
grandExchangeExamine = text + OSB_GE_TEXT + QuantityFormatter.formatNumber(osbGrandExchangeResult.getOverall_average());
|
||||
geText.setText(grandExchangeExamine);
|
||||
}
|
||||
|
||||
if (osbItem == itemId)
|
||||
@@ -895,9 +903,13 @@ public class GrandExchangePlugin extends Plugin
|
||||
try
|
||||
{
|
||||
final OSBGrandExchangeResult result = CLIENT.lookupItem(itemId);
|
||||
osbGrandExchangeResult = result;
|
||||
// Update the text on the widget too
|
||||
geText.setText(start + OSB_GE_TEXT + QuantityFormatter.formatNumber(result.getOverall_average()));
|
||||
if (result != null && result.getOverall_average() > 0)
|
||||
{
|
||||
osbGrandExchangeResult = result;
|
||||
// Update the text on the widget too
|
||||
grandExchangeExamine = start + OSB_GE_TEXT + QuantityFormatter.formatNumber(result.getOverall_average());
|
||||
geText.setText(grandExchangeExamine);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user