[Solved] Error with CommandExecutor()

I have problems with CommandSpec. Server gives me an error when starts and the command doesn’t work.

This is the code (copied from wiki) and the errror.

@Subscribe
public void onInitialization(InitializationEvent e){

    CommandSpec myCommandSpec = CommandSpec.builder()
            .executor(new CommandExecutor() {
                @Override
                public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
                    Player player = args.<Player>getOne("player").get();
                    String message = args.<String>getOne("message").get();
                    player.sendMessage(Texts.of(message));
                    return CommandResult.success();
                }
            })
            .build();
    game.getCommandDispatcher().register(this, myCommandSpec, "message", "msg", "m");
}

error:

[00:23:22] [Server thread/ERROR] [FML/]: Caught exception from bewomByte
com.google.inject.ProvisionException: Unable to provision, see the following errors:

  1. Error injecting constructor, java.lang.NoSuchMethodError: org.spongepowered.api.util.command.spec.CommandSpec$Builder.description(Lorg/spongepowered/api/text/Text;)Lorg/spongepowered/api/util/command/spec/CommandSpec$Builder;
    at es.bewom.BewomByte.(BewomByte.java:24)
    while locating es.bewom.BewomByte

1 error
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025) ~[InjectorImpl$2.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051) ~[InjectorImpl.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at org.spongepowered.mod.plugin.SpongeModPluginContainer.constructMod(SpongeModPluginContainer.java:103) ~[SpongeModPluginContainer.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server-1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server-1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server-1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server-1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server-1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server-1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server-1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server-1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server-1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server-1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:493) [Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:87) [FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:355) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117) [po.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
Caused by: java.lang.NoSuchMethodError: org.spongepowered.api.util.command.spec.CommandSpec$Builder.description(Lorg/spongepowered/api/text/Text;)Lorg/spongepowered/api/util/command/spec/CommandSpec$Builder;
at es.bewom.BewomByte.(BewomByte.java:33) ~[BewomByte.class:0.0a]
at es.bewom.BewomByte$$FastClassByGuice$$e41dd2be.newInstance() ~[$ReflectUtils.class:0.0a]
at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40) ~[$FastConstructor.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61) ~[DefaultConstructionProxyFactory$1.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105) ~[ConstructorInjector.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85) ~[ConstructorInjector.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267) ~[ConstructorBindingImpl$Factory.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016) ~[InjectorImpl$2$1.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) ~[InjectorImpl.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012) ~[InjectorImpl$2.class:1.8-1371-2.1DEV-445+unknown-b445.git-unknown]
… 29 more

¿Anyone has a solution?
I NEED TO KILL SOMEONE! D=

Hi, I have the exact same problem. Does anyone have a solution to this problem?

Easy enough to understand. The API version that you’re using isn’t compatible with whatever implementation you’re using.

Go ahead and post your Forge/Sponge(Vanilla) versions here, and we’ll make sure that they’re correct.

Forge Mod Loader version 8.0.76.1371 for Minecraft 1.8

buut… the last version of sponge is 2.1-SNAPSHOT for projects…uhh, no?

I know nothing… :frowning:

That’s the Forge version, not the Sponge version. In any case that’s outdated.
The latest Sponge build is 1.8-1446-2.1DEV-508
Which is designed to run on Forge 11.14.3.1446

Mai got… WORKS!

REALLY THANKS.

Sponge is frustrating.
I miss Bukkit… :’(

Using new software can sometimes be frustrating. No need to worry, we got you covered.

the versioning scheme of sponge is also described on the docs:
https://docs.spongepowered.org/en/server/getting-started/implementations/sponge.html

{MCVersion}-{ForgeVersion}-{SpongeAPIVersion}{SpongeBuildId}

Example:

1.8-1446-2.1DEV-512

Would mean:
MC 1.8; Forge 1446 required; Sponge API Version 2.1 and Sponge Build #512

1 Like

Sponge is still Work in Progress, but I like it way better then bukkit

3 Likes

Oh thanks everyone again, WIP but with more potential than bukkit. goood! <3

1 Like