-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
There was a problem hiding this 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
There was a problem hiding this 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() { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common/src/main/java/com/cssbham/cssminecraft/common/config/source/YamlConfigSource.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/cssbham/cssminecraft/common/discord/client/JDADiscordClient.java
Outdated
Show resolved
Hide resolved
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)); | ||
} | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
This PR:
This has the ultimate goal of making it easier to port to other platforms, or backport to older Minecraft versions where necessary