Skip to content

Commit

Permalink
fix: Added more dynamic bank trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoinkwiz committed Nov 27, 2024
1 parent 43542e9 commit a8b5b31
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/com/questhelper/bank/banktab/QuestBankTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public class QuestBankTab

private final HashMap<Widget, BankTabItem> widgetItems = new HashMap<>();

private int originalContainerChildren = -1;

public void startUp()
{
if (questHelper.getSelectedQuest() != null)
Expand Down Expand Up @@ -327,11 +329,13 @@ private void resetWidgets()

private void removeAddedWidgets()
{
if (originalContainerChildren == -1) return;

if (addedWidgets.isEmpty()) return;
Widget parent = addedWidgets.get(0).getParent();
if (parent == null) return;

parent.setChildren(Arrays.copyOf(parent.getChildren(), 1248));
parent.setChildren(Arrays.copyOf(parent.getChildren(), originalContainerChildren));
parent.revalidate();

addedWidgets.clear();
Expand Down Expand Up @@ -363,6 +367,8 @@ public void onScriptPostFired(ScriptPostFired event)
return;
}

removeAddedWidgets();

if (!questBankTabInterface.isQuestTabActive())
{
return;
Expand All @@ -373,8 +379,8 @@ public void onScriptPostFired(ScriptPostFired event)
{
return;
}

removeAddedWidgets();
Widget[] children = itemContainer.getChildren();
if (children != null && originalContainerChildren == -1) originalContainerChildren = children.length;

Widget[] containerChildren = itemContainer.getDynamicChildren();

Expand Down

0 comments on commit a8b5b31

Please sign in to comment.