-
Notifications
You must be signed in to change notification settings - Fork 85
Updating from previous versions
Languages: Dutch (Nederlands)
Here's a list of API breaking changes which have been introduced which requires changing when updating to a newer version. Do note that if you update from multiple versions ago, you'll need to follow all steps for every update in between as well (e.g. when updating from 0.1.0 to 0.3.0 you'd need to follow both the steps in 0.2.0 and 0.3.0).
Every XML attribute previously called onClick
now needs to be called onLocalClick
. Also all method calls previously named setOnClick
have been renamed to setOnLocalClick
.
GuiLocation is completely removed. All instances where this class was used are now replaced by constructors which take in two integers, instead of one GuiLocation. Pane has been moved from pane.util
to pane
. x and y for panes are no longer mandatory; while currently existing code continues to work, you might want to change your custom panes to accept this behavior as well. Custom panes that are flippable, orientable or rotatable can now use the provided interfaces for this.
Every pane now needs a clear method. This method should clear any panes/items added to the pane. If your pane doesn't have items/panes, you can simply keep this method empty.
The display and click methods have been updated with the display method having an additional Gui and PlayerInventory parameter and the click method having an additional Gui parameter. Inside Gui, onLocalClick was renamed to onTopClick with the same holding true for XML. Inside the panes onLocalClick was changed to onClick, same for XML.
In Pane
setOnLocalClick
has been changed to setOnClick
. When adding a custom property, registerProperty
should be used instead of adding to getPropertyMappings
. The methods to retrieve a callback (getOnClose
, getAction
, getOnTopClick
, etc.) have been replaced with a method that directly calls the callback with error handling functionality.
In GuiItem
the copy
method now also copies the internal UUID
.
References to Gui
should be replaced with ChestGui
. Custom panes should update their display
and click
method to have the following signatures: void display(InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight)
and boolean click(Gui gui, InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight)
respectively. Custom panes should display their items in the provided InventoryComponent
instead of directly in the inventory. Any code related to deciding whether to place items in the inventory or player inventory should be removed: inventory components treat both as one and player inventory rows are appended to the normal inventory in inventory components. Code that sets the state of the gui should also be removed: this has now been deprecated. Click handlers should be able to work relatively similar as in the past, but should not rely on the slot
from the InventoryClickEvent
, but the provided slot
as this one represents the slot relative to your inventory part. This slot is also set correctly with regards to the player inventory; player inventories are considered directly below the normal inventory.
The constructor for guis can no longer be called with a Plugin
: remove this parameter.
Code related to setting the state of a gui should be removed; the framework now handles this itself and doesn't require additional code to decide the state for it. The click method in panes now take in the upper InventoryComponent
in which the pane resides. Please add this parameter to your method signature for custom panes.
Gui#setTitle
and ChestGui#setRows
no longer auto-update the gui and need to be updated manually after setting them. Gui#getInventory
and Gui#createInventory
have been moved to InventoryBased
. NamedGui#createInventory(String)
no longer exists.