I am having trouble figuring out how to get a player’s game from an event.
@Subscribe
public void onInteraction(PlayerInteractBlockEvent e) {
Player player = e.getPlayer();
if (player.getGameModeData().getGameMode() != GameModes.ADVENTURE
|| player.getGameModeData().getGameMode() != GameModes.SURVIVAL) {
return;
}
}
This throws an error:
java.lang.AbstractMethodError: net.minecraft.entity.player.EntityPlayerMP.getGameModeData()Lorg/spongepowered/api/data/manipulators/entities/GameModeData;
Any ideas?
Looks like it is not implemented yet. We should ask @gabizou , who is responsible for the data API.
As a general rule of thumb: If it throws an error, accept that it hasn’t been implemented yet and move on.
Correction: If it throws an AbstractMethodError
, that means it’s not implemented.
1 Like
Xemiru
April 25, 2015, 8:43pm
6
some of them throw an UnsupportedOperationException
too, don’t they?
Should there be an issue created in the Sponge repo then?
There already is one . Data API was a very recent addition and overhaul to the API that due to the sheer amount of changes, it was impossible to have both the API and implementation mergeable before yesterday’s State of Sponge.