Skip to content

Conversation

@osipxd
Copy link
Member

@osipxd osipxd commented Apr 22, 2025

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 has been dropped.
Java 17 is required.

@osipxd osipxd self-assigned this Apr 22, 2025
@coderabbitai
Copy link

coderabbitai bot commented Apr 22, 2025

Walkthrough

This update introduces a comprehensive modernization and refactoring of the Mimic Bukkit plugin and its build ecosystem. The Java version is raised to 17 across all build scripts, workflows, and documentation. Dependency management is overhauled with expanded and updated versions in libs.versions.toml, and the build system is streamlined for Paper API compatibility, dropping explicit Spigot support. The plugin's command system is refactored to remove direct dependencies on CommandAPI and Adventure's BukkitAudiences, instead using internal abstractions and richer Adventure text components for all user-facing messages. Serialization, registry handling, and test infrastructure are updated for consistency and maintainability, with additional enhancements to logging and configuration APIs.

Changes

Files/Paths Change Summary
.github/workflows/main.yml, .github/workflows/publish.yml Updated Java version from 16 to 17 in GitHub Actions workflows.
.run/Run Server [mimic-bukkit].run.xml Added a new Gradle run configuration for running the Bukkit server with the mimic-bukkit project.
CHANGELOG.md Documented Paper-first focus, Java 17 requirement, dropped old MC versions, clarified command requirements, and updated housekeeping for dependencies and build tools.
buildSrc/build.gradle.kts, buildSrc/src/main/kotlin/commons.gradle.kts Updated Kotlin JVM toolchain to 17, simplified compiler options, removed unused dependencies, and updated stdlib dependency.
buildSrc/settings.gradle.kts Set root project name to "buildSrc".
buildSrc/src/main/kotlin/internal/Accessors.kt Added internal extension property for accessing Gradle version catalogs.
buildSrc/src/main/kotlin/internal/libs.kt Renamed private extension function from get to lib, updated property getters, and removed unused import.
gradle/libs.versions.toml Overhauled dependency and plugin version management: added/updated versions and libraries, switched to map notation, referenced versions, and updated plugin IDs.
gradle/wrapper/gradle-wrapper.properties Updated Gradle wrapper version from 8.5 to 8.13.
gradlew, gradlew.bat Added SPDX license identifier, updated comments, improved error messaging, and minor path/logic corrections.
mimic-bukkit-api/build.gradle.kts Switched repository and dependency from Spigot to Paper API.
mimic-bukkit/api/mimic-bukkit.api Changed ItemMetaPayload to use Component for item names, updated method signatures accordingly, and removed a redundant serializer method.
mimic-bukkit/build.gradle.kts Modernized build script: restructured plugin metadata, switched to Paper API, updated dependencies, added runServer task, and improved test and shadowJar configurations.
mimic-bukkit/src/main/kotlin/MimicPlugin.kt Removed CommandAPI and BukkitAudiences usage, introduced internal MimicCommands for command management, and updated version check logic.
mimic-bukkit/src/main/kotlin/ServicesRegistrationListener.kt, impl/mimic/SafeBukkitItemsRegistry.kt Updated plugin author references from description.authors to pluginMeta.authors.
mimic-bukkit/src/main/kotlin/command/ClassSystemSubcommand.kt, command/ConfigMessage.kt, command/InventorySubcommand.kt, command/ItemsSubcommand.kt, command/LevelSystemSubcommand.kt Refactored command output to use Adventure text components for all messages, replacing plain strings and color codes.
mimic-bukkit/src/main/kotlin/command/ConfigCommand.kt Removed BukkitAudiences parameter and switched to direct sender messaging.
mimic-bukkit/src/main/kotlin/command/FallbackCommand.kt Added new internal class for fallback command with Adventure component output and clickable CommandAPI link.
mimic-bukkit/src/main/kotlin/command/MainCommand.kt Removed BukkitAudiences dependency, introduced command name/description constants, and unified message construction.
mimic-bukkit/src/main/kotlin/command/MimicCommands.kt Added new class to manage command registration/unregistration, handle fallback if CommandAPI is absent, and encapsulate related logic.
mimic-bukkit/src/main/kotlin/command/textUserInterface.kt Removed string-based send functions, added successText, errorText, and appendStats for Adventure text component-based output.
mimic-bukkit/src/main/kotlin/impl/vanilla/ItemMetaPayload.kt Changed name and lore properties to use Component types, updated docs, and serialization annotations.
mimic-bukkit/src/main/kotlin/impl/vanilla/MinecraftItemsRegistry.kt Updated to use Material.entries(), removed colorization, and applied display name/lore via direct setters.
mimic-bukkit/src/main/kotlin/internal/Colors.kt Suppressed deprecation warnings and removed colorized extension functions.
mimic-bukkit/src/main/kotlin/internal/Compat.kt Changed error handling in callCompat from NoSuchMethodError to IncompatibleClassChangeError.
mimic-bukkit/src/main/kotlin/internal/Configuration.kt Updated setHeader to non-nullable vararg, added setComments extension for configuration comments.
mimic-bukkit/src/main/kotlin/internal/Log.kt Replaced direct Logger usage with a SimpleLogger interface, refactored logging calls, and added logger initialization methods.
mimic-bukkit/src/main/kotlin/internal/Serializers.kt Updated descriptors for serializers, switched to registry-based enchantment lookup, and added a new serializer for MiniMessage Component.
mimic-bukkit/src/main/kotlin/internal/TextComponent.kt Renamed buildTextComponent to text, updated line appending to use Component.newline().
mimic-bukkit/src/main/kotlin/items/WrappedItemsRegistry.kt Made delegate property internal, added unwrap() extension for accessing underlying registry.
mimic-bukkit/src/main/resources/plugin.yml Removed loadbefore directive for plugin load order.
mimic-bukkit/src/test/kotlin/BukkitTestBase.kt Centralized and enhanced server mocking, improved plugin meta mocking, replaced static mocking, and initialized logging in tests.
mimic-bukkit/src/test/kotlin/impl/mimic/MimicItemsRegistryTest.kt Replaced Minecraft registry with a custom test registry, updated test data and assertions for new namespace.
mimic-bukkit/src/test/kotlin/impl/vanilla/ItemMetaPayloadTest.kt Updated test data to use Component.text for name and lore fields.
mimic-bukkit/src/test/kotlin/impl/vanilla/MinecraftItemsRegistryTest.kt Deleted test class for the old Minecraft items registry.

