I’ve honestly looked a lot into this. I searched the API and traced the path, but can’t figure out why it’s not working. I’ve isolated it to the line Inventory playerInventory = p.getInventory();. My method within CommandCallable is below. Thanks for the help!
@WetSponge that’s not how casting works. When a Class does indeed extend another Class, it obtains its features, as well. In this situation, casting to Human wouldn’t make much difference.
@soccer66 It sounds as though the API you’re using to develop with is either older or newer than the implementation that you’re using.
Could you post your Sponge/Forge version, as well as what API you’re developing with? For the latest, you should be on 2.1-SNAPSHOT for the API.
Group Id: org.spongepowered
Artifact Id: spongeapi
Version: 2.1-SNAPSHOT
Packaing: jar
I updated TO THIS this at some point yesterday, but no changes were really made. It still auto completes in eclipse that I can do player.getInventory(). Is the 2.1-SNAPSHOT the same as SpongeAPI 2.0 API? Because that’s what the github links to (as well as what @WetSponge linked). How do I properly update my SpongeAPI in eclipse, since I was using an older version? (Using Maven)
And I am currently using sponge-1.8-1446-2.1DEV-507 @FerusGrim. I feel like my API version is behind the sponge version. Is there a more updated API version?
@Tzk So then why would eclipse be auto completing with a method that doesn’t exist? I guess it means for some reason my Maven SpongeAPI version didn’t update or something? Do you know how to do this?
Maven downloads from the repo, and then uses the artifact that it stores locally. Have you tried updating your Maven indices? If not, it may not have downloaded the most recent API from the repository.
Okay I don’t really know what was wrong (something with the pom.xml), but I now have spongeapi-2.1-SNAPSHOT.jar as a dependency! Except it’s still saying player has a getInventory() method? Is this wrong? And am I doing something wrong with the Player p = (Player) source; casting line?