Help with Eclipse Error

Status
This thread has been locked.

ZethMC

Feedback score
0
Posts
75
Reactions
15
Resources
0
My HCF Core is pretty much done but the GM Is not working and thats making everything not to work if someone could help me out with this error PM Me on MCMarket

And if i hover over the error it says: The method getMaxHealth() is ambiguous for the type Player

Some Code:
ed222d58a887390440b5368d65a863b9.png


--------------------------------------------------------------------------------

a1429e4501445c6a56c968f406680da7.png

--------------------------------------------------------------------------------
ad2bfa91b42b13038d7629ee9f273258.png
 
Last edited:

Skionz

ogminecraft.com
Premium
Feedback score
1
Posts
1,547
Reactions
1,527
Resources
0
My HCF Core is pretty much done but the GM Is not working and thats making everything not to work if someone could help me out with this error PM Me on MCMarket
We don't magically know the solution if you don't explain it, give us the source, or even give us an exception.
 

Skionz

ogminecraft.com
Premium
Feedback score
1
Posts
1,547
Reactions
1,527
Resources
0
I'm not sure, but I have a question about this bit:

Code:
final double maxHealth;
if (onlyTarget != null && (maxHealth = onlyTarget.getHealth()) == onlyTarget.getMaxHealth()) {
    sender.sendMessage(...);
    return true;
}

If this were to be executed by two separate players at the same time, wouldn't the variable
Code:
final double maxHealth;
change twice? So one of them would receive incorrect information? You are not using a separate object for each target but a common variable that is being shared. I THINK it can cause clashes. Not sure, lets see what others have to say.
That's not how it works.
 

Boat

Premium
Feedback score
6
Posts
174
Reactions
118
Resources
0
This shouldn't cause any errors.
What error pops up when you hover over the code with errors?
 

Tylerzz

Premium
Feedback score
13
Posts
959
Reactions
515
Resources
1
If you are using 1.7, you will need to use a Damageable to get the health.
 

morganjp

Retired Staff Member
Supreme
Feedback score
6
Posts
497
Reactions
746
Resources
0
Why don't you actually hover over the red lines, so it tells you what the error is and people know how to fix it.
Jesus christ.
 

Boat

Premium
Feedback score
6
Posts
174
Reactions
118
Resources
0
It says The method getMaxHealth() is ambiguous for the type Player
I think I recognize that error for 1.7 coding. Try casting it to LivingEntity and getting the health.
 

Tylerzz

Premium
Feedback score
13
Posts
959
Reactions
515
Resources
1
Status
This thread has been locked.
Top