Minestom icon indicating copy to clipboard operation
Minestom copied to clipboard

Minestom unusable as module dependency

Open CryptForge opened this issue 1 year ago • 3 comments
trafficstars

The issue

When using minestom as an automatic module dependency in a java 9 module, a bunch of errors appear during compilation:

error: the unnamed module reads package net.kyori.adventure.nbt from both net.kyori.adventure.nbt and net.minestom.server

error: module net.kyori.adventure.text.serializer.plain reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module net.kyori.adventure.text.serializer.gson reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module net.kyori.adventure.text.serializer.json reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module net.kyori.adventure reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module net.kyori.adventure.nbt reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module net.kyori.adventure.key reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module net.kyori.adventure.text.logger.slf4j reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module it.unimi.dsi.fastutil reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module com.google.auto.service reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module net.kyori.adventure.text.serializer.legacy reads package net.kyori.adventure.nbt from both net.minestom.server and net.kyori.adventure.nbt

error: module net.minestom.server reads package net.kyori.adventure.nbt from both net.kyori.adventure.nbt and net.minestom.server

I think the reason for this is because of the net.kyori.adventure.nbt.TagStringIOExt class, which causes minestom to export the net.kyori.adventure.nbt package twice.

How to reproduce

CryptForge avatar Sep 11 '24 13:09 CryptForge

Can indeed reproduce; Why do you need a module-info.java? It fixed it for me when I deleted this.

mzcydev avatar Sep 11 '24 20:09 mzcydev

Can indeed reproduce; Why do you need a module-info.java? It fixed it for me when I deleted this.

There are some advenateges when using java modules. For example you can implement or extend sealed intefaces/classes outside a package of the class that is being implemented. I've used that too for a while, but most Minecraft libraries don't even support it.

Codestech1 avatar Sep 12 '24 04:09 Codestech1

I see. I didn't know that, +1 Braincell.

mzcydev avatar Sep 12 '24 08:09 mzcydev

Fixed in #2781, works with 2025.07.30-1.21.8

kermandev avatar Aug 02 '25 04:08 kermandev