Bug fix with variables

Also partial update for protocolLib support and misc code cleaning