/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package com.l2jmobius.gameserver;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.clientpackets.Say2;
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.script.DateRange;
import javolution.text.TextBuilder;
import javolution.util.FastList;
/**
* This class ...
* @version $Revision: 1.5.2.1.2.7 $ $Date: 2005/03/29 23:15:14 $
*/
public class Announcements
{
private static Logger _log = Logger.getLogger(Announcements.class.getName());
private static Announcements _instance;
private final List _announcements = new FastList<>();
private final List> eventAnnouncements = new FastList<>();
public Announcements()
{
loadAnnouncements();
}
public static Announcements getInstance()
{
if (_instance == null)
{
_instance = new Announcements();
}
return _instance;
}
public void loadAnnouncements()
{
_announcements.clear();
final File file = new File(Config.DATAPACK_ROOT, "data/announcements.txt");
if (file.exists())
{
readFromDisk(file);
}
else
{
_log.config("data/announcements.txt doesn't exist");
}
}
public void showAnnouncements(L2PcInstance activeChar)
{
for (int i = 0; i < _announcements.size(); i++)
{
final CreatureSay cs = new CreatureSay(0, Say2.ANNOUNCEMENT, activeChar.getName(), _announcements.get(i).toString());
activeChar.sendPacket(cs);
}
for (int i = 0; i < eventAnnouncements.size(); i++)
{
final List