Skip to content

Commit

Permalink
1.5.70
Browse files Browse the repository at this point in the history
BlobEditor#loadPage overriden
  • Loading branch information
anjoismysign committed Nov 29, 2022
1 parent 3a4eb51 commit 969d206
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/main/java/us/mytheria/bloblib/entities/BlobEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,38 @@ public class BlobEditor<T> extends VariableSelector<T> implements VariableEditor
private final SelectorListenerManager selectorManager;

public static <T> BlobEditor<T> build(BlobInventory blobInventory, UUID builderId,
String dataType, VariableFiller<T> filler) {
String dataType) {
return new BlobEditor<>(blobInventory, builderId,
dataType, null);
dataType);
}

private BlobEditor(BlobInventory blobInventory, UUID builderId,
String dataType, VariableFiller<T> filler) {
super(blobInventory, builderId, dataType, filler);
String dataType) {
super(blobInventory, builderId, dataType, null);
list = new ArrayList<>();
selectorManager = BlobLib.getInstance().getSelectorManager();
}

@Override
public void loadInConstructor() {
}

@Override
public void loadPage(int page, boolean refill) {
if (page < 1)
return;
if (getTotalPages() < page) {
return;
}
if (refill)
refillButton("White-Background");
clearValues();
List<VariableValue<T>> values = page(page, getItemsPerPage());
for (int i = 0; i < values.size(); i++) {
setValue(i, values.get(i));
}
}

@Override
public List<VariableValue<T>> page(int page, int itemsPerPage) {
int start = (page - 1) * itemsPerPage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public void setValue(int slot, VariableValue<T> value) {
setButton(slot, value.itemStack());
}

public void clearValues() {
values.clear();
}

public T getValue(int slot) {
return values.get(slot);
}
Expand Down Expand Up @@ -124,6 +128,10 @@ public int valuesSize() {
return getValues().size();
}

public int getItemsPerPage() {
return itemsPerPage;
}

public void setPage(int page) {
if (page < 1)
return;
Expand Down

0 comments on commit 969d206

Please sign in to comment.