Skip to content

v4 Migration Guide

Jake-Moore edited this page Aug 24, 2025 · 3 revisions

Welcome to KamiCommon v4 🚀

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.

Relocated Classes (Names Preserved)

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.IClickTransformcom.kamikazejam.kamicommon.menu.api.clicks.transform.IClickTransform
  • com.kamikazejam.kamicommon.gui.struct.MenuSizecom.kamikazejam.kamicommon.menu.api.struct.size.MenuSize
  • com.kamikazejam.kamicommon.gui.MenuManagercom.kamikazejam.kamicommon.menu.MenuManager
  • com.kamikazejam.kamicommon.gui.clicks.MenuClickcom.kamikazejam.kamicommon.menu.api.clicks.MenuClick
  • com.kamikazejam.kamicommon.gui.clicks.MenuClickEventcom.kamikazejam.kamicommon.menu.api.clicks.MenuClickEvent
  • com.kamikazejam.kamicommon.gui.clicks.MenuClickPagecom.kamikazejam.kamicommon.menu.api.clicks.MenuClickPage
  • com.kamikazejam.kamicommon.gui.clicks.PlayerSlotClickcom.kamikazejam.kamicommon.menu.api.clicks.PlayerSlotClick
  • com.kamikazejam.kamicommon.gui.loader.MenuSizeLoadercom.kamikazejam.kamicommon.menu.api.loaders.MenuSizeLoader
  • com.kamikazejam.kamicommon.gui.MenuHoldercom.kamikazejam.kamicommon.menu.api.MenuHolder

Renamed Classes

These classes were renamed, and possibly relocated as well:

  • SpigotUtilProviderSpigotUtilsSource (in com.kamikazejam.kamicommon)
  • com.kamikazejam.kamicommon.gui.items.interfaces.IBuilderModifiercom.kamikazejam.kamicommon.menu.api.icons.interfaces.modifier.StaticIconModifier
  • com.kamikazejam.kamicommon.gui.items.slots.ItemSlotcom.kamikazejam.kamicommon.menu.api.icons.slots.IconSlot
  • com.kamikazejam.kamicommon.gui.items.slots.StaticItemSlotcom.kamikazejam.kamicommon.menu.api.icons.slots.StaticIconSlot
  • com.kamikazejam.kamicommon.gui.items.slots.LastRowItemSlotcom.kamikazejam.kamicommon.menu.api.icons.slots.LastRowIconSlot
  • com.kamikazejam.kamicommon.gui.items.MenuItemcom.kamikazejam.kamicommon.menu.api.icons.MenuIcon
  • com.kamikazejam.kamicommon.gui.loader.MenuItemLoadercom.kamikazejam.kamicommon.menu.api.loaders.MenuIconLoader
  • com.kamikazejam.kamicommon.gui.KamiMenucom.kamikazejam.kamicommon.menu.SimpleMenu
  • com.kamikazejam.kamicommon.gui.page.PagedKamiMenu.IndexedMenuItemcom.kamikazejam.kamicommon.menu.api.icons.PrioritizedMenuIcon
  • com.kamikazejam.kamicommon.gui.clicks.transform.MenuClickPageTransformcom.kamikazejam.kamicommon.menu.api.clicks.transform.paginated.PaginatedMenuClickPageTransform
  • com.kamikazejam.kamicommon.gui.clicks.transform.MenuClickEventTransformcom.kamikazejam.kamicommon.menu.api.clicks.transform.simple.SimpleMenuClickEventTransform
  • com.kamikazejam.kamicommon.gui.clicks.transform.MenuClickTransformcom.kamikazejam.kamicommon.menu.api.clicks.transform.simple.SimpleMenuClickTransform

Inter-Module Class Relocations

  • com.kamikazejam.kamicommon.util.log.LoggerService moved from spigot-jar to shared-utils
    • Same package, no changes necessary
    • LoggerService now available in ALL modules
  • The entire com.kamikazejam.kamicommon.util.engine package moved from spigot-jar to spigot-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-utils as well now
  • The entire com.kamikazejam.kamicommon.util.mixin package moved from spigot-jar to spigot-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-utils as well now
  • The entire com.kamikazejam.kamicommon.util.teleport package moved from spigot-jar to spigot-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-utils as well now

⚠️ BREAKING API Changes

Method Renames

  • 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 normal Material, and is properly named

⚠️ BREAKING SpigotUtilSource Changes

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)

⚠️ BREAKING Command Framework Changes

