package net.sourceforge.pain.data;
import net.sourceforge.pain.data.type.*;
import net.sourceforge.pain.db.*;
public final class PlayersRegistry extends DbObject {
private static final int PLAYERS_BY_LOGIN = 0;
private static final int NFIELDS = 1;
public PlayersRegistry() {
}
public PlayersRegistry(PainDB db) {
super(db);
}
protected DbClassSchema provideSchema() {
byte types[] = new byte[NFIELDS];
String names[] = new String[NFIELDS];
types[PLAYERS_BY_LOGIN] = DbType.STRING_KEY_MAP;
names[PLAYERS_BY_LOGIN] = "player_by_login";
return new DbClassSchema(types, names);
}
public Player getPlayer(String login) {
return (Player) getStringKeyMap(PLAYERS_BY_LOGIN).get(login);
}
public void addPlayer(Player p) {
getStringKeyMap(PLAYERS_BY_LOGIN).put(p.getLogin(), p);
}
}