Skip to content

Mimic v0.9.0

Choose a tag to compare

@github-actions github-actions released this 12 Nov 00:58
· 53 commits to develop since this release
e561610

Paper-first

Keeping the plugin compatible both with Paper and Spigot consumes a lot of time.
Now, Mimic is Paper-first as it is the most popular platform.
This means that compatibility with Spigot is not guaranteed.

To reduce the maintenance burden, support for versions older than 1.20.6 has been dropped.
Java 21 is required.

BlockRegistry API

This version introduces new experimental BlockRegistry API.
It can be used to get IDs of placed blocks and block items, get items placing blocks, set blocks, and break blocks passing drops to a custom consumer.
Block IDs from all registries are available via Mimic.getBlockRegistry(), namespaced with the registry ID.
Block IDs are resource locations: minecraft:stone, craftengine:default/palm_log.
ID without namespace or with the reserved mimic namespace is searched over all registries in order of priority.

// Register a block registry
Mimic.getInstance().registerBlockRegistry(new MyBlockRegistry(), MimicApiLevel.CURRENT, plugin, ServicePriority.Normal);

// Set a block
BukkitBlockRegistry blockRegistry = Mimic.getInstance().getBlockRegistry();
blockRegistry.setBlock(location.getBlock(), "minecraft:stone_stairs", "[facing=north]");

// Break a block with a pickaxe, collecting drops into a chest inventory
blockRegistry.breakBlock(block, pickaxe, drops -> chestInventory.addItem(drops.toArray(new ItemStack[0])).values());

Added commands to debug block registries:

  • /mimic blocks info - show information about block registries
  • /mimic blocks give [target] [block] (amount) - give the item placing the given block
  • /mimic blocks set [location] [block] (payload) - set block at the given location, replacing the existing one
  • /mimic blocks break (location) - break block at the given location, or the targeted block, with the item in hand
  • /mimic blocks compare (block) - compare targeted block with the given block, or with the block placed by item in hand
  • /mimic blocks find [block] - check that block with the given ID exists

Improved commands

Now it is possible to change Mimic config using commands in two ways:

  1. Using interactive config /mimic config.
    Every option in the output is interactive, so you can change it just by mouse click.
  2. Change options by commands:
    • /mimic config level-system [value] - set the specified level system as preferred for Mimic
    • /mimic config class-system [value] - set the specified class system as preferred for Mimic
    • /mimic config inventory-provider [value] - set the specified inventory provider as preferred for Mimic
    • /mimic config disabled-items-registries add [item-registry] - disable the specified item registry for Mimic
    • /mimic config disabled-items-registries remove [item-registry] - enable the specified item registry for Mimic
    • /mimic config disabled-block-registries add [block-registry] - disable the specified block registry for Mimic
    • /mimic config disabled-block-registries remove [block-registry] - enable the specified block registry for Mimic
    • /mimic config reset [option] - reset the specified option to its default value

Commands are now easier to use in general:

  • /mimic info replaced with /mimic
  • /mimic class has replaced with /mimic class check with simpler syntax
  • /mimic xp info [player] and /mimic class check [player] send the result to the command sender instead of the target player.
  • /mimic items give has the same arguments order as vanilla /give: /mimic items give [target] [item] (amount) (payload).
  • /mimic xp set|give|take replaced with a single value: /mimic xp [value] (player)
    Value is [+|-]<amount>[L|P|T]: + gives, - takes, no sign sets; L is levels, P is points (default), T is total exp.
    For example, /mimic xp +5L gives five levels and /mimic xp 100 sets 100 exp points.
  • /mimic xp has removed, use /mimic xp info instead
  • /mimic items id removed, /mimic items shows ID of the item in hand.
  • Aliases /mimic experience and /mimic inv removed, use /mimic xp and /mimic inventory instead.
  • Subcommand info is optional: /mimic items, /mimic blocks, /mimic xp, /mimic inventory and /mimic class show info.
    Info output lists available subcommands, click to use them, hover to see usage.
  • Clearer command output: colored answers, errors for failed actions, click-to-copy IDs.
  • Item and block IDs are completed step by step: namespace first (craftengine:), then folder (craftengine:default/), then ID.

Item and block IDs format

Item and block IDs now share one format (#66): a resource location with the registry ID as namespace,
like minecraft:acacia_boat or craftengine:default/palm_log.

  • Invalid IDs are rejected without querying registries.
    Invalid IDs returned by registries are ignored with a warning, for example IDs with uppercase letters, including the registry ID.
  • Items: the mimic namespace searches over all registries, like IDs without namespace.
  • Registries map plugin IDs to Mimic IDs themselves: itemsadder:ruby_sword → itemsadder/ruby_sword.
  • Deprecated: item IDs with uppercase letters (minecraft:DIAMOND_SWORD) are lowercased,
    and IDs with more than one : (ia:itemsadder:ruby_sword) are passed as is. Both log a warning.

API changes

  • Added tag @since 0.8.0 to all APIs added in 0.8.0
  • Make BukkitPlayerInventory.collectEquippedItems protected. It was public by an accident.
  • Fixed BukkitPlayerInventory.collectStoredItems excluding the first stack equal to the item in the main hand instead of the held slot itself.
  • Default implementation of ClassSystem.hasAnyClass() changed.
    Now it checks if getClasses() returns a non-empty list instead of checking getPrimaryClass() != null.

Plugin changes

  • Added CraftEngine integration: items registry and block registry (#52).
    CraftEngine IDs namespace:path become craftengine:namespace/path, for example craftengine:default/palm_log.

  • minecraft items registry accepts item components as a payload in the format of the /give command:
    /mimic items give Steve minecraft:diamond_sword 1 [damage=10,unbreakable={}].
    The HOCON payload (ItemMetaPayload) is still supported as an alternative, with MiniMessage formatting for name and lore.

  • MMOCore integration requires MMOCore 1.13 or newer

  • Class system permissions takes into account only explicitly set mimic.class.* permissions.
    Previously, operators had all classes.

  • Implementations are stored in Mimic instead of Bukkit's ServicesManager (#70).
    Each ID now belongs to a single implementation:

    • An implementation registered by another plugin replaces the Mimic built-in integration with the same ID.
    • If two plugins register the same ID, the one with higher priority is used.
      On equal priorities, the first registered is used.
    • If a plugin registers the same ID again, the new implementation replaces the previous one.
    • IDs of default implementations (mimic, minecraft, permissions) are reserved.
    • Default implementations are always used last, regardless of priority.
      So a custom block registry registered with Lowest priority still recognizes its blocks before the vanilla registry.

    Implementations with different IDs and equal priority are ordered by registration: the first registered is used by default.
    Previously, the implementation with the lowest priority was selected by ID, and the order of equal priorities was undefined.

  • mimic is not listed in Mimic.getAllItemsRegistries() and Mimic.getAllBlockRegistries() anymore,
    and is not an option of disabled-items-registries and disabled-block-registries in config.

  • Breaking change! Implementations can't be loaded from ServicesManager anymore, use Mimic.getInstance() instead.
    Implementations registered directly in ServicesManager are still moved to Mimic.

  • Breaking change! MimicItemsRegistry constructor is internal now, use Mimic.getItemsRegistry() instead.

Housekeeping

  • Update required Java 1.8 → 21
  • Update Kotlin 1.6.20 → 2.4.21, preserving API and Language level 2.2
  • Replace ACF with Paper's Brigadier command API
  • Update Gradle 7.4.2 → 9.8.2
  • Update dependencies
  • Migrate to version catalogs
  • Publish to Maven Central via Central Portal