Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Java by anonymus ( 14 years ago )
/* 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 2, 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package net.sf.l2j.gameserver.taskmanager.tasks;

import java.util.Calendar;

import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.model.PmLogger;
import net.sf.l2j.gameserver.taskmanager.Task;
import net.sf.l2j.gameserver.taskmanager.TaskManager;
import net.sf.l2j.gameserver.taskmanager.TaskTypes;
import net.sf.l2j.gameserver.taskmanager.TaskManager.ExecutedTask;

/**
 *
 * @author Fakoykas
 */
public class TaskPmLogsDelete extends Task
{
    public static final String NAME = "DeletePmLogs";

    @Override
 public String getName()
    {
        return NAME;
    }
    
    @Override
 public void onTimeElapsed(ExecutedTask task)
    {
  Calendar cal = Calendar.getInstance();
  
  if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY)
  {
   PmLogger.cleanPmLogs();
   Announcements.getInstance().announceToAll("PM Logs have been deleted.");
  }
    }
    
    @Override
 public void initializate()
    {
        super.initializate();
        TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_GLOBAL_TASK, "1", "00:10:00", "");
    }
}

 

Revise this Paste

Your Name: Code Language: