You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
685 B
42 lines
685 B
package net.sector.level.highscore;
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import net.sector.CustomIonMarks;
|
|
|
|
import com.porcupine.ion.AbstractIonList;
|
|
|
|
|
|
/**
|
|
* A highscore table
|
|
*
|
|
* @author Ondřej Hruška (MightyPork)
|
|
*/
|
|
public class HighscoreTable extends AbstractIonList<HighscoreEntry> {
|
|
|
|
/**
|
|
* Add a highscore
|
|
*
|
|
* @param score
|
|
* @param name
|
|
* @return the new score
|
|
*/
|
|
public HighscoreEntry addScore(int score, String name) {
|
|
HighscoreEntry e;
|
|
add(e = new HighscoreEntry(score, name));
|
|
return e;
|
|
}
|
|
|
|
/**
|
|
* Sort entries
|
|
*/
|
|
public void sort() {
|
|
Collections.sort(this);
|
|
}
|
|
|
|
@Override
|
|
public byte ionMark() {
|
|
return CustomIonMarks.HIGHSCORE_TABLE;
|
|
}
|
|
}
|
|
|