Sequence Diagram(s)

sequenceDiagram
    participant Server
    participant MimicPlugin
    participant MimicCommands
    participant CommandAPI
    participant FallbackCommand

    Server->>MimicPlugin: onEnable()
    MimicPlugin->>MimicCommands: register(plugin, mimic, config)
    MimicCommands->>Server: Check if CommandAPI plugin is present and enabled
    alt CommandAPI present and enabled
        MimicCommands->>CommandAPI: Register Mimic command
    else CommandAPI missing or disabled
        MimicCommands->>Server: Register fallback command
        Server->>FallbackCommand: Execute fallback command
        FallbackCommand->>User: Send message with clickable CommandAPI link
    end
Loading

Poem

🐇
Java seventeen, a hop ahead,
Paper-first, old Spigot shed.
Commands now sparkle, rich and bright,
Adventure text—what a delight!
No more color codes to chase,
Just Components in their place.
With every build, we leap anew—
Mimic’s future: strong and true!

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
mimic-bukkit/src/main/kotlin/internal/Configuration.kt (1)

15-17: Consider making parameters non-nullable for consistency

While the simplification to directly call the built-in method is good, there's an inconsistency between setHeader (which uses non-nullable String parameters) and setComments (which still uses nullable String? parameters). Consider making the comments parameter non-nullable for consistency unless there's a specific reason to allow null values.

-internal fun Configuration.setComments(path: String, vararg comments: String?) {
+internal fun Configuration.setComments(path: String, vararg comments: String) {
    setComments(path, comments.asList())
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a7bee2 and 9bd6f14.

📒 Files selected for processing (4)
  • mimic-bukkit/src/main/kotlin/impl/vanilla/MinecraftItemsRegistry.kt (2 hunks)
  • mimic-bukkit/src/main/kotlin/internal/Compat.kt (2 hunks)
  • mimic-bukkit/src/main/kotlin/internal/Configuration.kt (2 hunks)
  • mimic-bukkit/src/main/kotlin/internal/NamespacedKey.kt (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • mimic-bukkit/src/main/kotlin/internal/NamespacedKey.kt
🚧 Files skipped from review as they are similar to previous changes (2)
  • mimic-bukkit/src/main/kotlin/impl/vanilla/MinecraftItemsRegistry.kt
  • mimic-bukkit/src/main/kotlin/internal/Compat.kt
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Check
🔇 Additional comments (1)
mimic-bukkit/src/main/kotlin/internal/Configuration.kt (1)

6-8: Great improvement in type safety!

Changing the parameter type from nullable to non-nullable String improves type safety and aligns with modern Kotlin best practices. The simplification by directly calling the built-in method also makes the code cleaner and more maintainable.

@osipxd osipxd merged commit 63d0bc1 into develop Apr 23, 2025
4 checks passed
@osipxd osipxd deleted the update-dependencies branch April 23, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants