* @see lineage2.gameserver.listener.actor.player.OnPlayerEnterListener#onPlayerEnter(Player)
*/
@Override
public void onPlayerEnter(Player player)
{
Clan clan = player.getClan();
if ((clan == null) || (clan.getLevel() < 2))
{
return;
}
if (clan.getNotice() == null)
{
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
String notice = "";
int type = 0;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT * FROM `bbs_clannotice` WHERE `clan_id` = ? and type != 2");
statement.setInt(1, clan.getClanId());
rset = statement.executeQuery();
if (rset.next())
{
notice = rset.getString("notice");
type = rset.getInt("type");
}
}
catch (Exception e)
{
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
clan.setNotice(type == 1 ? notice.replace("\n", "<br1>\n") : "");
}
if (!clan.getNotice().isEmpty())
{
String html = HtmCache.getInstance().getNotNull(Config.BBS_HOME_DIR + "clan_popup.htm", player);
html = html.replace("%pledge_name%", clan.getName());
html = html.replace("%content%", clan.getNotice());
player.sendPacket(new NpcHtmlMessage(0).setHtml(html));
}
}