Skip to content

Commit

Permalink
fix: Errors and make scrolling behave more like paginated
Browse files Browse the repository at this point in the history
  • Loading branch information
LichtHund committed May 5, 2023
1 parent 5fc1a67 commit 98fc432
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 366 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ subprojects {
}

group = "dev.triumphteam"
version = "3.1.4"
version = "3.1.5"

dependencies {
compileOnly("org.jetbrains:annotations:21.0.1")
Expand Down
5 changes: 0 additions & 5 deletions core/src/main/java/dev/triumphteam/gui/guis/GuiListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,6 @@ public void onGuiClose(final InventoryCloseEvent event) {
// GUI
final BaseGui gui = (BaseGui) event.getInventory().getHolder();

// If it's a persistent paginated gui saves the current page modifications
if (gui instanceof PersistentPaginatedGui) {
((PersistentPaginatedGui) gui).savePage();
}

// The GUI action for closing
final GuiAction<InventoryCloseEvent> closeAction = gui.getCloseGuiAction();

Expand Down

This file was deleted.

5 changes: 2 additions & 3 deletions core/src/main/java/dev/triumphteam/gui/guis/ScrollingGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private int calculateScrollSize() {
*/
private void putItemVertically(final GuiItem guiItem) {
for (int slot = 0; slot < getRows() * 9; slot++) {
if (getInventory().getItem(slot) != null) continue;
if (getGuiItem(slot) != null || getInventory().getItem(slot) != null) continue;
getMutableCurrentPageItems().put(slot, guiItem);
getInventory().setItem(slot, guiItem.getItemStack());
break;
Expand All @@ -283,8 +283,7 @@ private void putItemHorizontally(final GuiItem guiItem) {
for (int col = 1; col < 10; col++) {
for (int row = 1; row <= getRows(); row++) {
final int slot = getSlotFromRowCol(row, col);
if (getInventory().getItem(slot) != null) continue;

if (getGuiItem(slot) != null || getInventory().getItem(slot) != null) continue;
getMutableCurrentPageItems().put(slot, guiItem);
getInventory().setItem(slot, guiItem.getItemStack());
return;
Expand Down

0 comments on commit 98fc432

Please sign in to comment.