SamJakob / SpiGUI

A comprehensive GUI API for Spigot with pages support.
MIT License
107 stars 21 forks source link

Cannot invoke "java.util.function.Consumer.accept(Object)" because "this.onPageChange" is null when trying to setCurrentPage(1) #13

Closed raph559 closed 2 years ago

raph559 commented 2 years ago

Hello ! I don't know how to fix that, maybe I'm just using the function wrong, but I don't think so. Can someone help me ?

SamJakob commented 2 years ago

Can you provide the stack trace and/or the snippet of code from your project where the error occurs?

raph559 commented 2 years ago

Of course, here it is : configMenu.setButton(0, 10,new SGButton(new ItemBuilder(Material.BONE) .name("Editer les règles") .build()) .withListener(event -> {configMenu.setCurrentPage(1);}) ); The error refers to those lines on SGMenu.java : public void setCurrentPage (int page) { this.currentPage = page; this.onPageChange.accept(this); }