Skip to content

Support for 26.1#400

Open
Almighty-Satan wants to merge 9 commits intoCryptoMorin:masterfrom
Almighty-Satan:feat/support-26.1
Open

Support for 26.1#400
Almighty-Satan wants to merge 9 commits intoCryptoMorin:masterfrom
Almighty-Satan:feat/support-26.1

Conversation

@Almighty-Satan
Copy link
Copy Markdown
Contributor

@Almighty-Satan Almighty-Satan commented Mar 27, 2026

This adds the new materials, sounds and particles as well as support for Minecrafts new versioning system (XMaterial would previously throw an IllegalArgumentException in the class initializer)

Some stuff is probably still missing but this at least gets my plugin to initialize.

Issue: #399

If you are someone who can't wait for official updates and needs this right now, you can temporarily use this: https://central.sonatype.com/artifact/io.github.almighty-satan/XSeries (also includes the fixes from #403 and #404)

<dependency>
    <groupId>io.github.almighty-satan</groupId>
    <artifactId>XSeries</artifactId>
    <version>13.6.0+26.1</version>
</dependency>

@LeeGodSRC LeeGodSRC mentioned this pull request Mar 28, 2026
3 tasks
} else {
String version = Bukkit.getVersion();
Matcher matcher = Pattern.compile("MC: \\d\\.(\\d+)").matcher(version);
Matcher matcher = Pattern.compile("MC: (\\d+)\\.(\\d+)").matcher(version);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it not be far simpler to just modify this expression a bit? For example:

Matcher matcher = Pattern.compile("MC: (?:1\\.)?(\\d+)").matcher(version);

Test it here: https://regex101.com/r/5tSuU8/1

This way, none of the existing uses of supports need to change, and new ones can simply use supports(26) without considering the way version numbers are written.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that would be enough to check for version 26.1, but afaik the next big release is supposed to be 26.2. With your proposal there would be no way to differentiate between 26.1 and 26.2.

Copy link
Copy Markdown

@kenshineto kenshineto Mar 28, 2026

Choose a reason for hiding this comment

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

What I would recommend is to not try to parse each digit, but to instead parse out the entire version string, and turn it into a list of ints. Finally if the first int is a 1, remove it.

This is what I do for my plugin, (note this is in kotlin)

        mcVersion =
            Regex("""MC:\s*([\d.]+)""")
                .find(plugin.server.version)
                ?.groupValues
                ?.get(1)
                ?.split('.')
                ?.asSequence()
                ?.mapNotNull { it.toUIntOrNull() }
                ?.let { seq -> if (seq.firstOrNull() == 1u) seq.drop(1) else seq }
                ?.toList() ?: emptyList()

Then make the supports function be varadic over integers. Since 26 is greater than 21 (from 1.21), this works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, that would be enough to check for version 26.1, but afaik the next big release is supposed to be 26.2. With your proposal there would be no way to differentiate between 26.1 and 26.2.

Sure, but it doesn't look like you've used supports(26, 1) here yet, so who knows if there will be a need to distinguish them. 1.21.9 had a pretty significant number of internal changes iirc, but they don't need to be distinguished here except in documentation.

Even if 26.2 does end up needing to be distinguished in code, I would still advocate for dropping the 1. prefix here as it contains no real meaning, and simply matching on the other two numbers if required, e.g.:

Matcher matcher = Pattern.compile("MC: (?:1\\.)?(\\d+)(?:\\.(\\d+))?").matcher(version);
if (matcher.find()) {
    VERSION_MAJOR = Integer.parseInt(matcher.group(1));
    VERSION_MINOR = matcher.group(2) == null ? 0 : Integer.parseInt(matcher.group(2));
}

Test: https://regex101.com/r/5tSuU8/2

What I would recommend is to not try to parse each digit, but to instead parse out the entire version string, and turn it into a list of ints. Finally if the first int is a 1, remove it.

Sure, that would work as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, but it doesn't look like you've used supports(26, 1) here yet, so who knows if there will be a need to distinguish them

While it might not be needed for 26.1 or maybe even 26.2, as this will be the new versioning system going forward I would assume that it would be required at some point.

Both of you make some good points, but I'll wait for feedback from the maintainer before making changes.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 1, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@MrEAlderson
Copy link
Copy Markdown

Thank you for your work! Am hosting it on my maven repo all while waiting for it to get merged.

<repository>
   <id>marcely-repo</id>
   <url>https://repo.marcely.de/repository/maven-public/</url>
</repository>
<dependency>
  <groupId>com.github.cryptomorin</groupId>
  <artifactId>XSeries-Fork</artifactId>
  <version>13.6.0</version>
</dependency>

@Almighty-Satan
Copy link
Copy Markdown
Contributor Author

I have published a build that contains the changes from this PR as well as the fixes from #403 and #404 to maven central. Still hoping to get this merged tho

See https://central.sonatype.com/artifact/io.github.almighty-satan/XSeries

<dependency>
    <groupId>io.github.almighty-satan</groupId>
    <artifactId>XSeries</artifactId>
    <version>13.6.0+26.1</version>
</dependency>

Source can be viewed here: https://github.com/Almighty-Satan/XSeries/releases/tag/v13.6.0%2B26.1

@ImYenil
Copy link
Copy Markdown

ImYenil commented Apr 9, 2026

I have published a build that contains the changes from this PR as well as the fixes from #403 and #404 to maven central. Still hoping to get this merged tho

See https://central.sonatype.com/artifact/io.github.almighty-satan/XSeries

<dependency>
    <groupId>io.github.almighty-satan</groupId>
    <artifactId>XSeries</artifactId>
    <version>13.6.0+26.1</version>
</dependency>

Source can be viewed here: https://github.com/Almighty-Satan/XSeries/releases/tag/v13.6.0%2B26.1

[21:59:53 ERROR]: Error occurred while enabling ItemRecycler v1.5.3 (Is it up to date?)
java.lang.NoSuchFieldError: OAK_PLANKS
at com.duplxey.itemrecycler.recycler.Recycler.load(Recycler.java:48) ~[?:?]
at com.duplxey.itemrecycler.ItemRecycler.onEnable(ItemRecycler.java:67) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:769) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.Bukkit.reload(Bukkit.java:556) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:629) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:416) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:379) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [patched_1.8.8.jar:git-PaperSpigot-445]
at java.lang.Thread.run(Thread.java:834) [?:?]

    if (XReflection.supports(1, 13)) {
        planks.add(Material.OAK_PLANKS);
        planks.add(Material.JUNGLE_PLANKS);
        planks.add(Material.SPRUCE_PLANKS);
        planks.add(Material.BIRCH_PLANKS);
        planks.add(Material.DARK_OAK_PLANKS);
        planks.add(Material.ACACIA_PLANKS);

@Almighty-Satan
Copy link
Copy Markdown
Contributor Author

Almighty-Satan commented Apr 9, 2026

@ImYenil Your version check is wrong. XReflection.supports(1, 13) checks if the minor version is 1 and the patch is 13, so you are checking for x.1.13, which obviously returns true on 1.8.8. You should be using XReflection.supports(1, 13, 0).

I left the existing XReflection#supports methods as-is to avoid breaking compatibility with plugins that rely on them, but XReflection#supports(int) and XReflection#supports(int, int) should probably be removed or at the very least be deprecated. I'd like to get some feedback from the maintainer on that.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 9, 2026

@ImYenil
Copy link
Copy Markdown

ImYenil commented Apr 10, 2026

Your version check is wrong. XReflection.supports(1, 13) checks if the minor version is 1 and the patch is 13, so you are checking for x.1.13, which obviously returns true on 1.8.8. You should be using XReflection.supports(1, 13, 0).

Thanks

@Splitrox
Copy link
Copy Markdown

Hey guys, everything is to good to get this merged or?

@gaboss44
Copy link
Copy Markdown

😶‍🌫️

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.

7 participants