-
Notifications
You must be signed in to change notification settings - Fork 62
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
add 1.20.5 support #112
add 1.20.5 support #112
Conversation
This reverts commit afac41d.
Why revert Folia ?! |
if (VersionHelper.IS_FOLIA) { | ||
player.getScheduler().runDelayed(plugin, task -> { | ||
this.runCloseAction = runCloseAction; | ||
player.closeInventory(); | ||
this.runCloseAction = true; | ||
}, null, 2L); | ||
return; | ||
} | ||
|
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.
Can be replaced by a reflection:
try {
Class<?> playerClass = player.getClass();
Method getSchedulerMethod = playerClass.getMethod("getScheduler");
Object scheduler = getSchedulerMethod.invoke(player);
Class<?> schedulerClass = scheduler.getClass();
Method executeMethod = schedulerClass.getMethod("execute", Plugin.class, Runnable.class, Runnable.class, long.class);
Runnable task = () -> {
this.runCloseAction = runCloseAction;
player.closeInventory();
this.runCloseAction = true;
};
executeMethod.invoke(scheduler, plugin, task, null, 2L);
} catch (Exception e) {
e.printStackTrace();
}
Because it requires the project to be higher Java version than intended, it needs to stay on Java 8. |
Alright I understand. So reflection is the best solution. |
May I ask what the reason as to why it must stay on Java 8 despite most platforms, including Minecraft itself running on Java 17 by now? |
Because the library supports all the down to Spigot 1.8.8, there are a lot of legacy plugins depending on it and a sudden Java version change would not go well with them. This will change with v4 which will fully drop legacy support. |
NOT TESTED
Paper post https://forums.papermc.io/threads/important-dev-psa-future-removal-of-cb-package-relocation.1106/