First up, please clean up your code. The indentation is all over the place.
Then, you reference Minecraft inside your areaAfectada method, which will crash a server in an instant when called! Use the player parameter for your rayTrace instead.
The rayTrace method is client-side, too.
So copy the method in your item, add an entity parameter to it and replace every reference of "this" with that entity parameter.
The getPosition called in rayTrace is client-only as well, so copy that and add that entity parameter, too.