Change 1: perform() Method Signature

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:

  • sender or this.sendercontext.getSender()
  • args or this.argscontext.getArgs()
  • etc.

Change 2: Command Parameter Consolidation

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 a Parameter.Builder from TypeString
  • Parameter.of(TypeString.get()).name("playerName") - creates a Parameter.Builder from TypeString, using the parameter name "playerName"
  • Parameter.of(TypeString.get()).defaultValue(null) - creates a Parameter.Builder from TypeString, with a default value of null
  • Parameter.of(TypeString.get()).defaultValue(null, "all") - creates a Parameter.Builder from TypeString, with a default value of null, described as "all" in the command help
  • Parameter.of(TypeString.get()).concatFromHere(true) - creates a Parameter.Builder from TypeString, 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));

Other Changes

  • Numerous internal variables in KamiCommand were made private (access from commands was deemed unnecessary)
  • Numerous methods in KamiCommand had method signature changes, but these should not be used externally and thus unlikely to break code

⚠️ BREAKING Menu Framework REWORK

⚠️ All Menu related APIs have moved from 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.

API Changes (for existing Classes)

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 to MenuIcons
  • BREAKING: All constructors for MenuIcon had the slot parameter removed
  • BREAKING: #getSlots method removed
  • BREAKING: #directModifyBuilders method removed

MenuIconLoader

  • Since MenuIcon no 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

MenuSize

  • REFACTORED from a class to a sealed interface with two implementations:
    1. com.kamikazejam.kamicommon.menu.api.struct.size.MenuSizeRows
    2. com.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 MenuSize instead of passing row count or type directly
  • REMOVED: #recreateInventory()
  • REMOVED: #setRows(int) and #setType(InventoryType)
    • Change the size with #setSize(MenuSize) instead

Menu Loaders

  • 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

Menu Classes (Dedicated Menu Types)

There are now 3 types of menus that all inherit logic from AbstractMenu:

  1. SimpleMenu - A basic menu with a fixed size (used to be called KamiMenu)
  2. PaginatedMenu - A menu that supports multiple pages of icons (used to be called PagedKamiMenu)
  3. OneClickMenu - A special menu that only allows one click per open, and can automatically close after that
  • KamiMenu was renamed to SimpleMenu
  • PagedKamiMenu was renamed to PaginatedMenu

SimpleMenu Changes

  • Removed internal metadata variable
  • BREAKING: Construct a SimpleMenu from the SimpleMenu.Builder pattern (only way to create a SimpleMenu now)
  • BREAKING: SimpleMenu is a final class, it should be used as an object, not extended
  • REMOVED: #wrapAsPaged() method - create a dedicated PaginatedMenu instead. 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: #closeAll()
    • There is only one viewer (the Player) per menu now, so this method is unnecessary. Use #close() instead
  • 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 MenuIcon for "filler" to null or setting its enabled property to false
    • The filler can also be told to ignore certain slots using MenuOptions.excludedFillSlots
  • REMOVED: #setFillerItem(MenuItem)
    • Supply your own filler icon by overriding the default "filler" icon using #setIcon("filler", ...)

Menu Events Rework

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 String identifier for easier removal later
  • ADDED remove methods for each event type that accept a String identifier to remove previously added events

Icon Management Rework

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 Rework

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.PaginatedMenuOptions
  • com.kamikazejam.kamicommon.menu.api.struct.oneclick.OneClickMenuOptions

PaginatedMenu Changes (formerly PagedKamiMenu)

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 PaginatedMenu from the PaginatedMenu.Builder
  • BREAKING: PaginatedMenu is a final class, it should be used as an object, not extended
  • REFACTORED: pagedItems renamed to pagedIcons
  • REFACTORED: IndexedMenuItem was converted to PrioritizedMenuIcon and wrapped in the new management class:
    • com.kamikazejam.kamicommon.menu.api.struct.icons.PrioritizedMenuIconMap
  • BREAKING: Relocated Next/Previous page methods:
    • PaginatedMenuOptions#getNextPageIcon
    • PaginatedMenuOptions#getPrevPageIcon
  • REFACTORED: #getAppendTitleWithPageAbstractPaginatedMenuTitle#getAppendTitleWithPage
  • REFACTORED: #setAppendTitleWithPageAbstractPaginatedMenuTitle#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 PaginationLayout implementation overriding #getPreviousIconSlot()
    • REMOVED: setNextIconSlot(ItemSlot)
      • Can only be set by providing a custom PaginationLayout implementation overriding #getNextIconSlot()
  • 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 PaginationLayout which provides #getSlots(MenuSize)
    • Previous Defaults are now represented by SimplePaginationLayout (the default layout)

