Public feed
#532098
/* 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 net.sf.l2j.gameserver.Shutdown;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;import net.sf.l2j.gameserver.model.L2World;/** * @author Layane modded by Henning and Nille * */public final class TaskNoPlayerRestart extends Task{ public static String NAME = "noPlayerRestart"; public int counter = 5; public String ip = "127.0.0.1"; public static boolean restart = true; /* * (non-Javadoc) * * @see net.sf.l2j.gameserver.tasks.Task#getName() */ @Override public String getName() { return NAME; } /* * (non-Javadoc) * * @see net.sf.l2j.gameserver.tasks.Task#onTimeElapsed(net.sf.l2j.gameserver.tasks.TaskManager.ExecutedTask) */ @Override public void onTimeElapsed(ExecutedTask task) { int count = L2World.getInstance().getAllPlayersCount(); if (count == 0) { Shutdown shutdown = new Shutdown(); shutdown.startTelnetShutdown(ip, counter, restart); } } public void initializate() { super.initializate(); for (int hour = 0; hour <= 23; hour++) { String timeEnd = ":00:00"; String run = hour + timeEnd; TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_GLOBAL_TASK, "1", run, ""); } }}