Fabric API

Fabric API

106M Downloads

MinecraftServer - getWorlds NoSuchMethodError

PoloLacoste opened this issue ยท 8 comments

commented

I'm trying to create a simple mod that run on a FabricMC server. And I need to get all the worlds present, but I'm having an exception "NoSuchMethodError".

public class Main implements ModInitializer {
    @Override
    public void onInitialize() {
        ServerLifecycleEvents.SERVER_STARTED.register(server -> {
            server.getWorlds().forEach(world -> {

            });
        });
    }
}

Thanks for your help !

commented

Sorry !

I'm on a real server with Minecraft 1.16.3. Yes Fabric API is installed on the server.

Actually the exception occured on the server object when I call the function getWorlds.

I tested the mod on a dev server and it's working just fine.

commented

What JAR are you using?

commented

I'm using fabric-server-launch.jar, if it's the JAR your talking about.

commented

Will need some extra info here: is this a real server or in a dev environment, is fabric api installed on the server (since you are using an event from it), etc.

commented

No what is the name of the mod JAR, does it end with -dev?

commented

Nop it's without -dev at the end.

commented

Some more information !

I'm trying to use a jetty server in the mod (it's for a server).

I tried to build the mod as a "fatJar" and when I do a get this error.

If I build the mod normally (without the "fatJar") I get an error from Jetty, telling me java.lang.ClassNotFoundException: org.eclipse.jetty.server.Server.

commented

Closing since this is not an issue with Fabric API and lack of feedback. If you need further assistance, please join the Fabric discord https://discord.gg/v6v4pMv