check envtype before registering client comamnds

This commit is contained in:
creeper123123321 2021-04-13 19:30:42 -03:00 committed by creeper123123321
parent bd7274d345
commit f720b205be

View File

@ -14,6 +14,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import io.netty.channel.DefaultEventLoop;
import io.netty.channel.EventLoop;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
@ -100,7 +101,9 @@ public class ViaFabric implements ModInitializer {
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("viaversion")));
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("viaver")));
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("vvfabric")));
ClientCommandManager.DISPATCHER.register(command("viafabricclient"));
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
ClientCommandManager.DISPATCHER.register(command("viafabricclient"));
}
}
@SuppressWarnings("deprecation")