Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java

63 lines
1.5 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.habbohotel.hotelview;
import com.eu.habbo.Emulator;
import gnu.trove.map.hash.THashMap;
2018-09-28 21:25:00 +02:00
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
2018-07-06 15:30:00 +02:00
public class HallOfFame
{
2018-07-08 23:32:00 +02:00
2018-09-28 21:25:00 +02:00
private final THashMap<Integer, HallOfFameWinner> winners = new THashMap<>();
2018-07-06 15:30:00 +02:00
2018-07-08 23:32:00 +02:00
2018-09-28 21:25:00 +02:00
private String competitionName;
2018-07-06 15:30:00 +02:00
public HallOfFame()
{
2019-03-18 02:22:00 +01:00
this.setCompetitionName("xmasRoomComp");
2018-07-06 15:30:00 +02:00
2019-03-18 02:22:00 +01:00
this.reload();
2018-07-06 15:30:00 +02:00
}
2018-07-08 23:32:00 +02:00
2018-07-06 15:30:00 +02:00
public void reload()
{
this.winners.clear();
synchronized (this.winners)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery(Emulator.getConfig().getValue("hotelview.halloffame.query")))
{
while (set.next())
{
HallOfFameWinner winner = new HallOfFameWinner(set);
this.winners.put(winner.getId(), winner);
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}
public THashMap<Integer, HallOfFameWinner> getWinners()
{
return this.winners;
}
public String getCompetitionName()
{
return this.competitionName;
}
void setCompetitionName(String name)
{
this.competitionName = name;
}
}