Skip to content

Convert to multiplatform plugin #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Sep 9, 2024
Merged

Convert to multiplatform plugin #24

merged 20 commits into from
Sep 9, 2024

Conversation

LMBishop
Copy link
Contributor

@LMBishop LMBishop commented Aug 13, 2024

This PR:

  • abstracts the plugin to a platform-independent version
  • provides three implementations for the latest versions of Paper (Bukkit), Fabric, and Forge
  • replaces Maven with Gradle and updates the GitHub workflows

This has the ultimate goal of making it easier to port to other platforms, or backport to older Minecraft versions where necessary

@LMBishop LMBishop changed the title Draft: Convert to multiplatform plugin Convert to multiplatform plugin Aug 15, 2024
@LMBishop LMBishop marked this pull request as ready for review August 15, 2024 16:58
MattyTheHacker
MattyTheHacker previously approved these changes Aug 31, 2024
Copy link
Member

@MattyTheHacker MattyTheHacker left a comment

Choose a reason for hiding this comment

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

ah yes I have definitely reviewed this in depth and ensured it is absolutely perfect

Copy link
Member

@Thatsmusic99 Thatsmusic99 left a comment

Choose a reason for hiding this comment

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

FizzBuzz Enterprise Edition


private final BukkitCSSMinecraftPlugin plugin;

public CSSMinecraftLoader() {
Copy link
Member

Choose a reason for hiding this comment

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

Is this constructor in Bukkit/Paper ever called? My memory on plugin initialisation is quite rusty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +10 to +30
public static PermissionPluginService any() {
String[] plugins = new String[]{ "LuckPerms" };
for (String plugin : plugins) {
try {
return forPlugin(plugin);
} catch (RuntimeException ignored) { }
}
return new StubPermissionPluginService();
}

public static PermissionPluginService forPlugin(String plugin) {
try {
return switch (plugin) {
case "LuckPerms" -> checkClassAndBuild("net.luckperms.api.LuckPermsProvider", LuckPermsPermissionPluginService.class);
default -> new StubPermissionPluginService();
};
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException |
InvocationTargetException e) {
throw new RuntimeException(String.format("Permission plugin %s is not available", plugin));
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Would we rather have some kind of registration for permission services rather than hardcoding them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see the case where permission plugins will be registering themselves here. But if in the future we do have 30 different permission plugins we want to integrate with, then this factory could become abstract and a concrete version can be provided at runtime (rather than having an explicit list of supported plugins here)

@LMBishop LMBishop merged commit ac6e262 into master Sep 9, 2024
3 checks passed
@LMBishop LMBishop deleted the multiplatform-plugin branch September 9, 2024 21:25
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.

3 participants