PaginatedMenu Paged Icon Management

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.Builder via #modifyPageIcons(Consumer<IPageIconsAccess>)

PaginatedMenu Layout Customization

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).

PaginatedMenu Title Customization

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).

API Removals

  • The AutoUpdate system 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-jar module had its gson dependency removed, as it was not being used. If you were importing standalone-jar just for gson, you will need to add your own dependency now
  • REMOVED: StringUtil#repeat(String, int)
    • Use Java's String.repeat(int) instead

New API Additions

Redis Channel Usage with Raw Strings

  • 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.RedisChannel
    • RedisChannel#publishRawSync
    • RedisChannel#publishRawAsync
    • RedisChannel#publishRaw
  • Added access methods using raw Strings in com.kamikazejam.kamicommon.redis.RedisManager
    • Added RedisManager#subscribeRaw
    • Added RedisManager#publishRaw
  • Added access methods to use raw Strings in com.kamikazejam.kamicommon.redis.RedisMultiChannel#RedisMultiChannel
    • com.kamikazejam.kamicommon.redis.RedisMultiChannel#publishRawSync
    • com.kamikazejam.kamicommon.redis.RedisMultiChannel#publishRawAsync
    • com.kamikazejam.kamicommon.redis.RedisMultiChannel#publishRaw

Menu Framework API Additions

  • Added com.kamikazejam.kamicommon.menu.api.icons.interfaces.modifier.StatefulIconModifier
    • Register via the same modifier methods as StaticIconModifier
      • MenuIcon#setModifier(StaticIconModifier)
      • MenuIcon#setAutoUpdate(StaticIconModifier, int)
    • Provides additional state information including original builder and previous ItemStack
  • 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

AbstractMenu Additions

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) and AbstractMenu#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

AbstractMenuBuilder Additions

These updates apply to all three menu builders: SimpleMenu.Builder, PaginatedMenu.Builder, and OneClickMenu.Builder.

  • Added AbstractMenuBuilder#getSize()
    • Fetches the current MenuSize assigned to the builder
  • Added AbstractMenuBuilder#size(MenuSize)
    • Sets a new MenuSize to the builder
  • 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 MenuOptions object for modification
  • Added AbstractMenuBuilder#events(MenuEvents.MenuEventsModification)
    • Intended for the interface to be fulfilled with a lambda, granting access to the MenuEvents object for modification
  • 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 IMenuIconsAccess object for modification of icons

Menu Additions

These updates apply to all three menu types: SimpleMenu, PaginatedMenu, and OneClickMenu.

  • Added Menu#getEvents()
    • Provides access to the current state of the MenuEvents object, after the menu has been built
  • Added Menu#getOptions()
    • Provides access to the current state of the MenuOptions object, after the menu has been built
  • Added Menu#getMenuSize()
    • Provides access to the current MenuSize of the menu
  • Added Menu#getMenuIcons()
    • Provides direct access to the internal map of icons in the menu
  • Added Menu#getMenuIconsAccess()
    • Provides access to the IMenuIconsAccess object, after the menu has been built

PaginatedMenu Additions

  • Added PaginatedMenu#getOptions()
    • Provides access to the current state of the PaginatedMenuOptions object, which inherits from MenuOptions
  • 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 IPageIconsAccess object for modification of paged icons

PaginatedMenu.Builder Additions

  • PaginatedMenu.Builder#paginationOptions(PaginatedMenuOptionsModification)
    • Intended for the interface to be fulfilled with a lambda, granting access to the PaginatedMenuOptions object for modification
  • PaginatedMenu.Builder#modifyPageIcons(Consumer<IPageIconsAccess>)
    • Intended for the interface to be fulfilled with a lambda, granting access to the IPageIconsAccess object for modification of paged icons

Added CachedConfig

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.

New KamiPlugin APIs

  • 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#registerObserver on the provided config, with the provided observer
  • KamiPlugin#onConfigLoaded(KamiConfig)
    • In v4 KamiPlugin was 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

Miscellaneous API Additions

  • ItemUtil#isSimplySimilar(ItemStack, ItemStack)
    • Util to compare two ItemStacks for basic similarity, details in the method javadoc

Config Sequence Support (⚠️ READ ONLY ⚠️)

  • 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 KamiConfig class and methods if you dare to use sequences at this time

Clone this wiki locally