In the 2.1 api snapshot, it states Player extends Human. If I open the declaration of Human, it states Human extends Carrier. Inside of Carrier I find:
public abstract CarriedInventory<? extends Carrier> getInventory();
This means it has to be something with how I’m getting the Player. I’m going to try to think of different ways of doing this.
Oh I figured out what it is I think. I’m now getting java.lang.AbstractMethodError, instead of the java.lang.NoSuchMethodError. Does this just mean it’s not implemented? I’m not familiar with abstract methods. @FerusGrim
Correct, it means the method is defined for the interface, but the implementation is lacking the method being added. Even though EntityPlayer does implement Player, it doesn’t mean that at the byte code level that it implements all methods of Player. This is why there are AbstractMethodErrors on many api calls.
Makes sense, and to go even deeper, if it’s an interface, does it mean it has at least one unimplemented method/value, but may have implemented ones? An example of this would be how
public abstract interface PlayerBreakBlockEvent
extends HumanBreakBlockEvent, PlayerChangeBlockEvent
{}
is clearly abstract, but does not create an exception and works in plugins I’ve made. Am I correct, or are interfaces different?
Adding the abstract modifier to interfaces is no longer required and therefore is no longer recommended. Same goes with adding public to interface methods.
An interface, if being exposed as a stable public API, should have most to all methods implemented on some level since it is being publicly shared and therefore be working.
Sponge is not at a stable-release yet, it is still under heavy development.
It all depends on the implementation, some interfaces are fully implemented, others are lacking implementation. The only way you can get an AbstractMethodError is when you’re calling a method that is contractually accepted but just not implemented. So, if you just never call a method, well, you’ll have no errors ;).