[Solved] AbstractMethodError when calling commands?

I recently updated to sponge-1.8-1487-2.1DEV-525. It appears whenever one of my classes that implements CommandCallable is called (when commands are called), an AbstractMethodError occurs. I see the version of the api I should be using in the sponge version set is 2.1, and I have confirmed this is what is in my Maven Dependencies. Does this mean that CommandCallable should no longer be used? If so, should I convert everything to CommandExecutor? Or what? Also, where is a good place to find the latest javadoc? I can only find the 2.0 javadoc. Thanks!

Here’s the specific error I’m getting:

[15:33:36] [Server thread/ERROR] [Sponge]: Error occurred while executing command ‘set hi’ for source EntityPlayerMP[‘soccer66’/44, l=‘world’, x=1025.98, y=100.20, z=767.38]: null
java.lang.AbstractMethodError
at org.spongepowered.api.util.command.dispatcher.SimpleDispatcher.process(SimpleDispatcher.java:344) ~[SimpleDispatcher.class:1.8-1487-2.1DEV-525+unknown-b525.git-unknown]
at org.spongepowered.api.service.command.SimpleCommandService.process(SimpleCommandService.java:243) [SimpleCommandService.class:1.8-1487-2.1DEV-525+unknown-b525.git-unknown]
at net.minecraft.command.ServerCommandManager.func_71556_a(SourceFile:80) [cl.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:812) [rj.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:791) [rj.class:?]
at net.minecraft.network.play.client.C01PacketChatMessage.func_180757_a(SourceFile:37) [lu.class:?]
at net.minecraft.network.play.client.C01PacketChatMessage.func_148833_a(SourceFile:9) [lu.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [ih.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_05]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_05]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) [FMLCommonHandler.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:656) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:364) [po.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:598) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_05]

Could you show the code for this command?

EDIT: You may want to refresh your maven dependencies. I did this to mine and found that the process method now returns CommandResult, not a CommandResult Optional.

1 Like

Ignore this, was wrong.

That’s really weird! I updated my maven dependencies and the sponge-2.1-SNAPSHOT.jar still shows the CommandCallable interface as the following???

public abstract interface CommandCallable
{
public abstract Optional process(CommandSource paramCommandSource, String paramString)
throws CommandException;

public abstract List getSuggestions(CommandSource paramCommandSource, String paramString)
throws CommandException;

public abstract boolean testPermission(CommandSource paramCommandSource);

public abstract Optional<? extends Text> getShortDescription(CommandSource paramCommandSource);

public abstract Optional<? extends Text> getHelp(CommandSource paramCommandSource);

public abstract Text getUsage(CommandSource paramCommandSource);
}

What does your pom.xml look like? What IDE are you using?

1 Like

I’m using eclipse. Here’s my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>MyIDHere</groupId>
  <artifactId>MyArtifactIDHere</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
  	<dependency>
  		<groupId>org.spongepowered</groupId>
  		<artifactId>spongeapi</artifactId>
  		<version>2.1-SNAPSHOT</version>
  		<scope>provided</scope>
  	</dependency>
  </dependencies>
</project>

You should have the repository along with the dependency:

View here

To update your dependencies:

  1. Right-Click Project > Maven > Update Project
  2. Select the “Force updates of snapshots/releases” checkbox
  3. Click OK
1 Like

I did everything exactly like you said (changed my pom.xml to match yours and forced update of snapshots) and still have:

public abstract interface CommandCallable
{
public abstract Optional process(CommandSource paramCommandSource, String paramString)
throws CommandException;

public abstract List getSuggestions(CommandSource paramCommandSource, String paramString)
throws CommandException;

public abstract boolean testPermission(CommandSource paramCommandSource);

public abstract Optional<? extends Text> getShortDescription(CommandSource paramCommandSource);

public abstract Optional<? extends Text> getHelp(CommandSource paramCommandSource);

public abstract Text getUsage(CommandSource paramCommandSource);
}

Hmm…
Which checkboxes are checked in the update project menu?

1 Like

Not sure if that link will work

My pom.xml is now:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>PixelMasters</groupId>
  <artifactId>PM2Sponge</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <repositories>
    <repository>
        <id>sponge-maven-repo</id>
        <name>Sponge maven repo</name>
        <url>http://repo.spongepowered.org/maven</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
  </repositories>
	
  <dependencies>
    <dependency>
        <groupId>org.spongepowered</groupId>
        <artifactId>spongeapi</artifactId>
        <version>2.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
</project>

This is very odd. If you create a new project, will the correct dependencies load?

1 Like

Wtf? Yes it worked… I’m not sure why though? I’ll delete my pom.xml in my current project and remake to see if that works?

Yes try that, and then refresh both the Maven dependencies and the actual project.

1 Like

There we go, now it shows process as returning CommandResult! I think I was messing something up with the Pom.xml, mainly because of eclipse’s annoying, confusing gui for it. But I should be good now, thank you so much for the help @Flibio ! I’ll post here again if I have any problems when I actually run the updated code.

Edit: One more thing, do you happen to know where the best place to find the most updated javadoc would be?

No problem! For the pom.xml editing, I right-click it > Open With > Text Editor. This is a lot easier to do than using that GUI!

For javadocs: http://spongepowered.github.io/SpongeAPI/. That is the only java doc location I know of.

official Javadocs should be here:
https://jd.spongepowered.org/

idk if they’re beeing built automated or manually.

Awesome thanks! And I guess I was just confused because they haven’t updated the javadoc’s version to 2.1 yet?

If you absolute latest code for the SpongeAPI, you could find it on GitHub: GitHub - SpongePowered/SpongeAPI: A Minecraft plugin API

Okay will do. And I have confirmed the commands work again in game :smile:

1 Like