Skip to content

feat(loader): add support for Purpur, Folia and more#97

Closed
KinglyShade wants to merge 10 commits intopelican-dev:mainfrom
KinglyShade:feat/add-extended-loaders
Closed

feat(loader): add support for Purpur, Folia and more#97
KinglyShade wants to merge 10 commits intopelican-dev:mainfrom
KinglyShade:feat/add-extended-loaders

Conversation

@KinglyShade
Copy link

@KinglyShade KinglyShade commented Feb 4, 2026

This PR expands the MinecraftLoader enum to support additional popular server forks and proxies. This allows the Minecraft Modrinth plugin to correctly identify the server type and filter compatible plugins/mods from Modrinth more accurately.
Changes

Added new loaders: Purpur, Folia, Pufferfish, Spigot, Bukkit, and Waterfall.

Refactored fromTags method: Replaced nested if statements with a more efficient match(true) structure (PHP 8.x).

Improved tag detection: Added support for common tag variations like papermc, spigotmc, and neoforged.

Summary by CodeRabbit

  • New Features

    • Expanded server loader detection to include Purpur, Folia, Pufferfish, Paper (PaperMC), Spigot (SpigotMC), Bukkit, Velocity, Waterfall, and BungeeCord.
    • Improved alias mapping for more accurate identification of a wider range of Minecraft server setups, reducing misclassification and increasing compatibility.
  • Bug Fixes / Improvements

    • Cleaner handling when no matching loader is found.
    • Improved display labels for detected loaders (consistent title-casing).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Warning

Rate limit exceeded

@KinglyShade has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 28 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 98a888f and 5a46b92.

📒 Files selected for processing (1)
  • minecraft-modrinth/src/Enums/MinecraftLoader.php
📝 Walkthrough

Walkthrough

Refactored MinecraftLoader enum: added cases (Purpur, Folia, Pufferfish, Spigot, Bukkit, Waterfall), replaced nested conditionals in fromTags with a match expression and an early guard, adjusted fromServer/fromTags return types to ?self, and switched getLabel() to use Str::title($this->name).

Changes

Cohort / File(s) Summary
Minecraft Loader Enum
minecraft-modrinth/src/Enums/MinecraftLoader.php
Added enum cases (Purpur, Folia, Pufferfish, Spigot, Bukkit, Waterfall). Replaced nested tag logic in fromTags(array $tags): ?self with a match-based mapping and early null guard for missing minecraft tag. Updated fromServer(Server $server): ?self return type to ?self. Switched getLabel() to Str::title($this->name). Added docblock for fromTags param and normalized mappings (Paper/Papermc, Spigot/SpigotMC, Bungee/bungee alias, Velocity, Waterfall, NeoForge/Forge/Fabric/Quilt retained).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through tags with nimble feet and flair,
Match branches folded tidy in the air,
Purpur, Folia, Spigot took their place,
Pufferfish and Waterfall joined the race,
A rabbit's patch of enums—clean and fair.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(loader): add support for Purpur, Folia and more' directly reflects the main change: expanding MinecraftLoader enum with new server fork/proxy support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@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: 1

🤖 Fix all issues with AI agents
In `@minecraft-modrinth/src/Enums/MinecraftLoader.php`:
- Around line 38-58: Pint is flagging a missing blank line before the
return/match statement in the MinecraftLoader enum; add a single blank line
immediately before the "return match (true) {" statement (i.e., ensure there's
an empty line between the preceding if-block and the return match) or simply run
PHP Pint's auto-fix to apply the "blank_line_before_statement" rule, then re-run
tests; target the return match in the method that checks in_array('minecraft',
$tags) inside the MinecraftLoader enum.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb55b45 and 29f3783.

📒 Files selected for processing (1)
  • minecraft-modrinth/src/Enums/MinecraftLoader.php
🧰 Additional context used
🪛 GitHub Actions: Lint
minecraft-modrinth/src/Enums/MinecraftLoader.php

[error] 1-1: Pint: style issue 'blank_line_before_statem…'. Fix style issue detected by 'vendor/bin/pint --test'.

🔇 Additional comments (1)
minecraft-modrinth/src/Enums/MinecraftLoader.php (1)

15-22: Nice coverage for additional loaders.

Enum expansion cleanly matches the PR objective and keeps the type surface area consistent.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Removed enum cases and the getLabel method from MinecraftLoader.
Copy link
Contributor

@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: 1

