Skip to content
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

Merged
merged 7 commits into from
Jun 3, 2024
Merged

add 1.20.5 support #112

merged 7 commits into from
Jun 3, 2024

Conversation

iGabyTM
Copy link
Collaborator

@iGabyTM iGabyTM commented Apr 28, 2024

NOT TESTED

  • changes how the MC version is detected
  • uses a different ComponentSerializer on 1.20.5+ for the item and lore of the item

Paper post https://forums.papermc.io/threads/important-dev-psa-future-removal-of-cb-package-relocation.1106/

@iGabyTM iGabyTM added the enhancement New feature or request label Apr 28, 2024
@iGabyTM iGabyTM requested review from LichtHund and Kqliber April 28, 2024 12:00
@Euphillya
Copy link
Contributor

Why revert Folia ?!

Comment on lines 442 to 450
if (VersionHelper.IS_FOLIA) {
player.getScheduler().runDelayed(plugin, task -> {
this.runCloseAction = runCloseAction;
player.closeInventory();
this.runCloseAction = true;
}, null, 2L);
return;
}

Copy link
Contributor

@Euphillya Euphillya May 20, 2024

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();
}

@LichtHund
Copy link
Member

LichtHund commented May 20, 2024

Why revert Folia ?!

Because it requires the project to be higher Java version than intended, it needs to stay on Java 8.
I was intending on doing it in a different way, the suggestion you gave is great. Ty!

@Euphillya
Copy link
Contributor

Why revert Folia ?!

Because it requires the project to be higher Java version than intended, it needs to stay on Java 8. I was intending on doing it in a different way, the suggestion you gave is great. Ty!

Alright I understand. So reflection is the best solution.

@LichtHund LichtHund merged commit b2ecc7b into master Jun 3, 2024
@Azoraqua
Copy link

Azoraqua commented Jun 4, 2024

Why revert Folia ?!

Because it requires the project to be higher Java version than intended, it needs to stay on Java 8.

I was intending on doing it in a different way, the suggestion you gave is great. Ty!

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?

@LichtHund
Copy link
Member

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.

@LichtHund LichtHund deleted the feature/1_20_5-support branch December 8, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants