Closed Stogalosu closed 1 year ago
Youre trying to use bukkit event handlers inside a map widget, something that isn't really supported. Are you sure the event is fired for a valid widget instance, and not one that has been detached / removed? Check by comparing
System.out.println(System.identityHashCode(this));
in onAttached vs your event handler.
Your error points towards an onTick but your code sample has none.
-
Instead of handling bukkit events in widgets, handle them in your own plugin event listener. You can use the static MapDisplay methods to get the instance of your display. To propagate events to the focused widgets, theres a sendStatusChange method, and a similar onStatusChanged method you can override in your widget.
If events are firing for a detached/invalid listener, then most likely getTabCount() is 0, explaining the error.
And if you really want a listener in there, register it in onAttached() and use this method to unregister the listener in onDetached():
Closing issue, invalid issue - not a BKCommonLib problem in the first place.
BkCommonLib version: 1.18.2-v2
Spigot version: 1.18.1-R0.1
Problem or bug: When creating a new method in a class that extends MapWidgetTabView and calling setSelectedIndex() inside of it, I receive error Index out of bounds, but when calling it inside an already defined method like onAttached() or onRightClick(), it works just fine
Code.txt Error.txt