public int compareTo(EventTeam second)
{
if (getScore() > second.getScore())
return 1;
else if (getScore() < second.getScore())
return -1;
return 0;
}
protected int getScore()
{
return score;
}
protected int getId()
{
return id;
}
There is code already which u can use instead of code something that u saw in ur sleep or something
Since i dont code things in l2j,i will try to make it as simple as i can tho (what i would do):
If its supposed to be more than X teams (x >>2):
Track down the team with the highest score.Since i dont know what kind of collection is this,dunno whats more efficient(dunno the methods but it looks like hashmap or what...arraylist fanboy).
Copy the team with the highest score into an object,and later on get the id.That might be the most easy way.
OR
set highestScore=0 id =0,compare score that each team's score and if it has higher score than that,save the id and after the loop return it.
If its supposed to be with 2 teams:
Just get their scores and return the id.
Thats my prespective.No coding in l2j tho Kappa
- Editted several times to clarify how u can actually code it-
gl
P.S thats w/o 2 team same score.if 2 teams have same score,it becomes more tricky.