Comments (5)
Is the project abandoned? (This is my other account)
from spigui.
No, it's not I just missed this issue somehow...
Ah I see - so the simplest solution in other words would just be a matter of also checking if we've switched between having or not having pagination?
from spigui.
No, it's not I just missed this issue somehow...
Ah I see - so the simplest solution in other words would just be a matter of also checking if we've switched between having or not having pagination?
I guess... As I said, when we use menu.setAutomaticPaginationEnabled(false);
before opening the inventory, the scheduler is cancelled because the API thinks that a new inventory is opening.
from spigui.
Hi, to summarize I found a bug on an if statement in the
refreshInventory()
method.// If the new size is different, we'll need to open a new inventory. if (viewer.getOpenInventory().getTopInventory().getSize() != getPageSize() + (getMaxPage() > 0 ? 9 : 0)) { viewer.openInventory(getInventory()); return; }
My code:
SGMenu menu = Main.spiGUI.create("&eInventory", 2); menu.setAutomaticPaginationEnabled(false); //Buttons stuff BukkitScheduler scheduler = Bukkit.getServer().getScheduler(); BukkitTask task = scheduler.runTaskTimer(plugin, new Runnable() { @Override public void run() { menu.clearAllButStickiedSlots(); //Set buttons stuff again menu.refreshInventory(p); } }, 0L, 20L); menu.setOnClose(inventory -> { if (task != null) scheduler.cancelTask(task.getTaskId()); });
The problem is that when I use
menu.setAutomaticPaginationEnabled(false);
the previous if statement is called and the scheduler is cancelled because it opens a new inventory and that must not happen because I am not modifying the inventory size after opening the inventory.
If you just read a little into the code you will find (in the refresh method):
viewer.getOpenInventory().getTopInventory().setContents(this.getInventory().getContents());
If you just use your brain to replace the variables such as viewer, and this, (this meaning inventory) then you can easily refresh the inventory without using the method.
player.getOpenInventory().getTopInventory().setContents(menu.getInventory().getContents());
from spigui.
Currently am using another GUI API, so I don't need this more.
from spigui.
Related Issues (20)
- SGMenuListener does not handle InventoryDragEvent HOT 3
- Add or change some PaginationButtons HOT 2
- No items in close event HOT 7
- Add ChatComponent support HOT 5
- Remove Page Buttons HOT 2
- Plugin does not check if the clicked inventory is the actual GUI HOT 4
- [QUESTION TO USERS] What Minecraft versions are this library being used with? HOT 6
- Block unrealistic interactions to avoid getting items from gui HOT 6
- Customizing Toolbar (Pagination) buttons HOT 2
- does this plugin have docs? HOT 3
- No way to remove the current page item HOT 2
- ClassNotFound error with Gradle HOT 7
- how do i get it to list player heads in a gui for every player on the server HOT 3
- Need a Support quickly HOT 1
- Please Write Docs! HOT 5
- Bug in Toolbar HOT 4
- InventoryClickEvent click types HOT 2
- Bottom inventory event
- Toolbar Button and Menu Slots
- Shift + click not firing Listener
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spigui.