SamJakob / SpiGUI

A comprehensive GUI API for Spigot with pages support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

raph559 opened this issue · comments

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 ?

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

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); }