🔁 do partial resets in main gui, only draw variable buttons on full draw() call

Took 4 minutes
This commit is contained in:
Kiran Hart 2023-09-12 19:36:04 -04:00
parent 35ab8d2339
commit 1970f5c3e9
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3

View File

@ -113,9 +113,19 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
this.searchPhrase = phrase; this.searchPhrase = phrase;
} }
private void partialReset() {
if (inventory != null)
inventory.clear();
setActionForRange(0, 44, null);
cellItems.clear();
update();
}
public void draw() { public void draw() {
try { try {
reset(); partialReset();
drawVariableButtons();// remove from here
drawFixedButtons(); drawFixedButtons();
drawItems(); drawItems();
} catch (Exception e) { } catch (Exception e) {
@ -175,7 +185,7 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
return this.items.stream().skip((page - 1) * 45L).limit(45L).collect(Collectors.toList()); return this.items.stream().skip((page - 1) * 45L).limit(45L).collect(Collectors.toList());
}).asyncLast((data) -> { }).asyncLast((data) -> {
pages = (int) Math.max(1, Math.ceil(this.items.size() / (double) 45L)); pages = (int) Math.max(1, Math.ceil(this.items.size() / (double) 45L));
drawVariableButtons(); // todo possibly re-add variable btns draw
drawPaginationButtons(); drawPaginationButtons();
placeItems(data); placeItems(data);
}).execute(); }).execute();