JorelAli / CommandAPI

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13

Home Page:https://commandapi.jorel.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mojang-mapped server support

GliczDev opened this issue · comments

Description

I think supporting mojang-mapped servers would be a useful feature, because it's much faster to compile and/or test plugins without remapping and Paper is slowly moving to provide a mojang-mapped jar by default.

Expected code

No response

Extra details

No response

The current "internal implementation" of this uses Maven's artifact classifiers to differentiate between mapped and mojang-mapped NMS artifacts.

To implement this for a public release, the CommandAPI needs three new targets:

  • commandapi-bukkit-shade with a mojang-mapped classifier
  • commandapi-bukkit-core with a mojang mapped classifier
  • commandapi-bukkit-plugin with a mojang-mapped classifier

The CommandAPI uses mojang-mappings internally and remaps them (supposedly?) in accordance to the Mojang EULA. As stated by this Spigot post:

When choosing to use the 'Mojang Mappings', it is absolutely imperative that you are aware of the conditions attached to them as well as the Mojang EULA. These are not restrictions you can simply ignore. In particular you may only 'use the mappings for development purposes'. This means that you must only use the remapped-mojang jar for development and must remap your plugin prior to distribution. For those not using Maven you can download SpecialSource to help you do this here, and we encourage the creation of instructions/tools for other build systems.

If the CommandAPI wants to support Mojang-mapped servers, we'll have to release a specific Mojang-mapped variant of the CommandAPI (e.g. a CommandAPI-X.X.X-mojmap.jar for the plugin variant, or a classifier for development purposes). This currently treads on a bit of a grey area legally and at the time of writing, more investigation would have to be done before we can commit to this.

Any updates on that?

Any updates on that?

Nope. I should be able to draft up a prototype of this this week.

Implemented draft of this feature on dev/dev. A test version of the CommandAPI standalone plugin can be found here: CommandAPI-9.4.0-SNAPSHOT_11_Dec_2023_(03-16-09pm).zip

To implement this for shading, the CommandAPI has to expose its internal mojang mapping flag to the CommandAPI config, allowing users to specify this at runtime. This could look something like:

@Override
public void onLoad() {
    CommandAPI.onLoad(new CommandAPIBukkitConfig(this).withMojangMappings(true)); // Load with Mojang Mappings
    
    // Register commands here
}

This feature needs documentation for the CommandAPI config for shading.

Implemented in version 9.4.0.