-
Notifications
You must be signed in to change notification settings - Fork 0
v4 Migration Guide
This guide will help you migrate your project from v3 to v4. Please review the changes below to ensure a smooth transition.
Note: New APIs are only minimally referenced, this guide focuses on migration fixes.
These classes were moved to a different package, but kept their original names:
-
com.kamikazejam.kamicommon.gui.KamiMenu.MenuOpenCallback(internal class) →com.kamikazejam.kamicommon.menu.api.callbacks.MenuOpenCallback -
com.kamikazejam.kamicommon.gui.clicks.transform.IClickTransform→com.kamikazejam.kamicommon.menu.api.clicks.transform.IClickTransform -
com.kamikazejam.kamicommon.gui.struct.MenuSize→com.kamikazejam.kamicommon.menu.api.struct.size.MenuSize -
com.kamikazejam.kamicommon.gui.MenuManager→com.kamikazejam.kamicommon.menu.MenuManager -
com.kamikazejam.kamicommon.gui.clicks.MenuClick→com.kamikazejam.kamicommon.menu.api.clicks.MenuClick -
com.kamikazejam.kamicommon.gui.clicks.MenuClickEvent→com.kamikazejam.kamicommon.menu.api.clicks.MenuClickEvent -
com.kamikazejam.kamicommon.gui.clicks.MenuClickPage→com.kamikazejam.kamicommon.menu.api.clicks.MenuClickPage -
com.kamikazejam.kamicommon.gui.clicks.PlayerSlotClick→com.kamikazejam.kamicommon.menu.api.clicks.PlayerSlotClick -
com.kamikazejam.kamicommon.gui.loader.MenuSizeLoader→com.kamikazejam.kamicommon.menu.api.loaders.MenuSizeLoader -
com.kamikazejam.kamicommon.gui.MenuHolder→com.kamikazejam.kamicommon.menu.api.MenuHolder
These classes were renamed, and possibly relocated as well:
-
SpigotUtilProvider→SpigotUtilsSource(incom.kamikazejam.kamicommon) -
com.kamikazejam.kamicommon.gui.items.interfaces.IBuilderModifier→com.kamikazejam.kamicommon.menu.api.icons.interfaces.modifier.StaticIconModifier -
com.kamikazejam.kamicommon.gui.items.slots.ItemSlot→com.kamikazejam.kamicommon.menu.api.icons.slots.IconSlot -
com.kamikazejam.kamicommon.gui.items.slots.StaticItemSlot→com.kamikazejam.kamicommon.menu.api.icons.slots.StaticIconSlot -
com.kamikazejam.kamicommon.gui.items.slots.LastRowItemSlot→com.kamikazejam.kamicommon.menu.api.icons.slots.LastRowIconSlot -
com.kamikazejam.kamicommon.gui.items.MenuItem→com.kamikazejam.kamicommon.menu.api.icons.MenuIcon -
com.kamikazejam.kamicommon.gui.loader.MenuItemLoader→com.kamikazejam.kamicommon.menu.api.loaders.MenuIconLoader -
com.kamikazejam.kamicommon.gui.KamiMenu→com.kamikazejam.kamicommon.menu.SimpleMenu -
com.kamikazejam.kamicommon.gui.page.PagedKamiMenu.IndexedMenuItem→com.kamikazejam.kamicommon.menu.api.icons.PrioritizedMenuIcon -
com.kamikazejam.kamicommon.gui.clicks.transform.MenuClickPageTransform→com.kamikazejam.kamicommon.menu.api.clicks.transform.paginated.PaginatedMenuClickPageTransform -
com.kamikazejam.kamicommon.gui.clicks.transform.MenuClickEventTransform→com.kamikazejam.kamicommon.menu.api.clicks.transform.simple.SimpleMenuClickEventTransform -
com.kamikazejam.kamicommon.gui.clicks.transform.MenuClickTransform→com.kamikazejam.kamicommon.menu.api.clicks.transform.simple.SimpleMenuClickTransform
-
com.kamikazejam.kamicommon.util.log.LoggerServicemoved fromspigot-jartoshared-utils- Same package, no changes necessary
-
LoggerServicenow available in ALL modules
- The entire
com.kamikazejam.kamicommon.util.enginepackage moved fromspigot-jartospigot-utils- Imports do not need to be changed, all existing code should work as before
- This change just makes the engine utils available in
spigot-utilsas well now
- The entire
com.kamikazejam.kamicommon.util.mixinpackage moved fromspigot-jartospigot-utils- Imports do not need to be changed, all existing code should work as before
- This change just makes the engine utils available in
spigot-utilsas well now
- The entire
com.kamikazejam.kamicommon.util.teleportpackage moved fromspigot-jartospigot-utils- Imports do not need to be changed, all existing code should work as before
- This change just makes the teleport utils available in
spigot-utilsas well now
-
RENAMED:
registerListener(Listener...)→registerListeners(Listener...)(plural) -
RENAMED:
unregisterListener(Listener...)→unregisterListeners(Listener...)(plural) -
RENAMED:
registerDisableable(Disableable... disableables)→registerDisableables(Disableable... disableables)(plural) -
RENAMED:
unregisterDisableable(Disableable... disableables)→unregisterDisableables(Disableable... disableables)(plural) -
RENAMED:
registerTask(BukkitTask...)→registerTasks(BukkitTask...)(plural) -
RENAMED:
unregisterTask(BukkitTask...)→unregisterTasks(BukkitTask...)(plural) -
RENAMED:
IBuilder#parseMaterial(String)→IBuilder#parseXMaterial(String)-
IBuilder#parseMaterial(String)now returns a normalMaterial, and is properly named
-
SpigotUtilSource (formerly SpigotUtilProvider) was reworked to be more like other "Source" classes in KamiCommon. It now requires initialization following the standard plugin lifecycle:
Required initialization:
com.kamikazejam.kamicommon.SpigotUtilsSource#onEnable(KamiPlugin)com.kamikazejam.kamicommon.SpigotUtilsSource#onDisable()
Method changes:
-
RENAMED:
#getPlugin()→#get() -
REMOVED:
#setPlugin(Plugin)- Plugin is now set in#onEnable(KamiPlugin)
The KamiCommand framework has had one BREAKING change designed to improve usability and extendability.
Previously, when writing command logic in the #perform method, the parent class (KamiCommand) provided variables such as sender for use in the method. This paradigm has been changed to instead pass these variables in a wrapper class to the #perform method itself.
New method signature:
public abstract void perform(@NotNull CommandContext context);Available getters:
CommandContext#getArgs()CommandContext#getSender()-
CommandContext#getMe()(nullable Player, available if sender is a Player) CommandContext#isSenderIsConsole()
Migration:
Modify any reference to the removed variables to use the getters on the CommandContext parameter instead:
-
senderorthis.sender→context.getSender() -
argsorthis.args→context.getArgs() - etc.
KamiCommand in v3 had numerous individual method overloads for adding command parameters with different configurations. These have all been wrapped up with a new builder pattern, providing only one method to add parameters:
public KamiCommand addParameter(@NotNull Parameter.Builder<T> parameter);Creating and adding Parameters:
-
Parameter.of(TypeString.get())- creates aParameter.BuilderfromTypeString -
Parameter.of(TypeString.get()).name("playerName")- creates aParameter.BuilderfromTypeString, using the parameter name "playerName" -
Parameter.of(TypeString.get()).defaultValue(null)- creates aParameter.BuilderfromTypeString, with a default value of null -
Parameter.of(TypeString.get()).defaultValue(null, "all")- creates aParameter.BuilderfromTypeString, with a default value of null, described as "all" in the command help -
Parameter.of(TypeString.get()).concatFromHere(true)- creates aParameter.BuilderfromTypeString, enabling the concatenation of all remaining args into this parameter
Migration Example:
// v3 Example
this.addParameter(1, TypeInteger.get(), "page");
// Becomes v4:
this.addParameter(Parameter.of(TypeInteger.get()).name("page").defaultValue(1));- Numerous internal variables in
KamiCommandwere made private (access from commands was deemed unnecessary) - Numerous methods in
KamiCommandhad method signature changes, but these should not be used externally and thus unlikely to break code
spigot-jar to spigot-utils making them more available for use when shading.
Additionally, the com.kamikazejam.kamicommon.gui package was renamed to com.kamikazejam.kamicommon.menu.
IconSlot
- Reworked to calculate slot based on
MenuSize.#get(KamiMenu)changed to#get(MenuSize)
MenuIcon
- No longer stores its slot internally, the menu manages the assignment of
IconSlots toMenuIcons - BREAKING: All constructors for MenuIcon had the slot parameter removed
-
BREAKING:
#getSlotsmethod removed -
BREAKING:
#directModifyBuildersmethod removed
MenuIconLoader
- Since
MenuIconno longer holds its slot, this loader had the slot loading removed- Slot loading is now handled by
IconSlotLoader - Slot loading is unchanged, defining slots for icons in yaml is unchanged
- Slot loading is now handled by
MenuSize
-
REFACTORED from a class to a sealed interface with two implementations:
com.kamikazejam.kamicommon.menu.api.struct.size.MenuSizeRowscom.kamikazejam.kamicommon.menu.api.struct.size.MenuSizeType
- BREAKING: Construct one of the two implementations, as constructing MenuSize directly is no longer possible
MenuHolder
-
REFACTORED: Constructors to use
MenuSizeinstead of passing row count or type directly -
REMOVED:
#recreateInventory() -
REMOVED:
#setRows(int)and#setType(InventoryType)- Change the size with
#setSize(MenuSize)instead
- Change the size with
-
REMOVED:
KamiMenuLoader- Replaced with type-specific menu loaders:
SimpleMenuLoader,PaginatedMenuLoader,OneClickMenuLoader - Choose the type of menu you intend to use, then use the corresponding loader
- Replaced with type-specific menu loaders:
There are now 3 types of menus that all inherit logic from AbstractMenu:
-
SimpleMenu - A basic menu with a fixed size (used to be called
KamiMenu) -
PaginatedMenu - A menu that supports multiple pages of icons (used to be called
PagedKamiMenu) - OneClickMenu - A special menu that only allows one click per open, and can automatically close after that
-
KamiMenuwas renamed toSimpleMenu -
PagedKamiMenuwas renamed toPaginatedMenu
- Removed internal metadata variable
-
BREAKING: Construct a
SimpleMenufrom theSimpleMenu.Builderpattern (only way to create aSimpleMenunow) -
BREAKING:
SimpleMenuis a final class, it should be used as an object, not extended -
REMOVED:
#wrapAsPaged()method - create a dedicatedPaginatedMenuinstead. No longer interchangeable -
REFACTORED:
#openMenu(Player)into#open()- Player is known from menu creation, menu is intended for a single player, no longer needs to be passed in
-
REFACTORED:
#closeInventory(Player)into#close()- Player is known from menu creation, menu is intended for a single player, no longer needs to be passed in
-
REMOVED: ignore close handler APIs:
-
REMOVED:
#openMenu(Player, boolean) -
REMOVED:
#closeInventory(Player, boolean) -
REMOVED:
#getIgnoredClose() -
REMOVED:
#addIgnoredClose(Player) -
REMOVED:
#removeIgnoredClose(Player)
-
REMOVED:
-
REMOVED:
#closeAll()- There is only one viewer (the Player) per menu now, so this method is unnecessary. Use
#close()instead
- There is only one viewer (the Player) per menu now, so this method is unnecessary. Use
-
REMOVED:
#fill()- Menus now automatically fill empty slots with a default filler icon.
com.kamikazejam.kamicommon.menu.api.icons.MenuIcon#getDefaultFillerIcon - Disable the filler by doing one of the following:
- Removing the "filler" icon from the menu
- Setting the
MenuIconfor "filler" tonullor setting itsenabledproperty tofalse
- The filler can also be told to ignore certain slots using
MenuOptions.excludedFillSlots
- Menus now automatically fill empty slots with a default filler icon.
-
REMOVED:
#setFillerItem(MenuItem)- Supply your own filler icon by overriding the default "filler" icon using
#setIcon("filler", ...)
- Supply your own filler icon by overriding the default "filler" icon using
Menu Events were consolidated into their own class: com.kamikazejam.kamicommon.menu.api.struct.MenuEvents.
An events object is available in every menu, accessible via #getEvents() or through the builder using #events(MenuEvents.MenuEventsModification<MenuEvents>).
Method relocations:
-
whenOpened(MenuOpenCallback)→getEvents().addOpenCallback(MenuOpenCallback) -
addOpenCallback(MenuOpenCallback)→getEvents().addOpenCallback(MenuOpenCallback) -
setOpenCallback(String, MenuOpenCallback)→getEvents().addOpenCallback(String, MenuOpenCallback) -
onPlayerSlotClick(int, PlayerSlotClick)→getEvents().addPlayerSlotClick(int, PlayerSlotClick) -
onPlayerSlotClick(PlayerSlotClick)→getEvents().addPlayerInvClick(PlayerSlotClick) -
addClickPredicate(Predicate<InventoryClickEvent>)→getEvents().addClickPredicate(Predicate<InventoryClickEvent>) -
addCloseConsumer(Consumer<InventoryCloseEvent>)→getEvents().addCloseCallback(MenuCloseCallback) -
addPostCloseConsumer(Consumer<Player>)→getEvents().addPostCloseCallback(MenuPostCloseCallback)
New features:
-
ADDED overloads for each add method that accept a
Stringidentifier for easier removal later -
ADDED remove methods for each event type that accept a
Stringidentifier to remove previously added events
Icon management methods have been consolidated into its own interface: com.kamikazejam.kamicommon.menu.api.icons.access.IMenuIconsAccess
Access this interface in any menu via #getMenuIconsAccess() or via #modifyIcons(Consumer<IMenuIconsAccess>).
- Can also be accessed in the builder via
#modifyIcons(Consumer<IMenuIconsAccess>) - Direct icon map access, if necessary, is available in the builder via:
#getMenuIcons()
Icons Access Method Changes (all moved to IMenuIconsAccess):
-
ADDED
getMenuIconsAccess() -
ADDED
modifyIcons(Consumer<IMenuIconsAccess>) -
REFACTORED
getMenuItem(String)→IMenuIconsAccess.getMenuIcon(String) -
REFACTORED
setMenuClick(String, MenuClick)→IMenuIconsAccess.setMenuClick(String, MenuClick) -
REFACTORED
setMenuClick(String, MenuClickPage)→IMenuIconsAccess.setMenuClick(String, MenuClickPage) -
REFACTORED
setMenuClick(String, MenuClickEvent)→IMenuIconsAccess.setMenuClick(String, MenuClickEvent) -
REFACTORED
setModifier(String, IBuilderModifier)→IMenuIconsAccess.setModifier(String, StaticIconModifier) -
REFACTORED
setAutoUpdate(String, IBuilderModifier, int)→IMenuIconsAccess.setModifier(String, StaticIconModifier, int) -
REFACTORED
isValidMenuItemID(String)→IMenuIconsAccess.isValidMenuIconID(String) -
REFACTORED
getMenuItemIDs()→IMenuIconsAccess.getMenuIconIDs() -
NEW
IMenuIconsAccess.setModifier(String, StatefulIconModifier) -
NEW
IMenuIconsAccess.setAutoUpdate(String, StatefulIconModifier, int)
Menu options have been consolidated into their own class: com.kamikazejam.kamicommon.menu.api.struct.MenuOptions.
There are special options classes for paginated and one-click menus that extend MenuOptions:
com.kamikazejam.kamicommon.menu.api.struct.paginated.PaginatedMenuOptionscom.kamikazejam.kamicommon.menu.api.struct.oneclick.OneClickMenuOptions
PagedKamiMenu was renamed to PaginatedMenu and reworked to be a dedicated class that inherits logic from AbstractMenu like SimpleMenu and OneClickMenu.
Many changes are inherited from the changes to AbstractMenu and SimpleMenu, refer to those changes as well during migration.
-
BREAKING: Construct a
PaginatedMenufrom thePaginatedMenu.Builder -
BREAKING:
PaginatedMenuis a final class, it should be used as an object, not extended -
REFACTORED:
pagedItemsrenamed topagedIcons -
REFACTORED:
IndexedMenuItemwas converted toPrioritizedMenuIconand wrapped in the new management class:com.kamikazejam.kamicommon.menu.api.struct.icons.PrioritizedMenuIconMap
-
BREAKING: Relocated Next/Previous page methods:
PaginatedMenuOptions#getNextPageIconPaginatedMenuOptions#getPrevPageIcon
-
REFACTORED:
#getAppendTitleWithPage→AbstractPaginatedMenuTitle#getAppendTitleWithPage -
REFACTORED:
#setAppendTitleWithPage→AbstractPaginatedMenuTitle#setAppendTitleWithPage -
REMOVED:
#getMenuName- Name is derived from new title format system
-
REFACTORED: Next and Previous Slot methods:
-
getPreviousIconSlot(int)→getOptions().getLayout().getPreviousIconSlot() -
getNextIconSlot(int)→getOptions().getLayout().getNextIconSlot() -
REMOVED:
setPreviousIconSlot(ItemSlot)- Can only be set by providing a custom
PaginationLayoutimplementation overriding#getPreviousIconSlot()
- Can only be set by providing a custom
-
REMOVED:
setNextIconSlot(ItemSlot)- Can only be set by providing a custom
PaginationLayoutimplementation overriding#getNextIconSlot()
- Can only be set by providing a custom
-
-
REMOVED:
#applyToParent- No longer applicable, paginated menus are no longer a wrapper around simple menus
- The
#open()method now handles all relevant logic for opening the menu
-
REMOVED: static method
PagedKamiMenu#defaultPageSlots()- Replaced by
PaginationLayoutwhich provides#getSlots(MenuSize) - Previous Defaults are now represented by
SimplePaginationLayout(the default layout)
- Replaced by
Similar to SimpleMenu, paged icon management methods have been consolidated into its own interface: com.kamikazejam.kamicommon.menu.api.icons.access.paginated.IPageIconsAccess
- Access this interface on your
PaginatedMenu.Buildervia#modifyPageIcons(Consumer<IPageIconsAccess>)
Paged menu layouts are now defined by the interface: com.kamikazejam.kamicommon.menu.api.struct.paginated.layout.PaginationLayout
A default layout is defined in com.kamikazejam.kamicommon.menu.api.struct.paginated.layout.SimplePaginationLayout
This layout is home to the following information:
- The next page icon slot
- The previous page icon slot
- The set of available slots for paginated icons to fill
To change a menu's layout, create your own implementation of PaginationLayout and set it in the PaginatedMenuOptions using #setLayout(PaginationLayout).
Paged menu titles are now defined by the interface: com.kamikazejam.kamicommon.menu.api.struct.paginated.title.AbstractPaginatedMenuTitle
A default title implementation is provided in com.kamikazejam.kamicommon.menu.api.struct.paginated.title.DefaultPaginatedMenuTitle
To change a menu's title format, create your own implementation of AbstractPaginatedMenuTitle and set it in the PaginatedMenuOptions using #setTitleFormat(AbstractPaginatedMenuTitle).
- The
AutoUpdatesystem and classes were removed in v4. An improved update system may be added in the future, but there are no plans at this time - The
standalone-jarmodule had itsgsondependency removed, as it was not being used. If you were importingstandalone-jarjust forgson, you will need to add your own dependency now -
REMOVED:
StringUtil#repeat(String, int)- Use Java's
String.repeat(int)instead
- Use Java's
- Added
com.kamikazejam.kamicommon.redis.RedisChannelRaw - Added
com.kamikazejam.kamicommon.redis.RedisAPI#registerChannelRaw - Added access methods to use raw Strings in
com.kamikazejam.kamicommon.redis.RedisChannelRedisChannel#publishRawSyncRedisChannel#publishRawAsyncRedisChannel#publishRaw
- Added access methods using raw Strings in
com.kamikazejam.kamicommon.redis.RedisManager- Added
RedisManager#subscribeRaw - Added
RedisManager#publishRaw
- Added
- Added access methods to use raw Strings in
com.kamikazejam.kamicommon.redis.RedisMultiChannel#RedisMultiChannelcom.kamikazejam.kamicommon.redis.RedisMultiChannel#publishRawSynccom.kamikazejam.kamicommon.redis.RedisMultiChannel#publishRawAsynccom.kamikazejam.kamicommon.redis.RedisMultiChannel#publishRaw
- Added
com.kamikazejam.kamicommon.menu.api.icons.interfaces.modifier.StatefulIconModifier- Register via the same modifier methods as
StaticIconModifierMenuIcon#setModifier(StaticIconModifier)MenuIcon#setAutoUpdate(StaticIconModifier, int)
- Provides additional state information including original builder and previous ItemStack
- Register via the same modifier methods as
- Added
com.kamikazejam.kamicommon.menu.api.icons.slots.PositionSlot- Allows position-based slot assignment (1-indexed). In a typical chest the position (1,1) would be slot 0
- Added
AbstractMenuBuilder#titleReplacement(CharSequence, CharSequence)- Works on all three menu builders
- Allows replacing parts of the title when building the menu
- Example: You want the title to include the name of the player who views it. You add "{player}" within the title string or the config title
- Then you call
builder.titleReplacement("{player}", player.getName())on the builder, when you know who the player is
- Then you call
These updates apply to all three menu types: SimpleMenu, PaginatedMenu, and OneClickMenu.
- Added
AbstractMenu#reopenMenu(Player)- Reopen the menu for the provided player (must be the same player the menu was created for)
- Added
AbstractMenu#reopenMenu(Player, boolean)- Can pass true to the boolean to reset the visuals and tick counter of the menu, simulating a fresh open for the auto update icons
- Added
AbstractMenu#open(boolean)- Can pass true to the boolean to reset the visuals and tick counter of the menu, creating a fresh open for the auto update icons
- Allows this menu to be reused slightly easier, without needing to recreate it
- Added
AbstractMenu#setSize(MenuSize)andAbstractMenu#resizeMenu(MenuSize)- Allows the menu to be resized after creation
- This method supports calls while live, if a player is viewing the menu when it is resized, the inventory will be updated live
- Added
AbstractMenu#getFillerIcon()- Method to fetch the current filler icon
- Return value can be directly modified to update the filler icon
- Added
AbstractMenu#placeIcons(@Nullable Predicate<MenuIcon>)- Manual method to cause an immediate menu refresh of all icons that match the provided predicate
- Useful if you have some click logic that modifies the menu's icons, and you want to immediately reflect those changes visually
- Passing a null predicate with
placeIcons(null)will refresh ALL icons in the menu
These updates apply to all three menu builders: SimpleMenu.Builder, PaginatedMenu.Builder, and OneClickMenu.Builder.
- Added
AbstractMenuBuilder#getSize()- Fetches the current
MenuSizeassigned to the builder
- Fetches the current
- Added
AbstractMenuBuilder#size(MenuSize)- Sets a new
MenuSizeto the builder
- Sets a new
- Added
AbstractMenuBuilder#title(String)- Sets a new title string to the builder
- Added
AbstractMenuBuilder#title(MenuTitleProvider)- Sets a new title provider to the builder
- Added
AbstractMenuBuilder#titleReplacement(CharSequence, CharSequence)- Registers a text replacement to be applied to the title when the menu is built
- Added
AbstractMenuBuilder#options(MenuOptions.MenuOptionsModification)- Intended for the interface to be fulfilled with a lambda, granting access to the
MenuOptionsobject for modification
- Intended for the interface to be fulfilled with a lambda, granting access to the
- Added
AbstractMenuBuilder#events(MenuEvents.MenuEventsModification)- Intended for the interface to be fulfilled with a lambda, granting access to the
MenuEventsobject for modification
- Intended for the interface to be fulfilled with a lambda, granting access to the
- Added
AbstractMenuBuilder#fillerIcon(@Nullable MenuIcon)- Directly set a new filler icon to the builder (can set to null to disable the filler icon)
- Added
AbstractMenuBuilder#modifyIcons(Consumer<IMenuIconsAccess>)- Intended for the interface to be fulfilled with a lambda, granting access to the
IMenuIconsAccessobject for modification of icons
- Intended for the interface to be fulfilled with a lambda, granting access to the
These updates apply to all three menu types: SimpleMenu, PaginatedMenu, and OneClickMenu.
- Added
Menu#getEvents()- Provides access to the current state of the
MenuEventsobject, after the menu has been built
- Provides access to the current state of the
- Added
Menu#getOptions()- Provides access to the current state of the
MenuOptionsobject, after the menu has been built
- Provides access to the current state of the
- Added
Menu#getMenuSize()- Provides access to the current
MenuSizeof the menu
- Provides access to the current
- Added
Menu#getMenuIcons()- Provides direct access to the internal map of icons in the menu
- Added
Menu#getMenuIconsAccess()- Provides access to the
IMenuIconsAccessobject, after the menu has been built
- Provides access to the
- Added
PaginatedMenu#getOptions()- Provides access to the current state of the
PaginatedMenuOptionsobject, which inherits fromMenuOptions
- Provides access to the current state of the
- Added
PaginatedMenu#open(pageIndex)- Provides the ability to open the menu directly to a specific page (0-indexed)
- Added
PaginatedMenu#getCurrentPage()- Provides access to the current page index of the menu (0-indexed)
- Added
PaginatedMenu#modifyPageIcons(Consumer<IPageIconsAccess>)- Intended for the interface to be fulfilled with a lambda, granting access to the
IPageIconsAccessobject for modification of paged icons
- Intended for the interface to be fulfilled with a lambda, granting access to the
-
PaginatedMenu.Builder#paginationOptions(PaginatedMenuOptionsModification)- Intended for the interface to be fulfilled with a lambda, granting access to the
PaginatedMenuOptionsobject for modification
- Intended for the interface to be fulfilled with a lambda, granting access to the
-
PaginatedMenu.Builder#modifyPageIcons(Consumer<IPageIconsAccess>)- Intended for the interface to be fulfilled with a lambda, granting access to the
IPageIconsAccessobject for modification of paged icons
- Intended for the interface to be fulfilled with a lambda, granting access to the
Added com.kamikazejam.kamicommon.configuration.spigot.CachedConfig to be a framework class allowing easier management of config reloads.
By creating your own subclass of CachedConfig, and registering it with a KamiConfig using com.kamikazejam.kamicommon.configuration.spigot.KamiConfig#registerObserver, your subclass will automatically have its #loadConfig() method called whenever the parent KamiConfig is reloaded.
This enables you to write caching logic that parses the config into local variables, and have those variables automatically updated on config reloads.
There is also a com.kamikazejam.kamicommon.modules.config.CachedModuleConfig which takes a Module instead of a KamiConfig. This class automatically registers itself to the module's config, so that you can cache values parsed from a module's config.
-
KamiPlugin#registerCommands(KamiCommand...)- Registers several commands, updating the command map to make them live immediately
-
KamiPlugin#unregisterCommands(KamiCommand...)- Unregisters several commands, updating the command map to make the changes live immediately
-
KamiPlugin#unregisterCommands()- Unregisters all commands previously assigned to this plugin, updating the command map to make the changes live immediately
-
KamiPlugin#unregisterListeners()- Unregisters all listeners previously assigned to this plugin
-
KamiPlugin#unregisterDisableables()- Unregisters all disableables previously assigned to this plugin
-
KamiPlugin#unregisterTasks()- Unregisters all tasks previously assigned to this plugin
-
KamiPlugin#registerConfigObserver(ConfigObserver, KamiConfig)- Util method that calls
KamiConfig#registerObserveron the provided config, with the provided observer
- Util method that calls
-
KamiPlugin#onConfigLoaded(KamiConfig)- In v4
KamiPluginwas made a config observer of its default config.yml automatically - This method is called whenever the primary plugin config is loaded or reloaded
- It is optional, you do not have to override it or use it if you do not need to
- In v4
-
ItemUtil#isSimplySimilar(ItemStack, ItemStack)- Util to compare two ItemStacks for basic similarity, details in the method javadoc
- Support for config sequences is in VERY early stages, and is currently READ-ONLY
- Attempting to write to a config file which contains sequences will cause exceptions
- This system should probably not be used yet, and its API will not be documented here
- Feel free to explore the
KamiConfigclass and methods if you dare to use sequences at this time
- Feel free to explore the