🤖 Fix all issues with AI agents
In `@minecraft-modrinth/src/Enums/MinecraftLoader.php`:
- Around line 17-38: The file references enum MinecraftLoader and its cases
(NeoForge, Forge, Fabric, Quilt, Folia, Purpur, Pufferfish, Paper, Spigot,
Bukkit, Velocity, Waterfall, Bungeecord) in the match expression but the enum
declaration was removed; restore a backed enum MinecraftLoader with those named
cases (match the pattern used in ModrinthProjectType.php), ensuring the enum
name is MinecraftLoader and include all listed cases so the static method(s)
that return self::CaseName compile and run without fatal errors.
🧹 Nitpick comments (1)
minecraft-modrinth/src/Enums/MinecraftLoader.php (1)

16-35: Consider using English for comments and strict in_array comparison.

Two minor suggestions:

  1. Comments in Spanish (lines 16, 24, 32): If the codebase convention is English, consider translating for consistency.
  2. Strict comparison: Using in_array($tag, $tags, true) ensures type-safe matching.
♻️ Optional: English comments and strict comparison
-        // Mapeo de Tags a Enums
+        // Map tags to enum cases
         return match (true) {
             // Mods
-            in_array('neoforge', $tags) || in_array('neoforged', $tags) => self::NeoForge,
-            in_array('forge', $tags) => self::Forge,
-            in_array('fabric', $tags) => self::Fabric,
-            in_array('quilt', $tags) => self::Quilt,
+            in_array('neoforge', $tags, true) || in_array('neoforged', $tags, true) => self::NeoForge,
+            in_array('forge', $tags, true) => self::Forge,
+            in_array('fabric', $tags, true) => self::Fabric,
+            in_array('quilt', $tags, true) => self::Quilt,

-            // Plugins (Forks de Paper/Spigot)
-            in_array('folia', $tags) => self::Folia,
+            // Plugins (Paper/Spigot forks)
+            in_array('folia', $tags, true) => self::Folia,
             // ... apply similar changes to remaining in_array calls
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 29f3783 and 818283f.

📒 Files selected for processing (1)
  • minecraft-modrinth/src/Enums/MinecraftLoader.php
🔇 Additional comments (2)
minecraft-modrinth/src/Enums/MinecraftLoader.php (2)

1-7: LGTM!

The fromServer method correctly lazy-loads the egg relationship and delegates tag resolution to fromTags.


12-14: Good early guard for the 'minecraft' tag.

The early return improves readability and prevents unnecessary match evaluation for non-Minecraft servers.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copy link
Contributor

@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: 1

🤖 Fix all issues with AI agents
In `@minecraft-modrinth/src/Enums/MinecraftLoader.php`:
- Around line 34-35: The PHPDoc for the local variable $tags in MinecraftLoader
(the comment "/** `@var`  string[]  $tags */") has extra spaces and fails Pint's
phpdoc_single_line_var_spacing rule; update the annotation to use single spaces
so it reads "/** `@var` string[] $tags */" (i.e., one space after `@var`, no extra
spaces before/after the type/name) to satisfy the linter.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 818283f and 98a888f.

📒 Files selected for processing (1)
  • minecraft-modrinth/src/Enums/MinecraftLoader.php
🧰 Additional context used
🧬 Code graph analysis (1)
minecraft-modrinth/src/Enums/MinecraftLoader.php (2)
minecraft-modrinth/src/Enums/ModrinthProjectType.php (1)
  • fromServer (29-45)
billing/src/Models/Product.php (1)
  • egg (89-92)
🪛 GitHub Actions: Lint
minecraft-modrinth/src/Enums/MinecraftLoader.php

[error] 1-1: Pint style check failed. 1 style issue detected (phpdoc_single_line_var_s…). Fix the PHPDoc for a single-line var annotation in this file. Command: 'vendor/bin/pint --test'.

🔇 Additional comments (2)
minecraft-modrinth/src/Enums/MinecraftLoader.php (2)

9-23: LGTM!

The expanded enum cases correctly cover the Minecraft server fork hierarchy (Bukkit → Spigot → Paper → Pufferfish/Purpur/Folia) and proxy variants. The string-backed values follow consistent lowercase convention.


43-67: LGTM!

The match(true) refactor improves readability. The ordering correctly prioritizes specific forks over their parents (e.g., Folia/Purpur/Pufferfish before Paper), ensuring the most specific loader is returned when multiple related tags exist. The tag aliases (neoforged, papermc, spigotmc, bungee) are a good addition for compatibility.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@Boy132
Copy link
Member

Boy132 commented Feb 5, 2026

Thanks but those extra loaders aren't needed, they are basically just aliases for other loaders. Adding them as separate thing only makes the whole construct more complicated for no reason.

@Boy132 Boy132 closed this Feb 5, 2026
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